sql-optimization Skill for Claude: Tune Slow SQL Across Databases
sql-optimization makes Claude tune slow SQL queries and indexes, with examples for MySQL, PostgreSQL, SQL Server and Oracle.
- Installs
- 15.9K
- on skills.sh
- Stars
- 40.7K
- on GitHub
- Updated
- Oct 2026
- last repo commit
sql-optimization is a reference skill from GitHub's awesome-copilot collection. It tells Claude to tune the SQL you point at, or the whole project if nothing is selected, using general techniques that apply across MySQL, PostgreSQL, SQL Server and Oracle.
The SKILL.md is mostly bad-versus-good SQL pairs. It covers JOIN and subquery rewrites, index design, pagination, aggregation, batching and temporary tables, plus slow-query monitoring queries for three databases and a six-step method: identify, analyze, optimize, test, monitor, iterate.
It bundles no scripts and does not connect to a database. Claude suggests changes, and you run them. The skill itself says to test optimizations with realistic data volumes.
Good for
- Developers with a slow query or report who want it rewritten
- Backend engineers choosing indexes for new tables or endpoints
- Anyone who needs a checklist of query anti-patterns to review a data layer
Install sql-optimization
Claude Code
- 1
Copy this prompt.
Install the sql-optimization skill in Claude Code. Run this command: npx skills add https://github.com/github/awesome-copilot --skill sql-optimization Then check that it loaded and tell me how to use it.
- 2
Paste it into Claude Code. It shows the change and asks before running it.
Requires Node.js.
From its listing on skills.sh. Source.
What's in the skill
When it loads
Universal SQL performance optimization assistant for comprehensive query tuning, indexing strategies, and database performance analysis across all SQL databases (MySQL, PostgreSQL, SQL Server, Oracle). Provides execution plan analysis, pagination optimization, batch operations, and performance monitoring guidance.
Sections in SKILL.md
- ๐ฏ Core Optimization Areas
- Query Performance Analysis
- Index Strategy Optimization
- Subquery Optimization
- ๐ Performance Tuning Techniques
- JOIN Optimization
- Pagination Optimization
- Aggregation Optimization
- ๐ Query Anti-Patterns
- SELECT Performance Issues
- WHERE Clause Optimization
- OR vs UNION Optimization
- ๐ Database-Agnostic Optimization
- Batch Operations
- Temporary Table Usage
- ๐ ๏ธ Index Management
Key facts
- License (per GitHub)
- MIT
- Author
- github (repo owner)
- Installs on skills.sh
- 15,886 as of 2026-11-02
- Repo stars
- 40,666 as of 2026-11-02 (whole repo)
- Last repo commit
- 2026-10-30
- Files in the skill folder
- 1 file including SKILL.md
- skills.sh audits
- Gen Agent Trust Hub: pass; Socket: pass; Snyk: pass
What it includes
Rewrite a slow query and name the indexes it needs
A bad-versus-good pair that replaces a function on a date column and an IN subquery with a join and a date range, with the indexes to create.
Query performance analysisComposite, covering and partial index design
Narrower composite indexes, covering indexes with INCLUDE (SQL Server) and partial indexes for specific conditions.
Index strategyReplace correlated subqueries with window functions or joins
Examples for correlated subqueries and JOIN choices.
Subquery and JOIN optimizationFaster paging and grouped queries
Techniques for paging through large results and for aggregate queries.
Pagination and aggregationSELECT, WHERE and OR vs UNION issues
A list of patterns that slow queries down, with the faster form.
Query anti-patternsMulti-row inserts, temp tables for complex steps
Replaces row-by-row inserts with one batch insert and shows a temporary table for staged calculations.
Batch operations and temporary tablesFind slow queries in MySQL, PostgreSQL, SQL Server
Queries against the MySQL slow log, pg_stat_statements and the SQL Server query stats views.
Performance monitoring queriesFive checklists and a six-step method
Checklists for query structure, indexing, data types, query patterns and performance testing, then identify, analyze, optimize, test, monitor and iterate.
Optimization checklist and methodology
From the official docs
Questions
What does the sql-optimization skill do?
It makes Claude tune SQL for speed. Claude rewrites slow queries, suggests indexes, and points to anti-patterns such as functions on indexed columns or correlated subqueries.
How do I install it?
Use the install box above. The skills CLI command installs this one skill from github/awesome-copilot into the agent you choose.
Which databases does it cover?
The description names MySQL, PostgreSQL, SQL Server and Oracle. The monitoring queries cover MySQL, PostgreSQL and SQL Server.
Does it connect to my database or need an API key?
The SKILL.md names no API key, no database connection and no scripts. It is text guidance, so you give Claude the query and the schema, and you run its suggestions.
Is it safe to install?
It bundles no scripts: the folder is one SKILL.md. Its examples include CREATE INDEX and temporary tables, so test any change on a copy before production. The awesome-copilot README says its content comes from third-party developers and asks you to inspect it before installing.
Is it enough for one specific database?
It states that it focuses on universal techniques. Our advice: for engine-specific tuning, give Claude the output of your database's own execution plan tool along with the query.
Information
updated Nov 2, 2026
- Repository
- github/awesome-copilot
- Folder
skills/sql-optimization
Sources
Docs, issue trackers and discussions this page is built from.
Show all 1Hide
- sql-optimization SKILL.md ยท github.com