SQL Query Optimizer

Installation
SKILL.md

SQL Query Optimizer

What this skill does

This skill directs the agent to analyze a SQL query for common performance anti-patterns and rewrite it to execute more efficiently. It checks indexes, join strategies, subquery usage, N+1 patterns, unnecessary full table scans, and more — then provides a side-by-side comparison of the original and optimized query with a plain-English explanation of each change.

Use this when a query is running slowly in production, when you're writing a complex query for the first time and want a second opinion, or when you're reviewing a pull request that touches database queries.

How to use

Claude Code / Cursor / Codex

Copy this file to .agents/skills/sql-query-optimizer/SKILL.md in your project root (for Claude Code), or add the instructions below to your .cursorrules (for Cursor).

Then ask:

  • "Optimize this query using the SQL Query Optimizer skill."
  • "This query takes 3 seconds on 500k rows. Use the SQL Query Optimizer skill to improve it."
Installs
GitHub Stars
8
First Seen
SQL Query Optimizer — notysoty/openagentskills