Install any skill in seconds. Free to start, no credit card required.
Get Started Free →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.
.claude/skills/mohitagw15856-sql-query-explainer/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 34% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 52% | 0% |
| case-17 | ✗→✓ | ▲ Improved | 38% | 0% |
| case-22 | ✗→✓ | ▲ Improved | 46% | 0% |
| case-03 | ✓→✗ | ▼ Worse | 47% | 0% |
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.
EXPLAIN/EXPLAIN ANALYZE output and rough table sizes — turns generic advice into advice about your query plan.Detect which mode the user needs based on their request:
When given a SQL query, produce:
1–3 sentences. What does this query do? What data does it return? Write as if explaining to a business analyst, not a developer.]
Break the query into logical sections. For each section:
Describe the shape of the output: "Returns one row per user, with columns for X, Y, Z. Ordered by field] descending."]
When asked to optimise a query, produce:
Rate overall: 🟢 Well-optimised / 🟡 Some improvements possible / 🔴 Significant issues
For each issue:
Issue N]: Short name, e.g. "Missing index on join column"]
sql-- Before [original snippet] -- After [improved snippet]
When given a natural language description, generate the SQL query and then explain it using Mode 1.
Ask the user to confirm:
users, orders, user_id)Produce:
When asked to create documentation for a query or table:
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.]Every mode returns the same disciplined shape:
SELECT the user can run to confirm the query does what the summary claims (row counts before/after, a spot-check predicate).| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 25,713 | 24,726 | -4% | 1 | 1 | 0% | 4,025 | 5,383 | +34% | 0 | 0 | — |
case-02 | fail→pass | 21,504 | 21,726 | +1% | 1 | 1 | 0% | 2,660 | 4,053 | +52% | 0 | 0 | — |
case-03 | pass→fail | 13,698 | 20,014 | +46% | 1 | 1 | 0% | 2,924 | 4,306 | +47% | 0 | 0 | — |
case-04 | pass→pass | 12,771 | 13,146 | +3% | 1 | 1 | 0% | 1,641 | 3,883 | +137% | 0 | 0 | — |
case-05 | pass→fail | 21,951 | 20,459 | -7% | 1 | 1 | 0% | 2,695 | 4,101 | +52% | 0 | 0 | — |
case-06 | pass→pass | 19,697 | 12,355 | -37% | 1 | 1 | 0% | 3,042 | 3,740 | +23% | 0 | 0 | — |
case-07 | pass→pass | 18,576 | 10,925 | -41% | 1 | 1 | 0% | 2,711 | 3,675 | +36% | 0 | 0 | — |
case-08 | pass→pass | 20,845 | 19,835 | -5% | 1 | 1 | 0% | 2,898 | 3,582 | +24% | 0 | 0 | — |
case-09 | pass→pass | 23,029 | 19,840 | -14% | 1 | 1 | 0% | 2,707 | 3,957 | +46% | 0 | 0 | — |
case-10 | pass→pass | 15,462 | 18,890 | +22% | 1 | 1 | 0% | 2,883 | 4,019 | +39% | 0 | 0 | — |
case-11 | fail→fail | 22,276 | 19,740 | -11% | 1 | 1 | 0% | 3,197 | 4,166 | +30% | 0 | 0 | — |
case-12 | pass→pass | 25,171 | 19,106 | -24% | 1 | 1 | 0% | 2,822 | 4,033 | +43% | 0 | 0 | — |
case-13 | fail→fail | 22,558 | 20,297 | -10% | 1 | 1 | 0% | 3,141 | 4,338 | +38% | 0 | 0 | — |
case-14 | fail→fail | 17,527 | 23,802 | +36% | 1 | 1 | 0% | 3,058 | 5,043 | +65% | 0 | 0 | — |
case-15 | pass→pass | 21,912 | 15,917 | -27% | 1 | 1 | 0% | 3,218 | 4,473 | +39% | 0 | 0 | — |
case-16 | pass→pass | 24,149 | 22,027 | -9% | 1 | 1 | 0% | 3,053 | 5,986 | +96% | 0 | 0 | — |
case-17 | fail→pass | 14,774 | 14,686 | -1% | 1 | 1 | 0% | 2,806 | 3,864 | +38% | 0 | 0 | — |
case-18 | pass→pass | 19,369 | 18,540 | -4% | 1 | 1 | 0% | 2,518 | 3,460 | +37% | 0 | 0 | — |
case-19 | pass→pass | 17,549 | 17,656 | +1% | 1 | 1 | 0% | 3,069 | 3,797 | +24% | 0 | 0 | — |
case-20 | pass→pass | 22,968 | 23,853 | +4% | 1 | 1 | 0% | 3,322 | 4,648 | +40% | 0 | 0 | — |
case-21 | pass→pass | 11,621 | 10,051 | -14% | 1 | 1 | 0% | 2,098 | 3,298 | +57% | 0 | 0 | — |
case-22 | fail→pass | 12,308 | 10,983 | -11% | 1 | 1 | 0% | 2,315 | 3,384 | +46% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +9 percentage points is the difference between those two pass rates over the 22 comparable cases. 3 cases got worse with the skill loaded, and they are included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.