sql-query-explainer
Installation
SKILL.md
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 ANALYZEoutput and rough table sizes — turns generic advice into advice about your query plan.
Modes
Detect which mode the user needs based on their request:
- Explain — Translate existing SQL into plain English
- Optimise — Review SQL for performance issues and suggest improvements
- Write — Generate SQL from a natural language description
- Document — Produce a data dictionary or query documentation