SQL Database Support for pREST
prest/prest
Guides classifying, gap-analyzing and scaffolding support for a new SQL database in pREST, from Postgres-compatible variants to entirely new dialects.
帮助用户编写和优化 SQL 查询,包括将自然语言转换为 SQL、提供查询优化建议以及解读 EXPLAIN 执行计划。当用户需要 SQL 相关帮助时触发,例如直接请求“自然语言转SQL”、“帮我优化这条SQL”、“解释一下这个执行计划”,或提及关键词如 NL2SQL、SQL优化、慢查询、索引建议、全表扫描、SQL调优,以及支持 SQLite 和 PostgreSQL 数据库时。
$ npx skills add rongxinzy/RongxinAI --skill sql-tutor -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install rongxinzy/RongxinAI sql-tutor --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/rongxinzy/RongxinAI.git skills-src && mkdir -p .claude/skills && cp -r skills-src/SKILLs/sql-tutor .claude/skills/sql-tutor && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "sql-tutor" agent skill from https://github.com/rongxinzy/RongxinAI/tree/main/SKILLs/sql-tutor into .claude/skills/sql-tutor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "sql-tutor", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/rongxinzy/RongxinAI/tree/main/SKILLs/sql-tutorType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add rongxinzy/RongxinAI --skill sql-tutor -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install rongxinzy/RongxinAI sql-tutor --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/rongxinzy/RongxinAI.git skills-src && mkdir -p .agents/skills && cp -r skills-src/SKILLs/sql-tutor .agents/skills/sql-tutor && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "sql-tutor" agent skill from https://github.com/rongxinzy/RongxinAI/tree/main/SKILLs/sql-tutor into .agents/skills/sql-tutor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "sql-tutor", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add rongxinzy/RongxinAI --skill sql-tutor -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install rongxinzy/RongxinAI sql-tutor --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/rongxinzy/RongxinAI.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/SKILLs/sql-tutor .cursor/skills/sql-tutor && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "sql-tutor" agent skill from https://github.com/rongxinzy/RongxinAI/tree/main/SKILLs/sql-tutor into .cursor/skills/sql-tutor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "sql-tutor", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/rongxinzy/RongxinAI.git --path SKILLs/sql-tutor--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add rongxinzy/RongxinAI --skill sql-tutor -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install rongxinzy/RongxinAI sql-tutor --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/rongxinzy/RongxinAI.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/SKILLs/sql-tutor .gemini/skills/sql-tutor && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "sql-tutor" agent skill from https://github.com/rongxinzy/RongxinAI/tree/main/SKILLs/sql-tutor into .gemini/skills/sql-tutor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "sql-tutor", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install rongxinzy/RongxinAI sql-tutorInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add rongxinzy/RongxinAI --skill sql-tutor -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/rongxinzy/RongxinAI.git skills-src && mkdir -p .github/skills && cp -r skills-src/SKILLs/sql-tutor .github/skills/sql-tutor && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "sql-tutor" agent skill from https://github.com/rongxinzy/RongxinAI/tree/main/SKILLs/sql-tutor into .github/skills/sql-tutor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "sql-tutor", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add rongxinzy/RongxinAI --skill sql-tutor -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install rongxinzy/RongxinAI sql-tutor --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/rongxinzy/RongxinAI.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/SKILLs/sql-tutor .opencode/skills/sql-tutor && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "sql-tutor" agent skill from https://github.com/rongxinzy/RongxinAI/tree/main/SKILLs/sql-tutor into .opencode/skills/sql-tutor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "sql-tutor", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
sql-tutor帮助用户编写和优化 SQL 查询,包括将自然语言转换为 SQL、提供查询优化建议以及解读 EXPLAIN 执行计划。当用户需要 SQL 相关帮助时触发,例如直接请求“自然语言转SQL”、“帮我优化这条SQL”、“解释一下这个执行计划”,或提及关键词如 NL2SQL、SQL优化、慢查询、索引建议、全表扫描、SQL调优,以及支持 SQLite 和 PostgreSQL 数据库时。
SQL Tutor is an agent skill from rongxinzy/RongxinAI. 帮助用户编写和优化 SQL 查询,包括将自然语言转换为 SQL、提供查询优化建议以及解读 EXPLAIN 执行计划。当用户需要 SQL 相关帮助时触发,例如直接请求“自然语言转SQL”、“帮我优化这条SQL”、“解释一下这个执行计划”,或提及关键词如 NL2SQL、SQL优化、慢查询、索引建议、全表扫描、SQL调优,以及支持 SQLite 和 PostgreSQL 数据库时。
Its SKILL.md is about 1.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files, including scripts (for example `scripts/sql_query_helper.py` and `zhiyuan/metadata.yaml`).
It sits in Databases, covering SQL. It works with SQL, SQLite and PostgreSQL. The repository describes itself as: An all-in-one local AI Agent workspace with a fully self-developed stack. The licence is MIT.
4 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit 901b46b. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Ships 1 file in scripts/ (Python), which the agent can run.
Shell commands in SKILL.md call:
python3pipFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md. Its commands use pip, which can reach the network depending on how they are called.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
SQL Tutor loads about 1.4k tokens when it runs. Until then it costs about 50 tokens; SKILL.md has 267 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.
The full file from rongxinzy/RongxinAI at commit 901b46b, republished under its MIT licence (© rongxinzy). 267 words, ~1,437 tokens.
.claude/skills/sql-tutor/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.SQL 查询辅助工具 —— 自然语言→SQL 翻译、查询优化分析、EXPLAIN 执行计划解读。
| 功能 | 说明 |
|---|---|
| Schema 提取 | 提取数据库表结构(列、类型、索引、外键、样本数据),为 NL→SQL 提供上下文 |
| 自然语言→SQL | 结合 Schema 上下文,将自然语言描述翻译为 SQL 查询 |
| 查询优化分析 | 基于 13 条规则检测 SQL 反模式,给出优化建议 |
| EXPLAIN 解读 | 执行 EXPLAIN 并解读查询计划,识别全表扫描、索引缺失等问题 |
schema 命令提取数据库表结构optimize 命令检查生成的 SQL 是否有优化空间explain 命令验证查询执行计划# 步骤1:提取 Schema(紧凑模式,适合作为 LLM 上下文)
python3 scripts/sql_query_helper.py --db-path data.db schema --compact
# 步骤2:分析 SQL 优化建议
python3 scripts/sql_query_helper.py optimize "SELECT * FROM orders WHERE user_id = 100"
# 步骤3:查看 EXPLAIN 执行计划
python3 scripts/sql_query_helper.py --db-path data.db explain "SELECT * FROM orders WHERE user_id = 100"# 提取完整 Schema(JSON 格式,含样本数据)
python3 scripts/sql_query_helper.py --db-path data.db schema
# 紧凑模式(纯文本,适合嵌入 prompt)
python3 scripts/sql_query_helper.py --db-path data.db schema --compact
# 不采样数据
python3 scripts/sql_query_helper.py --db-path data.db schema --sample-rows 0
# PostgreSQL
python3 scripts/sql_query_helper.py --db-type postgres --dsn "host=localhost dbname=mydb user=reader" schema --compact# 分析 SQL 查询(无需数据库连接,纯规则检测)
python3 scripts/sql_query_helper.py optimize "SELECT * FROM orders o, users u WHERE o.user_id = u.id"
python3 scripts/sql_query_helper.py optimize "SELECT name FROM users WHERE UPPER(email) LIKE '%@GMAIL.COM'"
python3 scripts/sql_query_helper.py optimize "SELECT id, (SELECT COUNT(*) FROM orders WHERE user_id = u.id) AS order_count FROM users u"# SQLite EXPLAIN
python3 scripts/sql_query_helper.py --db-path data.db explain "SELECT * FROM orders WHERE user_id = 100"
# PostgreSQL EXPLAIN
python3 scripts/sql_query_helper.py --db-type postgres --dsn "host=localhost dbname=mydb" explain "SELECT * FROM orders WHERE user_id = 100"
# PostgreSQL EXPLAIN ANALYZE(实际执行查询,获取真实数据)
python3 scripts/sql_query_helper.py --db-type postgres --dsn "host=localhost dbname=mydb" explain --analyze "SELECT * FROM orders WHERE user_id = 100"| 参数 | 必填 | 默认值 | 说明 |
|---|---|---|---|
--db-type | 否 | sqlite | 数据库类型:sqlite 或 postgres |
--db-path | schema/explain 时(SQLite) | — | SQLite 数据库文件路径 |
--dsn | schema/explain 时(PostgreSQL) | — | PostgreSQL 连接串 |
| 命令 | 需要数据库 | 说明 |
|---|---|---|
schema | 是 | 提取数据库表结构 |
optimize <sql> | 否 | SQL 查询优化分析(纯规则检测) |
explain <sql> | 是 | 执行 EXPLAIN 并解读 |
| 参数 | 默认值 | 说明 |
|---|---|---|
--sample-rows, -n | 3 | 每表采样行数(0 表示不采样) |
--compact | false | 紧凑文本输出(适合嵌入 prompt) |
| 参数 | 默认值 | 说明 |
|---|---|---|
--analyze | false | 使用 EXPLAIN ANALYZE(仅 PostgreSQL,会实际执行查询) |
optimize 命令检测以下 13 类 SQL 反模式:
| 规则 | 严重度 | 说明 |
|---|---|---|
| avoid-select-star | warning | 避免 SELECT *,显式列出列名 |
| unbounded-query | info | 缺少 WHERE 和 LIMIT |
| leading-wildcard-like | warning | LIKE '%...' 导致索引失效 |
| or-condition | info | OR 条件可能阻止索引使用 |
| not-in-subquery | warning | NOT IN (子查询) 性能差 |
| scalar-subquery | warning | SELECT 中的标量子查询逐行执行 |
| function-on-column | warning | WHERE 中对列使用函数导致索引失效 |
| implicit-join | info | 隐式连接可读性差 |
| distinct-usage | info | DISTINCT 可能掩盖 JOIN 问题 |
| order-without-limit | info | ORDER BY 没有 LIMIT |
| deep-nesting | warning | 多层嵌套子查询 |
| having-without-group | warning | HAVING 没有 GROUP BY |
| not-equal-filter | info | != 条件无法有效使用索引 |
| 检测项 | 适用数据库 | 说明 |
|---|---|---|
| 全表扫描 | SQLite / PostgreSQL | 检测 Seq Scan / SCAN TABLE |
| 自动临时索引 | SQLite | SQLite 自动创建临时索引,说明缺少永久索引 |
| 覆盖索引 | SQLite / PostgreSQL | 索引包含所有查询列,无需回表 |
| 磁盘排序 | PostgreSQL | 排序溢出到磁盘 |
| 嵌套循环连接 | PostgreSQL | 大表嵌套循环性能差 |
| 行数估计偏差 | PostgreSQL (ANALYZE) | 预估行数与实际行数差距大于 10 倍 |
-- Database: sqlite
-- users (1500 rows): id INTEGER PK, name TEXT, email TEXT, age INTEGER, created_at TEXT
-- IDX(unique): idx_users_email on (email)
-- orders (8200 rows): id INTEGER PK, user_id INTEGER, amount REAL, status TEXT, created_at TEXT
-- FK: user_id -> users.id
-- IDX: idx_orders_user_id on (user_id){
"sql": "SELECT * FROM orders o, users u WHERE o.user_id = u.id",
"issues": [
{
"severity": "warning",
"rule": "avoid-select-star",
"message": "避免 SELECT *:只选择需要的列,减少 I/O 和网络传输",
"suggestion": "将 SELECT * 改为显式列出需要的列名"
},
{
"severity": "info",
"rule": "implicit-join",
"message": "使用了隐式连接(逗号分隔表),可读性差且易出错",
"suggestion": "改用显式 JOIN ... ON 语法,提高可读性和可维护性"
}
]
}{
"db_type": "sqlite",
"query": "SELECT * FROM orders WHERE user_id = 100",
"plan": [
{"id": 2, "parent": 0, "detail": "SEARCH orders USING INDEX idx_orders_user_id (user_id=?)"}
],
"interpretation": [
{
"severity": "ok",
"type": "index-search",
"detail": "使用索引查找: idx_orders_user_id",
"suggestion": "索引查找效率良好"
}
]
}?mode=ro;PostgreSQL 使用 SET SESSION READ ONLYsqlite3 为内置模块)pip install psycopg2-binaryoptimize 命令无需数据库连接,零外部依赖© rongxinzy, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 5 other files (scripts) in SKILLs/sql-tutor of rongxinzy/RongxinAI.
Open the folder on GitHubat commit 901b46b
SQL Tutor next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| SQL Tutor this skillrongxinzy/RongxinAI | 154 | — | ~1.4k | Automated safety check: Pass | MIT | |
| SQL Database Support for pRESTprest/prest | 4.6k | — | ~1.6k | Automated safety check: Pass | MIT | |
| Squixeduardofuncao/squix | 273 | — | ~784 | Automated safety check: Pass | MIT | |
| Golang Databaseunxed/f4 | 240 | 2 repos | ~2.9k | Automated safety check: Pass | MIT | |
| Database MigrationRain-kl/OpenFlare | 288 | — | ~1.3k | Automated safety check: Pass | Apache-2.0 | |
| DB Migratealexeykrol/claude-code-starter | 194 | — | ~405 | Automated safety check: Notes | None |
prest/prest
Guides classifying, gap-analyzing and scaffolding support for a new SQL database in pREST, from Postgres-compatible variants to entirely new dialects.
eduardofuncao/squix
Run SQL queries across databases (Postgres, MySQL, SQLite, etc.) via the squix CLI.
unxed/f4
Comprehensive guide for Go database access — parameterized queries, struct scanning, NULLable columns, transactions, isolation levels, SELECT FOR UPDATE, connection pool, batch processing, context…
Rain-kl/OpenFlare
Wavelet 项目专用:当新增或修改数据库表结构、索引、初始化数据、系统配置 seed、模板 seed、默认管理员、goose SQL 迁移、internal/infra/persistence/migrator、ClickHouse 分析库 DDL 或数据库升级流程时必须使用。本技能指导在 internal/infra/persistence/migrator/goose 下编写…
alexeykrol/claude-code-starter
Миграция схемы базы данных: SQLite → PostgreSQL/Supabase. An agent skill from alexeykrol/claude-code-starter.
Cod-e-Codes/marchat
Changes marchat SQL schema and queries across SQLite, PostgreSQL, and MySQL using dialect helpers.
rongxinzy/RongxinAI
SaaS financial health advisor. An agent skill from rongxinzy/RongxinAI.
rongxinzy/RongxinAI
Reduce voluntary and involuntary churn through cancel flow design, save offers, exit surveys, and dunning sequences.
rongxinzy/RongxinAI
The only skill for creating a new PowerPoint deck. An agent skill from rongxinzy/RongxinAI.
rongxinzy/RongxinAI
ZhiYuan Agent expert package lifecycle manager for the pi engine.
rongxinzy/RongxinAI
Professional Ziwei Doushu consultation skill with an offline calculation engine.
rongxinzy/RongxinAI
飞书邮箱:Use when user mentions 起草邮件、写邮件、草稿、发送/回复/转发邮件、查阅邮件、看邮件、搜索邮件、邮件文件夹、邮件标签、邮件联系人、监听新邮件、邮件收信规则等;use for mail/email intent only.
Works with
Categories
帮助用户编写和优化 SQL 查询,包括将自然语言转换为 SQL、提供查询优化建议以及解读 EXPLAIN 执行计划。当用户需要 SQL 相关帮助时触发,例如直接请求“自然语言转SQL”、“帮我优化这条SQL”、“解释一下这个执行计划”,或提及关键词如 NL2SQL、SQL优化、慢查询、索引建议、全表扫描、SQL调优,以及支持 SQLite 和 PostgreSQL 数据库时。. SQL Tutor is an agent skill from rongxinzy/RongxinAI.
SQL Tutor fits situations like: tasks that involve SQL.
Run `npx skills add rongxinzy/RongxinAI --skill sql-tutor -a claude-code`. Or copy the skill folder (SKILLs/sql-tutor in rongxinzy/RongxinAI) into .claude/skills/sql-tutor in your project. Claude Code loads it when a task matches its description.
Run `npx skills add rongxinzy/RongxinAI --skill sql-tutor -a codex`. Or copy the skill folder (SKILLs/sql-tutor in rongxinzy/RongxinAI) into .agents/skills/sql-tutor in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add rongxinzy/RongxinAI --skill sql-tutor -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/sql-tutor, .gemini/skills/sql-tutor, .github/skills/sql-tutor and .opencode/skills/sql-tutor in your project.
Going by SKILL.md and its folder, SQL Tutor needs Python for the scripts in its folder and the command-line tools its instructions call (python3 and pip). Our summary lists: Python 3.
SKILL.md contains no URLs. Its commands use pip, which can reach the network depending on how they are called. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.
SQL Tutor is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.4k tokens (SKILL.md is roughly 5.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with SQL Tutor: SQL Database Support for pREST (prest/prest, 4.6k stars), Squix (eduardofuncao/squix, 273 stars), Golang Database (unxed/f4, 240 stars) and Database Migration (Rain-kl/OpenFlare, 288 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
rongxinzy (a GitHub organization) maintains it in rongxinzy/RongxinAI, which has 154 GitHub stars. The repository holds 100 skills in this directory. The repository was last updated on October 7, 2026.
Source: rongxinzy/RongxinAI on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.