sql-explainer

Explains SQL queries through layered walkthroughs for Snowflake, Oracle, and Databricks dialects.

Updated Apr 22, 2026
One-click install
npx skills add https://github.com/rpmcdougall/claude-skills --skill sql-explainer-rpmcdougall
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sql-explainer
Source: https://github.com/rpmcdougall/claude-skills/tree/main/skills/sql-explainer
Command: npx skills add https://github.com/rpmcdougall/claude-skills --skill sql-explainer-rpmcdougall

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Data engineers often inherit or write SQL queries they only partially understand, and generic explanations don't build lasting knowledge. This Skill turns any pasted query into a structured learning artifact that teaches how the database actually executes it, names the reusable patterns inside it, and flags silent bugs. ## Core Features & Use Cases - Four-layer explanation: Produces a TL;DR, logical execution order, line-by-line walkthrough, and a patterns & techniques section that names transferable concepts like gaps-and-islands, anti-joins, and latest-row-per-group. - Row trace, performance notes, and pitfalls: Invents representative sample rows to trace through each execution stage, calls out engine-specific performance concerns, and surfaces silent bugs such as NULL handling in NOT IN or fan-out joins masked by DISTINCT. - Dialect awareness: Defaults to Snowflake semantics but detects Oracle and Databricks syntax, with inline notes on cross-dialect differences like QUALIFY, LISTAGG, and FLATTEN. - Use Case: You paste a 200-line query with nested CTEs from a colleague and ask what it does. The Skill explains each CTE, identifies it as a gaps-and-islands pattern, traces sample rows, warns about a NULL-handling pitfall, and saves the tagged explanation to your local catalog directory for future grep-based reference. ## Quick Start Paste a SQL query and ask the assistant to explain what it does and walk through how it works.

Frequently Asked Questions about sql-explainer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I get a SQL query explained step by step?▼

Paste the query and ask for an explanation or walkthrough. The output follows a fixed structure: a one-sentence TL;DR, the logical execution order the engine actually uses, a line-by-line walkthrough, and a patterns section naming techniques like anti-joins or running totals.

What SQL dialects does query explanation support?▼

Explanations default to Snowflake semantics, with automatic detection of Oracle syntax (DUAL, CONNECT BY, NVL) and Databricks syntax (LATERAL VIEW, Delta features). Cross-dialect differences like QUALIFY or LISTAGG support are flagged inline when relevant.

Can I save SQL explanations to a local reference library?▼

Yes. On the first query of a session you choose a catalog directory, and each explanation is saved as a Markdown file named with the date and a kebab-case slug. Files include dialect, tags, and the original query so you can grep the catalog later by pattern name.

Does explaining a query also catch bugs in it?▼

The explanation describes the query as written, then flags real issues in a pitfalls section covering NULL handling, implicit casts, fan-out joins, and ordering assumptions. It does not silently fix bugs, and the section is omitted when nothing genuine applies.

When should I not use a query explainer?▼

Skip it for general SQL concept questions with no specific query, when you want a query written from scratch, or when optimization is the primary goal. Those are handled as direct answers or separate tasks rather than layered explanations.