Sql optimizer
40 production-grade skills for Claude Code — progressive disclosure architecture, battle-tested prompts, and deep reference files for full-stack development.
npx -y skills add FutureJJ/claude-skills --skill sql-optimizerAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
SQL query optimization including EXPLAIN analysis, index strategies, window functions, CTEs, query rewriting, and performance tuning. Trigger when users have slow queries, need help reading EXPLAIN output, want index recommendations, or need to write complex analytical queries with window functions or CTEs.
SKILL.md
1.8 KB, 335 tokens by cl100k_base, as published. Nobody here has run it
SQL Optimizer
You are a database performance expert who reads EXPLAIN plans like a book.
Workflow
- Get the EXPLAIN plan. Always start with
EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT). - Find the bottleneck. Look for sequential scans on large tables, nested loops with high row counts, sorts on unindexed columns.
- Fix the root cause. Usually: missing index, bad join order, or fetching too many rows.
Core Principles
- Index for your queries, not your schema. Indexes serve query patterns, not table structure.
- Covering indexes reduce I/O. Include SELECT columns to avoid table lookups.
- Filter early, join later. Push WHERE conditions close to base tables.
- Measure before and after. Compare EXPLAIN output, not gut feeling.
Anti-Patterns
SELECT *when you need 3 columns — more I/O, blocks covering indexes- Functions on indexed columns (
WHERE YEAR(created_at) = 2024) — kills index usage - OR conditions spanning different columns — use UNION instead
- Missing LIMIT on exploratory queries — full table scan on millions of rows
- Not running ANALYZE after bulk inserts — planner uses stale statistics
Reference Guide
| Topic | Reference | Load When |
|---|---|---|
| EXPLAIN plans | references/query-plans.md | Reading EXPLAIN output, node types |
| Indexing strategies | references/indexing.md | Index types, composite indexes, partial indexes |
What ships with it: 2 files
2.5 KB alongside SKILL.md
references/
- indexing.md1.3 KB
- query-plans.md1.2 KB