SQL Database Query Analyzer skill for Claude and Codex
A performance diagnosis of one SQL query: the expected execution plan, where the time goes, which indexes would change it, and a rewrite path toward your…
Install it once and Claude or Codex runs it for you. When your request matches, your AI loads the skill, asks for anything it is missing, and works through the template itself. Prefer to fill it in by hand? See the full prompt template.
Download the skill (.zip) · View SKILL.md
When it is used
Use when a SQL query is slow and the developer or DBA needs to know where the time goes, what the plan looks like, and which index or rewrite fixes it. Do not use for writing a new query from a description, or schema design for a new application. Related topics: coding, sql.
What it will ask you for
- SQL query (longer free text)
- Database engine (choose one: MySQL, PostgreSQL, SQL Server, Oracle, SQLite)
- Explain level (choose one: Basic, Detailed, Full)
- Index recommendations (choose one: Yes, No)
- Target execution time (milliseconds) (number from 1 to 60000)
- Table sizes and existing indexes (longer free text)
How it works
- Give the engine-specific command to capture a real plan, then predict the plan from the query and the table sizes supplied.
- Identify the dominant operations: large scans with selective predicates, functions on indexed columns, implicit casts, OR conditions, unsupported sorts, correlated subqueries.
- When enabled, write each index recommendation as a CREATE INDEX statement with the column order justified and the write cost noted.
- Propose rewrites that change the plan, not the formatting, and show the before and after for each.
- State whether the target time is reachable and which single change moves the needle most.
What you get
Markdown with Summary, an Execution Plan table (step, access path, estimated rows, cost), Index Recommendations when enabled, and Performance Tips.
What it watches out for
- Recommending an index on every WHERE column separately when one composite index in the right order serves the query.
- Presenting a predicted plan as fact when the optimiser's choice depends on statistics the user never supplied.
- Suggesting a covering index on a write-heavy table without mentioning the cost on every insert and update.
How to install
Claude.ai and the Claude desktop app
- Download the skill .zip.
- Open Settings, then Capabilities, and find Skills.
- Choose Upload skill and select the .zip.
- Ask Claude for help with the task. It loads the skill when your request matches.
Claude Code
- Download the skill .zip.
- Unzip it into ~/.claude/skills/ (or .claude/skills/ inside a project).
- Start a new session. Claude Code loads the skill when your request matches.
Codex
- Download the skill .zip.
- Unzip it into ~/.agents/skills/ (or .agents/skills/ inside a project).
- Codex picks it up on its own. Type $ and the skill name to use it, or just ask for the task.
Cursor
- Download the Cursor rule (.mdc).
- Save it in .cursor/rules/ inside your project.
- Cursor's agent applies the rule when your request matches its description.
AGENTS.md (Codex, Cursor, and other coding agents)
- Copy the AGENTS.md section.
- Paste it into AGENTS.md at the root of your repository, creating the file if needed.
- Coding agents that read AGENTS.md follow it when your request fits.