Agent skill

SQL Query Explainer

by mohitagw15856 in mohitagw15856/pm-claude-skills

Explains, optimises, writes, and documents SQL queries. An agent skill from mohitagw15856/pm-claude-skills.

MITAuto-check passedDatabases

Install SQL Query Explainer

skills CLI
$ npx skills add mohitagw15856/pm-claude-skills --skill sql-query-explainer -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install mohitagw15856/pm-claude-skills sql-query-explainer --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/mohitagw15856/pm-claude-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/sql-query-explainer .claude/skills/sql-query-explainer && rm -rf skills-src

Use ~/.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/

Facts

Skill name
sql-query-explainer
GitHub stars
1.4k
Token cost
~1.6k tokens
SKILL.md length
711 words
Files
1
Skills in repo
1,334
Repo updated
First seen
Licence
MIT

At a glance

Explains, optimises, writes, and documents SQL queries. An agent skill from mohitagw15856/pm-claude-skills.

  • Works in 4 steps: Explain — Translate existing SQL into… → Optimise — Review SQL for performance… → Write — Generate SQL from a natural… → …
  • Asked to explain a SQL query
  • SKILL.md covers Required Inputs, Modes, Mode 1: Explain and Mode 2: Optimise, plus 6 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

SQL Query Explainer is an agent skill from mohitagw15856/pm-claude-skills. Explains, optimises, writes, and documents SQL queries. Use when asked to explain a SQL query, optimise slow SQL, translate SQL to plain English for non-technical stakeholders, write a query from a natural language description, or produce query documentation. Produces plain-English explanations, annotated optimised queries, or a data dictionary covering output shape, assumptions, and known limitations. Works across PostgreSQL, MySQL, BigQuery, Snowflake, and standard SQL.

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Databases, covering SQL, Data warehousing and Plain language and style rules. It works with SQL, Google BigQuery, MySQL and PostgreSQL. The repository describes itself as: 1255 professional Agent Skills for Claude, ChatGPT, Gemini, Cursor & Codex — PRDs, postmortems, leases, medical bills, layoffs, go-bags, new countries. Plain markdown, MIT, in… The licence is MIT.

When your agent uses it

  • Asked to explain a SQL query
  • Optimise slow SQL
  • Translate SQL to plain English for non-technical stakeholders
  • Write a query from a natural language description

Example prompts

  • “/sql-query-explainer”

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Explain — Translate existing SQL into plain English
  2. Optimise — Review SQL for performance issues and suggest improvements
  3. Write — Generate SQL from a natural language description
  4. Document — Produce a data dictionary or query documentation

What it can do on your machine

Read from SKILL.md and the folder at commit 1cbf1f0. It shows what the files ask for, not the result of running them.

  • Tool permissions

    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.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are sql).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

SQL Query Explainer loads about 1.6k tokens when it runs. Until then it costs about 124 tokens; SKILL.md has 711 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~124
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k

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.

Safety

Auto-check passed

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); files beside SKILL.md are not scanned.

SKILL.md

The full file from mohitagw15856/pm-claude-skills at commit 1cbf1f0, republished under its MIT licence (© mohitagw15856). 711 words, ~1,586 tokens.

