sql-helper

sql-helper is a skill for Claude Code, Codex from bestdeejay-design/agent-skills. It costs 149 tokens per session (1,029 once invoked), scanned A, original, MIT.

A script that builds SQL queries from a plain-language question and a DDL schema, which is a file describing database tables and columns. It can create common queries and check their expected execution plan with EXPLAIN.

In plain words
What is it for?
Use it for quick SELECT, JOIN, WHERE, GROUP BY, COUNT, and LIMIT queries when you have a CREATE TABLE schema, or to inspect a query’s execution plan.
Why use it?
It reduces the manual work of translating a question into table names, joins, filters, grouping, sorting, and counts.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/bestdeejay-design/agent-skills/sql-helper
Any agent
npx skills add bestdeejay-design/agent-skills --skill sql-helper
Clone the repo
git clone --depth 1 https://github.com/bestdeejay-design/agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for sql-helper

README.md
[![agentmods](https://agentmods.dev/badge/skills/bestdeejay-design/agent-skills/sql-helper.svg)](https://agentmods.dev/skills/bestdeejay-design/agent-skills/sql-helper)
Your own site
<a href="https://agentmods.dev/skills/bestdeejay-design/agent-skills/sql-helper"><img src="https://agentmods.dev/badge/skills/bestdeejay-design/agent-skills/sql-helper.svg" alt="Measured on agentmods" height="20"></a>
Per session 149 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,029 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00149 $0.01029
Opus 5 $0.00075 $0.00515
Sonnet 5 $0.00030 $0.00206
Haiku 4.5 $0.00015 $0.00103

Measured 5d ago against content hash 2b06292c3690, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

sql-helper scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/sql_helper.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/sql-helper/SKILL.md · 70 lines

How it starts

The opening of the file, as written. The whole thing — 70 lines — stays where its author put it; the contents beside it link to each section on GitHub.

SQL Helper

Генерация SQL-запросов из текстового вопроса и DDL-схемы.

Загружай этот скилл когда нужно превратить вопрос на естественном языке в SQL: для быстрых запросов к базе, разбора плана выполнения или форматирования SQL.

🎯 When to use

Use this skill when:

  • Есть DDL-файл (CREATE TABLE) и вопрос, по которому нужен SQL-запрос
  • Нужно быстро собрать SELECT/JOIN/GROUP BY/COUNT по шаблону
  • Просят «сгенерируй sql», «напиши sql», «sql запрос», «sql helper»
  • Нужно посмотреть план выполнения запроса (EXPLAIN) в читаемом виде

Do NOT use when:

  • Нужна только проверка синтаксиса без схемы — достаточно обычного редактора
  • Нужна миграция или генерация DDL — это отдельный инструмент
  • Вопрос не про SQL (анализ данных, CSV, скрейпинг) — это другие скиллы

📦 Files

  • SKILL.md — этот файл
  • scripts/sql_helper.py — генератор SQL + EXPLAIN (Python 3 stdlib)
  • references/canonical-patterns.md — канонические аналоги text-to-SQL и разбор недостающих техник

Canonical analogues

Полный разбор — в references/canonical-patterns.md. Ключевые каноны, на которые опирается дизайн скилла:

  • Anthropic Cookbook capabilities/text_to_sql — эталон интроспекции схемы (sqlite_master + PRAGMA table_info) и execution-based валидации через promptfoo-ассерты.
  • sqlsure / sql-semantic-check — семантические правила FANOUT/JOIN_KEY/ADDITIVITY и интроспекция PK/FK вместо эвристик join.
  • Vanna.ai — контур train → retrieve (few-shot) → generate_sql → run_sql → verify.
  • Spider / BIRD / Spider 2.0 — методология оценки: exact match, execution accuracy, validity + efficiency; schema linking как первый этап.
  • sqlite-utils + SQLGlot — CLI-интроспекция (schema, analyze, memory) и квотинг идентификаторов (quote_identifiers).
  • grok-sqlite-explain — построение дерева EXPLAIN по ссылкам parent, а не по id.

🧰 Usage

# Сгенерировать SQL по вопросу:
python3 skills/sql-helper/scripts/sql_helper.py --ddl schema.sql --question "select users by id"

# С планом выполнения:
python3 skills/sql-helper/scripts/sql_helper.py --ddl schema.sql --question "count orders by user" --explain

# JOIN двух таблиц:
python3 skills/sql-helper/scripts/sql_helper.py --ddl schema.sql --question "join users and orders"

# С лимитом и сортировкой:
python3 skills/sql-helper/scripts/sql_helper.py --ddl schema.sql --question "top 5 orders by date desc"

Read the full file on GitHub · 70 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 70 lines · 149 tokens per session scan A 2b06292c3690

Subscribe to this mod's changes

sql-helper is a skill published in the GitHub repository bestdeejay-design/agent-skills (5 stars, last pushed today), licensed MIT. It adds 149 tokens to every session and 1,029 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.