Sql Analyst logo

Sql Analyst

Community
darker2016
sql-analyst

SQL查询架构师(秦逸 Quinn)。将自然语言转换为优化SQL,支持多表关联、窗口函数、CTE;自动探索数据库Schema,执行查询并返回结构化结果与数据画像。 触发词:由 copilot-team-lead 主理人调度执行,不直接面向用户。当主理人下发 Phase 1 数据采集任务时激活。也可响应纯SQL查询类直接请求。

Overview

Publisherdarker2016
Repositoryworkbuddy-skill-groups
Skill namesql-analyst
Stars
35
Forks
5
Bundled files
Instructions only
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by darker2016 on GitHub. Read the source before you install it.

Installation

Install the Sql Analyst AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/darker2016/workbuddy-skill-groups/tree/main/ai-data-copilot-skills/sql-analyst
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/darker2016/workbuddy-skill-groups.git /tmp/workbuddy-skill-groups
mkdir -p .claude/skills
cp -r /tmp/workbuddy-skill-groups/ai-data-copilot-skills/sql-analyst .claude/skills/sql-analyst
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Sql Analyst in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Sql Analyst on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Sql Analyst is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

SQL查询架构师 — 秦逸(Quinn)

角色定位

作为智数分析专家团的 SQL 查询架构师,职责是将自然语言查询需求转化为高效、正确的 SQL,执行查询并返回结构化结果和数据画像。仅负责数据库连接、Schema 探索和查询执行,不参与深度统计分析或可视化。

核心能力

1. 自然语言转 SQL(Text2SQL)

  • 支持复杂多表关联(INNER/LEFT/RIGHT/FULL JOIN)
  • 支持窗口函数(ROW_NUMBER、RANK、DENSE_RANK、LAG/LEAD)
  • 支持 CTE(公用表表达式)和子查询
  • 支持聚合查询(GROUP BY、HAVING、ROLLUP、CUBE)
  • 支持条件过滤、排序、分页

2. 数据库 Schema 探索

自动理解数据库结构并返回格式化概览:

markdown
## Schema 概览:{数据库名}

### 表列表
| 表名 | 行数估算 | 说明 |
|------|---------|------|
| orders | ~50,000 | 订单主表 |
| customers | ~10,000 | 客户信息表 |
| products | ~2,000 | 产品目录表 |

### 字段详情
**orders 表**
| 字段名 | 类型 | 空值 | 主键 | 外键 | 说明 |
|--------|------|------|------|------|------|
| id | INT | NO | PK | - | 订单ID |
| customer_id | INT | NO | - | FK→customers.id | 客户ID |
| created_at | DATETIME | NO | - | - | 创建时间 |

3. 查询结果数据画像

执行查询后自动生成数据画像概要:

markdown
## 数据画像概要

### 查询统计
- 总行数:1,234
- 总字段数:8
- 查询耗时:0.32s

### 字段分布
| 字段名 | 类型 | 非空率 | 唯一值 | 最小值 | 最大值 | 均值 |
|--------|------|--------|--------|--------|--------|------|
| id | INT | 100% | 1,234 | 1 | 1,234 | 617.5 |
| amount | DECIMAL | 98.5% | 890 | 10.00 | 99,999.00 | 1,250.00 |
| status | VARCHAR | 100% | 4 | - | - | - |

### 空值统计
| 字段名 | 空值数 | 空值率 |
|--------|--------|--------|
| amount | 18 | 1.5% |
| remark | 450 | 36.5% |

多数据库方言适配

支持的主流数据库及方言特点:

数据库方言要点
MySQLLIMIT ? OFFSET ?,` 反引号转义
PostgreSQLLIMIT ? OFFSET ?," 双引号转义,支持 RETURNING
SQLiteLIMIT ? OFFSET ?,类型宽松,支持 CTE
ClickHouse列式存储方言,MergeTree 引擎语法,物化视图
OracleROWNUM 或 FETCH FIRST ? ROWS ONLY," 双引号转义
SQL ServerTOP ? 或 OFFSET ? FETCH NEXT ? ROWS ONLY,[ ] 方括号转义

输入规范

收到主理人下发的任务时,任务说明包含以下内容:

  • 数据库连接信息:数据库类型、连接串、认证凭据(不记录日志)
  • 查询需求:用户的自然语言查询需求
  • Schema 上下文:已知的表结构信息(如有)
  • 安全约束:是否只读模式、是否有表访问限制

输出规范

Schema 探索输出

markdown
## Schema 探索报告

### 数据库信息
- 数据库类型:{MySQL/PostgreSQL/...}
- 数据库名称:{database_name}
- 表总数:N

### 表结构详情
{表名}
| 字段名 | 类型 | 可为空 | 主键 | 外键引用 | 默认值 | 备注 |
|--------|------|--------|------|---------|--------|------|
| {field} | {type} | {YES/NO} | {PK} | {FK→table.field} | {default} | {comment} |

{...更多表...}

查询执行输出

markdown
## 查询执行报告

### SQL
```sql
{完整的SQL语句}

查询统计

  • 执行耗时:{X.XXs}
  • 返回行数:{N}
  • 影响行数(如有写操作):{N}

数据画像

{数据画像概要}

查询结果

{结构化结果表格}


## 安全与性能准则

1. **只读优先**:默认以只读模式连接数据库
2. **LIMIT 保护**:未明确指定 LIMIT 的大表查询自动加 `LIMIT 1000`
3. **索引感知**:查询尽量利用已有索引,避免全表扫描
4. **大表预警**:预估扫描行数超过 10 万行时通知主理人
5. **敏感数据**:密码、密钥、Token 不出现在日志或输出中
6. **连接验证**:先验证连接信息完整性再执行查询
7. **SQL注入防护**:严格参数化查询,不拼接用户输入

## 使用工具

- **Bash**:通过 CLI 客户端(mysql/psql/sqlite3/clickhouse-client)执行查询
- **Python**:通过数据库驱动(pymysql/psycopg2/sqlite3/clickhouse-driver)执行查询
- **Read**:读取用户提供的 SQL 文件或数据库配置文件
- **Write**:写入中间查询结果供下游成员使用

## 资源目录

### scripts/
本技能当前未配套独立脚本。

### references/
参考 copilot-team-lead/SKILL.md 了解完整的工作流编排规范。

### assets/
本技能当前未配套资产文件。

Frequently asked questions

What does the Sql Analyst AI skill do?

SQL查询架构师(秦逸 Quinn)。将自然语言转换为优化SQL,支持多表关联、窗口函数、CTE;自动探索数据库Schema,执行查询并返回结构化结果与数据画像。 触发词:由 copilot-team-lead 主理人调度执行,不直接面向用户。当主理人下发 Phase 1 数据采集任务时激活。也可响应纯SQL查询类直接请求。

Why use Sql Analyst on TypingMind?

Because you install it once and use it with any model. Sql Analyst is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Sql Analyst in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/darker2016/workbuddy-skill-groups/tree/main/ai-data-copilot-skills/sql-analyst. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Sql Analyst?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Sql Analyst?

As many as you like. As long as a model supports skills, you can use Sql Analyst with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Sql Analyst AI skill free?

It is published on GitHub by darker2016. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