Download SKILL.mdSave it as .claude/skills/sql-query-explainer/SKILL.md (or your agent's skills folder).
name
sql-query-explainer
description
Explains, optimises, writes, and documents SQL queries. Use when asked to explain a SQL query, optimise slow SQL, translate SQL to plain English for non-technical stakeholders, write a query from a natural language description, or produce query documentation. Produces plain-English explanations, annotated optimised queries, or a data dictionary covering output shape, assumptions, and known limitations. Works across PostgreSQL, MySQL, BigQuery, Snowflake, and standard SQL.

SQL Query Explainer Skill

This skill explains SQL queries in plain language, identifies optimisation opportunities, and helps communicate data logic to non-technical stakeholders. It also writes and documents new queries from natural language descriptions.

Required Inputs

  • The SQL (Explain/Optimise/Document modes) — the actual query, ideally with the dialect named (Postgres, BigQuery, Snowflake, MySQL…); dialect changes both semantics and the optimisation advice.
  • The intent in plain words (Write mode) — what question the data should answer, plus table/column names if known. Without a schema, assumptions get stated, never silently invented.
  • Optional but transformative: EXPLAIN/EXPLAIN ANALYZE output and rough table sizes — turns generic advice into advice about your query plan.

Modes

Detect which mode the user needs based on their request:

  1. Explain — Translate existing SQL into plain English
  2. Optimise — Review SQL for performance issues and suggest improvements
  3. Write — Generate SQL from a natural language description
  4. Document — Produce a data dictionary or query documentation

Mode 1: Explain

When given a SQL query, produce:

Plain English Summary

[1–3 sentences. What does this query do? What data does it return? Write as if explaining to a business analyst, not a developer.]

Step-by-Step Walkthrough

Break the query into logical sections. For each section:

  • Quote the SQL clause
  • Explain what it does in plain English
  • Flag any complexity (e.g. window functions, subqueries, CTEs)
What the Result Looks Like

[Describe the shape of the output: "Returns one row per user, with columns for X, Y, Z. Ordered by [field] descending."]

Potential Issues to Flag
  • [Gotchas, edge cases, or implicit assumptions in this query]
  • [e.g. "This will include NULLs in the user_id column if the LEFT JOIN finds no match"]

Mode 2: Optimise

When asked to optimise a query, produce:

Performance Assessment

Rate overall: 🟢 Well-optimised / 🟡 Some improvements possible / 🔴 Significant issues

Issues Found

For each issue:

Issue [N]: [Short name, e.g. "Missing index on join column"]

  • What it is: [Plain explanation]
  • Why it matters: [Performance impact — e.g. "Full table scan on a 10M row table"]
  • Fix:
sql
-- Before
[original snippet]

-- After
[improved snippet]
  • Expected improvement: [Estimate if possible]
Optimisation Checklist
  • SELECT * used? (Replace with specific columns)
  • Implicit type conversions on JOIN/WHERE columns?
  • Missing indexes on JOIN or WHERE columns?
  • N+1 patterns (queries inside loops)?
  • DISTINCT used where GROUP BY would be faster?
  • Window functions used where a subquery would be clearer/faster?
  • CTEs re-used or materialised unnecessarily?
  • Large IN() lists that could use a JOIN instead?

Mode 3: Write

When given a natural language description, generate the SQL query and then explain it using Mode 1.

Ask the user to confirm:

  • Database/dialect (PostgreSQL / MySQL / BigQuery / Snowflake / SQLite / Standard SQL)
  • Table and column names (if known; otherwise use descriptive placeholder names like users, orders, user_id)
  • Any filters, sorting, or aggregation requirements

Produce:

  1. The SQL query with inline comments
  2. Plain English explanation (Mode 1 format)

Show full SKILL.md (252 more words)Show less

Mode 4: Document

When asked to create documentation for a query or table:

Query Documentation
Query: [Name]
Purpose: [One sentence — what business question this answers]
Author: [If provided]
Last reviewed: [If provided]

Inputs:
  - Table: [table_name] — [what it contains]
  - Filter: [any WHERE conditions and their business meaning]

Output columns:
  | Column | Type | Description |
  |--------|------|-------------|
  | [name] | [type] | [plain English description] |

Assumptions:
  - [Any implicit assumptions the query makes]

Known limitations:
  - [Edge cases not handled, data quality dependencies, etc.]

Output Format

Every mode returns the same disciplined shape:

  1. The one-line summary — what this query does, in business language ("monthly revenue per region, excluding refunds"), before any SQL talk.
  2. The walkthrough or the artifact — mode-dependent: annotated clause-by-clause explanation (Explain), the rewritten query with a diff of what changed and why (Optimise), the new query with stated assumptions (Write), or the doc block (Document).
  3. The gotchas — NULL behaviour, join fan-out, timezone traps, and index implications that apply to this query, not generic advice.
  4. Verification — a small SELECT the user can run to confirm the query does what the summary claims (row counts before/after, a spot-check predicate).

Quality Checks

  • Plain English explanation avoids SQL jargon
  • Optimisation suggestions include before/after SQL
  • Written queries include inline comments
  • Output shape is described (columns, row grain, ordering)
  • Dialect-specific syntax is flagged when non-standard

Anti-Patterns

  • Restating the SQL in pseudo-code instead of explaining what it does and returns
  • Optimisation advice with no before/after query, or no reason the new one is faster
  • Ignoring the dialect (writing Postgres-only syntax for a MySQL user)
  • "Looks fine" with no read on correctness, performance, or row grain
  • Rewriting the query from scratch instead of explaining/optimising the user's

Example Trigger Phrases

  • "Explain this SQL query: [paste query]"
  • "Optimise this slow query: [paste query]"
  • "Write a SQL query that [natural language description]"
  • "Document this query for my non-technical stakeholders"
  • "Why is this query returning unexpected results?"

© mohitagw15856, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/sql-query-explainer of mohitagw15856/pm-claude-skills.

Open the folder on GitHubat commit 1cbf1f0

Compare with similar skills

SQL Query Explainer 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.

SQL Query Explainer compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
SQL Query Explainer this skillmohitagw15856/pm-claude-skills1.4k—~1.6kAutomated safety check: PassMIT
SQL Queriesw95/awesome-claude-corporate-skills2353 repos~2.8kAutomated safety check: PassMIT
SQL Sentinelsickn33/agentic-awesome-skills47k1 repos~1.5kAutomated safety check: PassMIT
SQL Queriesphuryn/pm-skills27k—~907Automated safety check: PassMIT
SQL Querieskillvxk/pm-skills-zh167—~423Automated safety check: PassMIT
Chdb SQLvemetric/vemetric3941 repos~1.2kAutomated safety check: PassApache-2.0

Similar skills

  • SQL Queries

    w95/awesome-claude-corporate-skills

    Write correct, performant SQL across all major data warehouse dialects (Snowflake, BigQuery, Databricks, PostgreSQL, etc.).

    235 GitHub starsUsed in 3 repos~2.8k tokens
    DatabasesAuto-check passed
  • SQL Sentinel

    sickn33/agentic-awesome-skills

    Audit SQL for the cost & performance anti-patterns that burn warehouse credits.

    47k GitHub starsUsed in 1 repo~1.5k tokens
    DatabasesAuto-check passed
  • SQL Queries

    phuryn/pm-skills

    Generate SQL queries from natural language descriptions. An agent skill from phuryn/pm-skills.

    27k GitHub stars~907 tokensUpdated 22 days ago
    DatabasesAuto-check passed
  • SQL Queries

    killvxk/pm-skills-zh

    将自然语言描述转化为 SQL 查询语句。支持 BigQuery、PostgreSQL、MySQL 及其他方言。可从上传的结构图或文档中读取数据库结构。适用于编写 SQL、构建数据报表、探查数据库,或将业务问题转化为查询语句。

    167 GitHub stars~423 tokensUpdated 6 mo ago
    DatabasesAuto-check passed
  • Chdb SQL

    vemetric/vemetric

    A skill your agent uses when the user wants to run SQL — especially analytical SQL — on local files (parquet/csv/json), URLs, S3 paths, or remote databases (Postgres, MySQL, MongoDB, ClickHouse…

    394 GitHub starsUsed in 1 repo~1.2k tokens
    DatabasesAuto-check passed
  • Semantic Analyst

    sidequery/sidemantic

    Answer analytical, KPI, metric, trend, cohort, and business-performance questions through a Sidemantic semantic layer.

    129 GitHub stars~982 tokensUpdated today
    DatabasesAuto-check passed

More from mohitagw15856/pm-claude-skills

All 1,334 skills in this repo
  • Car Tco

    mohitagw15856/pm-claude-skills

    Compare the total cost of car ownership across buy-new, buy-used, lease, and keep-your-current-car — depreciation, insurance, maintenance ramp, and fuel over a real horizon, not just the monthly…

    1.4k GitHub stars~1.1k tokensUpdated yesterday
    Auto-check passed
  • Exit Waterfall

    mohitagw15856/pm-claude-skills

    Compute who gets what at each exit price from a cap table — liquidation preferences, conversion points, and where the founders' share collapses.

    1.4k GitHub stars~1.1k tokensUpdated yesterday
    Auto-check passed
  • Feature Prioritisation

    mohitagw15856/pm-claude-skills

    Apply prioritisation frameworks (RICE, MoSCoW, Kano, ICE, Opportunity Scoring) to rank features and backlog items.

    1.4k GitHub stars~2k tokensUpdated yesterday
    Auto-check passed
  • Fire Number

    mohitagw15856/pm-claude-skills

    Compute a financial-independence (FIRE) target and years-to-reach with every assumption labeled as an assumption — plus a sensitivity table instead of a single false-precision answer.

    1.4k GitHub stars~1.1k tokensUpdated yesterday
    Auto-check passed
  • Freelance Rate

    mohitagw15856/pm-claude-skills

    Derive a freelance day/hourly rate backwards from target income, honest billable utilization, overhead, and the self-employment tax premium — the arithmetic that proves a rate is not salary÷2000.

    1.4k GitHub stars~1.2k tokensUpdated yesterday
    Auto-check passed
  • Offer Comparison

    mohitagw15856/pm-claude-skills

    Compare two or more job offers as total-comp curves over four years — vesting cliffs, bonuses, 401(k) match, and the crossover year computed, not vibed.

    1.4k GitHub stars~1.1k tokensUpdated yesterday
    Auto-check passed

Categories

Questions about SQL Query Explainer

What does SQL Query Explainer do?

Explains, optimises, writes, and documents SQL queries. An agent skill from mohitagw15856/pm-claude-skills. SQL Query Explainer is an agent skill from mohitagw15856/pm-claude-skills. Explains, optimises, writes, and documents SQL queries.

When should I use SQL Query Explainer?

SQL Query Explainer fits situations like: asked to explain a SQL query; optimise slow SQL; translate SQL to plain English for non-technical stakeholders; write a query from a natural language description.

How do I install SQL Query Explainer in Claude Code?

Run `npx skills add mohitagw15856/pm-claude-skills --skill sql-query-explainer -a claude-code`. Or copy the skill folder (skills/sql-query-explainer in mohitagw15856/pm-claude-skills) into .claude/skills/sql-query-explainer in your project. Claude Code loads it when a task matches its description.

How do I install SQL Query Explainer in Codex?

Run `npx skills add mohitagw15856/pm-claude-skills --skill sql-query-explainer -a codex`. Or copy the skill folder (skills/sql-query-explainer in mohitagw15856/pm-claude-skills) into .agents/skills/sql-query-explainer in your project. Codex loads it when a task matches its description.

Can I use SQL Query Explainer in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add mohitagw15856/pm-claude-skills --skill sql-query-explainer -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-query-explainer, .gemini/skills/sql-query-explainer, .github/skills/sql-query-explainer and .opencode/skills/sql-query-explainer in your project.

What does SQL Query Explainer need to run?

SKILL.md names no scripts, command-line tools or credentials: SQL Query Explainer is instructions for the agent only.

Does SQL Query Explainer access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is SQL Query Explainer safe to install?

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. Review the folder before installing.

What licence does SQL Query Explainer use?

SQL Query Explainer is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does SQL Query Explainer use?

About 1.6k tokens (SKILL.md is roughly 6.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to SQL Query Explainer?

Skills that share tags, products or a category with SQL Query Explainer: SQL Queries (w95/awesome-claude-corporate-skills, 235 stars), SQL Sentinel (sickn33/agentic-awesome-skills, 47k stars), SQL Queries (phuryn/pm-skills, 27k stars) and SQL Queries (killvxk/pm-skills-zh, 167 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains SQL Query Explainer?

mohitagw15856 (a GitHub user) maintains it in mohitagw15856/pm-claude-skills, which has 1,429 GitHub stars. The repository holds 1,334 skills in this directory. The repository was last updated on October 6, 2026.

Source: mohitagw15856/pm-claude-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.