PlugWiki

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. 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. 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

  1. ๐ŸŽฏ Core Optimization Areas
  2. Query Performance Analysis
  3. Index Strategy Optimization
  4. Subquery Optimization
  5. ๐Ÿ“Š Performance Tuning Techniques
  6. JOIN Optimization
  7. Pagination Optimization
  8. Aggregation Optimization
  9. ๐Ÿ” Query Anti-Patterns
  10. SELECT Performance Issues
  11. WHERE Clause Optimization
  12. OR vs UNION Optimization
  13. ๐Ÿ“ˆ Database-Agnostic Optimization
  14. Batch Operations
  15. Temporary Table Usage
  16. ๐Ÿ› ๏ธ Index Management

Key facts

License (per GitHub)
MIT
Installs on skills.sh
15,886 as of 2026-11-02
Last repo commit
2026-10-30
Files in the skill folder
1 file including SKILL.md

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 analysis

  • Composite, covering and partial index design

    Narrower composite indexes, covering indexes with INCLUDE (SQL Server) and partial indexes for specific conditions.

    Index strategy

  • Replace correlated subqueries with window functions or joins

    Examples for correlated subqueries and JOIN choices.

    Subquery and JOIN optimization

  • Faster paging and grouped queries

    Techniques for paging through large results and for aggregate queries.

    Pagination and aggregation

  • SELECT, WHERE and OR vs UNION issues

    A list of patterns that slow queries down, with the faster form.

    Query anti-patterns

  • Multi-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 tables

  • Find 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 queries

  • Five 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

Folder
skills/sql-optimization

github/awesome-copilotskills.sh

Sources

Docs, issue trackers and discussions this page is built from.

Show all 1
  1. sql-optimization SKILL.md ยท github.com

Updated Nov 2, 2026.