SQL Query Optimization
Diagnose and speed up slow SQL — measuring with EXPLAIN (ANALYZE, BUFFERS), reading plans, fixing sargability, N+1 and pagination, join and CTE behaviour, statistics, batching and safe verification of improvements.
What it does
Diagnose and speed up slow SQL — measuring with EXPLAIN (ANALYZE, BUFFERS), reading plans, fixing sargability, N+1 and pagination, join and CTE behaviour, statistics, batching and safe verification of improvements.
- Category
- databasesqlperformance
- Platforms
- backend
- Frameworks and tools
- postgresqlmysqlpg-stat-statements
- Capabilities
- debuggingreviewcode-generation
Example tasks
- “Explain why this 4-second report query does a sequential scan and fix it.”
- “Replace OFFSET pagination on a 50M-row table with keyset pagination.”
- “Find the top slow queries from pg_stat_statements and propose fixes ranked by impact.”
Works with
Permissions summary
Files
Reads files only
Shell
No shell commands
Network
No network
Permissions are declared in the component manifest and compiled into each client's tool list. Components are built for least privilege.
Supported environments
| Client | Support | Installed as |
|---|---|---|
| Claude Code | Native | .claude/skills/<id>/SKILL.md |
| OpenAI Codex | Adapter | .codex/skills/<id>/SKILL.md |
| Cursor | Adapter | .cursor/rules/<id>.mdc |
| VS Code (Copilot) | Adapter | .github/instructions/<id>.instructions.md |
| Generic markdown | Adapter | docs/forgekit/skills/<id>.md |
Claude Code is the native reference. Other clients use adapters, so behaviour is close but not identical. See the compatibility matrix.
Included in packs
What is inside
This is a premium component, so its prompt is delivered only through signed downloads to licensed accounts. Here is the outline of its sections (65 lines in total).
- 01SQL Query Optimization
- 021. Workflow
- 032. Reading a plan
- 043. Common rewrites
- 054. N+1 and chatty access
- 065. CTEs, subqueries, joins
- 076. Table-level levers
- 087. Report format when proposing a fix
- 09Common mistakes
Version and changelog
Latest version 1.0.0. Requires DevBuildKit CLI 1.0.0 or newer.
Changelog — SQL Query Optimization
1.0.0
- Initial release.