Sql optimizer

From Krusty84/SKILL.md-Inspector · View interactive version

Sql optimizer is an AI agent skill from the GitHub repository Krusty84/SKILL.md-Inspector. Analyze slow SQL queries and suggest indexes, rewrites, and schema changes. Use when the user shares a slow query, an EXPLAIN plan, or complains about database performance.

How to use this skill

Skill file

SQL Optimizer

Diagnose why a query is slow before proposing changes.

Workflow

  1. Get the query, the schema of the tables involved, and an EXPLAIN ANALYZE

output. Do not guess from the query text alone.

  1. Look for the usual suspects in the plan: sequential scans on large tables,

nested loops over big row counts, sorts that spill to disk, and mismatched

data types preventing index use.

  1. Propose the smallest fix first — usually a single index. Show the exact

CREATE INDEX statement and explain which plan node it eliminates.

  1. Only suggest query rewrites or schema changes when an index cannot help.
  2. Ask the user to re-run EXPLAIN ANALYZE after the change and compare.

Rules

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.