/sql-query-optimizer:sql-query-optimizationfrom sql-query-optimizer
Diagnoses and rewrites slow SQL on Postgres, MySQL, SQL Server, SQLite, and Oracle using EXPLAIN ANALYZE. Covers indexing strategy, WHERE clause selectivity, JOIN vs subquery vs CTE tradeoffs, and keyset pagination.
Ships in sql-query-optimizer. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Diagnoses, profiles, and optimizes slow SQL queries across traditional relational engines (PostgreSQL, MySQL, SQL Server, SQLite, Oracle) under the rule: start from the execution plan, never from intuition. Analyzes EXPLAIN ANALYZE plans, designs selective composite indexes, rewrites non-sargable predicates and deep OFFSET pagination, and enforces concise artifact caps and fail-honest plan reporting.
EXPLAIN (ANALYZE, BUFFERS) (Postgres) or EXPLAIN ANALYZE (MySQL/SQL Server) execution trees.OFFSET to keyset pagination.bigquery-query-optimization.database-migration-expert.performance-scalability.EXPLAIN (ANALYZE, BUFFERS, VERBOSE) <query>; (or read-only EXPLAIN for mutating statements wrapped in BEGIN; ... ROLLBACK;).STATIC_ANALYSIS_ONLY / BLOCKED): If DB EXPLAIN fails due to missing credentials or an unreachable database, explicitly mark the output STATIC_ANALYSIS_ONLY / BLOCKED: Live plan not executed — <exact error> and NEVER invent row counts, buffer reads, or EXPLAIN ANALYZE latencies.Seq Scan nodes, massive estimated-vs-actual row skew (run ANALYZE <table>; if stale), and disk-spilling external sorts/hashes.WHERE, JOIN ... ON, and ORDER BY columns ordered equality predicates first, then range/sort columns; avoid over-indexing write-heavy tables.WHERE created_at >= '2026-09-01' AND created_at < '2026-09-02' instead of WHERE DATE(created_at) = '2026-09-01').OFFSET 50000 with WHERE id > :last_seen_id ORDER BY id ASC LIMIT 20; convert correlated subqueries into explicit JOINs; replace SELECT * to enable Index-Only Scans.PLAN.md (<= 50 lines); skip docs/<feature-name>/execution-plan.md (<= 50 lines) for inline single-query rewrites; cap docs/<feature-name>/optimization-report.md at <= 55 lines (Zero-Fluff before/after metrics table + Original / Optimized / Engine-Grounded Reasoning).AGENTS.md (<= 90 lines) and persist index baselines to context/memory/MEMORY.md.# PostgreSQL execution plan with buffer metrics
psql -d mydb -c "EXPLAIN (ANALYZE, BUFFERS) SELECT id, email FROM users WHERE created_at >= '2026-01-01' LIMIT 50;"
# MySQL execution plan
mysql -u root -p -e "EXPLAIN ANALYZE SELECT id, email FROM users WHERE status = 'active';"
psql/mysql via shell (Bash in Claude Code; Bash in Antigravity) or explicitly label STATIC_ANALYSIS_ONLY / BLOCKED if DB access is unavailable.EXPLAIN ANALYZE execution latencies or buffer counts when no live database ran.LOWER(...) / DATE(...) without expression indexes.LIMIT/OFFSET pagination or creating execution-plan.md bloat for single-query rewrites.EXPLAIN ANALYZE plan verified before/after, OR report explicitly marked STATIC_ANALYSIS_ONLY / BLOCKED: Live plan not executed — <exact error>.WHERE predicates and deep OFFSET replaced by keyset filters.optimization-report.md (<= 55 lines) includes before/after table + Original / Optimized / Engine-Grounded Reasoning.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub jggomez/expert-ai-developer-skills --plugin sql-query-optimizer4 skills in this plugin
/bigquery-query-optimizationDiagnoses and rewrites slow BigQuery SQL using the query plan (stages, shuffle, workers) — partitioning/clustering pruning, JOIN ordering and broadcast vs. shuffle joins, skewed JOINs, WHERE clause selectivity, and approximate/SQL-vs-JS function choices. Use when a BigQuery query is slow, expensive, or hitting Resources Exceeded, or when reviewing a query plan./context-captureUse when finishing a task at State 5 (Ship & Finish) or when the user explicitly asks to "save context", "guarda contexto", "record decisions", or "hand off" — writes ultra-compact persistent memory to context/memory/ and ensures target-project root AGENTS.md (<= 90 lines) stays wired to DESIGN.md and MEMORY.md across Claude Code and Google Antigravity./context-restoreUse at session start (State 0) or when asked to "load context", "catch up", or "what was done before" — prioritizes LLM Wiki Progressive Disclosure (context/memory/MEMORY.md) across Claude Code and Google Antigravity while supporting user-confirmed restore for scripted sessions (context/sessions/).Other plugins' skills for the same job