Works with the AI tools you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIGitHub CopilotGitHub CopilotGemini CLIGemini CLI+20 more

    Sql Query Clinic

    11

    Diagnose slow or broken SQL: explain plans, index advice, rewrites, and correctness checks.

    $5

    Secure checkout via Stripe

    30-day refund guarantee

    Converts to your local currency at checkout

    81 installsSecurity scanned
    Sql Query Clinic

    Sql Query Clinic

    Example session with this skill installed

    Optimize this Postgres query: SELECT * FROM orders WHERE customer_id = 502 AND status = 'pending' ORDER BY created_at DESC; EXPLAIN shows a Seq Scan on 2M rows.

    • Read your context and instructions
    • Compiled the sql query clinic

    Diagnosis: Seq Scan is occurring because there is no index covering the predicate.
    Recommendation: Create a composite index on (customer_id, status, created_at DESC).
    Result: This turns a 2M-row scan into a direct B-tree probe, eliminating the separate sort step.

    Connects securely to your tools. The creator never sees your data.

    What you get

    Eliminate full table scans in Postgres and MySQL production databases.Optimize composite indexes for complex filtering and sorting requirements.Rewrite correlated subqueries into performant joins to reduce buffer churn.Troubleshoot execution plan regressions after large data migrations.

    About this skill

    The problem

    Slow production queries cause CPU spikes, timeouts, and buffer churn. Relying on generic database optimization advice often leads to redundant indexes or rewrites that don't actually fix the execution plan.

    What it does

    • Analyzes EXPLAIN ANALYZE output to identify SeqScan bottlenecks and row estimate divergences.
    • Designs optimal composite indexes based on predicate selectivity and ORDER BY requirements.
    • Rewrites inefficient patterns like correlated subqueries, NOT IN, and OR filters into performant joins and unions.
    • Identifies when stale statistics require an ANALYZE or OPTIMIZE rather than a code change.

    Frameworks & tools

    PostgreSQL and MySQL production environments.

    Why this beats prompting it yourself

    Generic prompts often suggest simple indexes that ignore column cardinality or multi-column sort orders. This skill follows a structured diagnosis loop that validates row count reductions and eliminates temp files, ensuring the fix actually changes the plan operators.

    Use cases

    • Eliminating full table scans on high-traffic reporting dashboards.
    • Reducing latency by converting correlated subqueries into set-based joins.
    • Optimizing composite indexes to remove expensive sort steps in GROUP BY operations.
    • Troubleshooting execution plan regressions after large schema migrations.

    Known limitations

    Focuses on relational databases only. Does not support NoSQL tuning, data warehouse modeling, or initial schema design from scratch.

    How to install

    Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.

    ~30 seconds
    1. 1

      Download the ZIP

      Free skills download straight away. Paid skills unlock right after purchase.

    2. 2

      Unzip into your skills folder

      Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.

    3. 3

      Ask your agent to use it

      Restart the agent if it was already running. It picks the skill up automatically - no config needed.

    Skills folder by agent

    Click the path to copy it. Create the folder if it does not exist yet.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    81 installs

    Downloaded by developers to date

    30-day refund

    Not a fit? Get your money back

    Trust & safety

    Security scanned

    Verified clean 1 month ago

    • Passed all security checks, Safe to install

    Listed1 month ago
    Updatedtoday

    Frequently Asked Questions