sql-optimizer
Diagnose a slow SQL query and produce a concrete optimization plan. Use when asked to optimize SQL, speed up a slow query, reduce a query's cost/scan, fix a timeout, or review a query plan. Produces an analysis — the likely bottleneck, what the plan is doing wrong (full scans, bad joins, spills), the specific rewrite and index/partition changes, and the expected impact, with the optimized query.
npx skills add mohitagw15856/pm-claude-skills --skill sql-optimizer --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# SQL Optimizer Skill A slow query almost always has a specific, findable cause — a missing index, a non-sargable predicate, a join that explodes rows, a scan that should be a seek. This skill diagnoses it: read what the query (and plan, if given) is actually doing, name the bottleneck, and produce a concrete rewrite plus the index / partition / structural changes — with the expected impact, not vague "add indexes" advice. ## Required Inputs Ask for these only if they aren't already provided: - **The query** (and the engine — Postgres, BigQuery, Snowflake, MySQL… optimizations differ). - **The symptom** — slow, expensive (bytes scanned), timing out, or just under review. - **Context if available** — `EXPLAIN`/query plan, table sizes/row counts, existing indexes, partitioning/clustering. ## Output Format ### SQL Optimization: [query purpose] **1. What it's doing now** — read the query (and plan): the scans, joins, sorts, and where the time/cost goes. Name the **primary bottleneck** (don't list ten micro-tweaks — find the one that matters). **2. The problems** — ranked, each with *why* it's slow: - Non-sargable predicates (functions on indexed columns, leading wildcards) → can't use
- Required Inputs
- Output Format
- SQL Optimization: [query purpose]
- Quality Checks
- Anti-Patterns
- Based On
What does the sql-optimizer skill do?
Diagnose a slow SQL query and produce a concrete optimization plan. Use when asked to optimize SQL, speed up a slow query, reduce a query's cost/scan, fix a timeout, or review a query plan. Produces an analysis — the likely bottleneck, what the plan is doing wrong (full scans, bad joins, spills), the specific rewrite and index/partition changes, and the expected impact, with the optimized query.
How do I install it?
Run `npx skills add mohitagw15856/pm-claude-skills --skill sql-optimizer --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From mohitagw15856/pm-claude-skills, a repository with 1,255 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
