sql-explain

sql-explain is a skill for Claude Code from Goldziher/ai-rulez. It costs 39 tokens per session (143 once invoked), scanned A, original, MIT.

A PostgreSQL query-plan reader that explains an EXPLAIN ANALYZE result and identifies the slowest step. It compares estimated and actual rows and checks for costly scans.

In plain words
What is it for?
Use it after pasting a PostgreSQL query plan to find the slowest node, compare row estimates with reality, and get a suggested ANALYZE command or index definition.
Why use it?
It helps turn a detailed database performance report into a short explanation of what is slow and why. It can also point out likely stale statistics or a possible missing index without changing the database.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

Good fit Use it after pasting a PostgreSQL query plan to find the slowest node, compare row estimates with reality, and get a suggested ANALYZE command or index definition.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/goldziher/ai-rulez/sql-explain
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.

Any agent
npx skills add Goldziher/ai-rulez --skill sql-explain
Clone the repo
git clone --depth 1 https://github.com/Goldziher/ai-rulez

Made for: Claude Code.

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-explain

README.md
[![agentmods](https://agentmods.dev/badge/skills/goldziher/ai-rulez/sql-explain/github.svg)](https://agentmods.dev/skills/goldziher/ai-rulez/sql-explain)
Your own site
<a href="https://agentmods.dev/skills/goldziher/ai-rulez/sql-explain"><img src="https://agentmods.dev/badge/skills/goldziher/ai-rulez/sql-explain/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for sql-explain

Your own site · 80×15
<a href="https://agentmods.dev/skills/goldziher/ai-rulez/sql-explain"><img src="https://agentmods.dev/badge/skills/goldziher/ai-rulez/sql-explain.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 39 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 143 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00039 $0.00143
Opus 5.5 $0.00016 $0.00057
Sonnet 5.5 $0.00008 $0.00029
Haiku 4.5 $0.00004 $0.00014

Measured today against content hash 2f6d24e95d80, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

sql-explain 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 today.

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.

bench/judge/corpus/units/clean-03/.claude/skills/sql-explain/SKILL.md · 12 lines

What it actually says

SQL explain

  1. Identify the node with the highest actual time and its row estimate versus actual rows.
  2. If the estimate is off by more than 10x, say that statistics are likely stale and suggest ANALYZE <table>.
  3. If a sequential scan filters most rows away, suggest one index and show the CREATE INDEX statement without running it.
  4. Finish with a three-line summary: slowest node, cause, suggested change.
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. today First seen · 12 lines · 39 tokens per session scan A 2f6d24e95d80

Subscribe to this mod's changes

sql-explain is a skill published in the GitHub repository Goldziher/ai-rulez (163 stars, last pushed yesterday), licensed MIT. It adds 39 tokens to every session and 143 once invoked, about $0.0002 per session on Opus 5.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-10-17.

Related

Other skills, from other repositories

dsql

Build with Aurora DSQL — manage schemas, execute queries, handle migrations, diagnose query plans, diagnose cluster performance, load data, and develop applications with a serverless, distributed SQL database. Covers IAM auth, multi-tenant patterns, MySQL-to-DSQL and PostgreSQL-to-DSQL schema conversion, foreign key…

awslabs/agent-plugins · 246 tokens

sql-optimizer

Analyzes SQL queries for missing indexes, N+1 patterns, suboptimal joins, and full table scans. Interprets EXPLAIN, detects anti-patterns, rewrites queries. Triggers on: "optimize this query", "slow query", "add indexes", "explain plan", "N+1 query", "why is this query slow".

Mathews-Tom/armory · 78 tokens

profiling-slow-api-endpoints

Profiles slow PostHog API endpoints when the main cost is in Postgres or Python. Use when a screen, picker, or list is slow; a Django endpoint has high tail latency; a query plan changes with tenant size; or a proposed database fix needs production evidence. Covers APM traces, safe production EXPLAIN, representative…

PostHog/posthog · 113 tokens

postgresdb

Use when PostgreSQL engine behaviour decides the answer — schema and type design, index choice, reading EXPLAIN on a slow query, zero-downtime DDL and backfills, or ops (roles, RLS, pooling, vacuum, partitioning, PITR). PG16, ORM-agnostic. NOT portable query logic (that is sql), NOT a managed provider's platform…

ericrisco/rsc-harness · 91 tokens

neon

Use when you have picked Neon (serverless Postgres) and need to connect correctly from a serverless or edge runtime, wire database branching into dev, preview and CI, or stop being burned by scale-to-zero cold starts and pooler limits — including choosing HTTP versus WebSocket connections and pooled versus direct…

ericrisco/rsc-harness · 93 tokens

mesh-memory

Self-hosted semantic memory for AI agents via MCP. Save worklogs, decisions, and notes, then recall them across sessions by meaning, not keyword. Postgres + pgvector with auto-tagging.

skillmds/skillmd · 44 tokens