con un clic
smart-query
智能数据库查询技能。通过SSH隧道连接线上数据库,支持自然语言转SQL、执行查询、表结构探索。当用户需要查询数据库、问数据、看表结构时使用此技能。
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Menú
智能数据库查询技能。通过SSH隧道连接线上数据库,支持自然语言转SQL、执行查询、表结构探索。当用户需要查询数据库、问数据、看表结构时使用此技能。
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Basado en la clasificación ocupacional SOC
Use when a request asks for a Chinese-first AI video script with shot plans, image prompts, narration, subtitles, or handoff contracts for scene generation, image generation, video assembly, or WeChat draft preparation.
Use when a Codex task needs native image generation or editing, especially a set, series, material kit, long image, multi-screen design, storyboard, carousel, or other deliverable requiring multiple consistent images.
Skill 开发指南。当用户需要创建新 Skill 或更新已有 Skill 时触发,提供标准化模板、目录规范和最佳实践。
Use when reviewing an agent Skill before sharing, installing, or executing it and when checking a Skill bundle for credentials, dangerous commands, suspicious network behavior, or obfuscated code.
This skill should be used when preparing Markdown articles for a WeChat Official Account draft box, selecting wenyan-cli themes, processing article images, or troubleshooting authentication and whitelist failures.
Fetch and summarize Feishu group chat history. Use when the user asks to read, review, or summarize messages from a Feishu group chat. Triggers: "看群聊记录", "群里聊了啥", "帮我看看这个群", "群消息历史", "chat history", "what did the group discuss". NOT for: sending messages (use message tool), reading documents (use feishu-doc skill), or wiki operations (use feishu-wiki skill).
| name | smart-query |
| description | 智能数据库查询技能。通过SSH隧道连接线上数据库,支持自然语言转SQL、执行查询、表结构探索。当用户需要查询数据库、问数据、看表结构时使用此技能。 |
通过 SSH 隧道安全连接线上数据库,支持自然语言查询和 SQL 执行。
python .opencode/skills/smart-query/scripts/db_connector.py
python .opencode/skills/smart-query/scripts/query.py "SELECT * FROM table_name LIMIT 10"
python .opencode/skills/smart-query/scripts/query.py "SHOW TABLES"
python .opencode/skills/smart-query/scripts/query.py "DESC table_name"
参数:
-n 50:限制返回行数-f json:JSON格式输出--raw:输出原始结果(含元信息)python .opencode/skills/smart-query/scripts/schema_loader.py
生成 references/schema.md,包含所有表结构信息。
references/schema.md 了解表结构query.py 执行配置文件:config/settings.json
{
"ssh": {
"host": "SSH跳板机地址",
"port": 22,
"username": "用户名",
"password": "密码",
"key_file": null
},
"database": {
"type": "mysql",
"host": "数据库内网地址",
"port": 3306,
"database": "库名",
"username": "数据库用户",
"password": "数据库密码"
}
}
smart-query/ 目录config/settings.json.example 为 settings.jsonpip install paramiko sshtunnel pymysqlconfig/settings.json 包含敏感信息,不要提交到 Gitconfig/settings.json 加入 .gitignorepip install paramiko sshtunnel pymysql
| 脚本 | 用途 |
|---|---|
scripts/db_connector.py | SSH隧道+数据库连接,可单独运行测试连接 |
scripts/query.py | 执行SQL查询,支持表格/JSON输出 |
scripts/schema_loader.py | 加载表结构,生成 schema.md |
| 文档 | 说明 |
|---|---|
references/schema.md | 数据库表结构(运行 schema_loader.py 生成) |