Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Sql Query Clinic

    12

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

    $5

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

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

    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.

    Focuses on Postgres and MySQL. Does not support NoSQL, data warehouse modeling, or greenfield schema design. Requires existing EXPLAIN plan data for best results.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    81 uses

    Times used to date

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 3 months ago

    Permissions

    No special permissions declared or detected

    Listed3 months ago

    What's inside

    Frequently Asked Questions

    The skill is specifically optimized for PostgreSQL and MySQL production environments, focusing on the specific execution plan operators and indexing strategies unique to these two engines.

    You simply provide the skill with your SQL query and the output of your database's EXPLAIN ANALYZE command; it will then perform a step-by-step diagnosis and provide the optimized code or index DDL.

    Unlike generic AI prompts, this skill uses a structured diagnostic loop that accounts for column cardinality and sort orders, ensuring the recommended changes actually alter the execution plan rather than just adding redundant indexes.

    Sql Query Clinic is a specialized logic module designed to be integrated into any AI agent framework that supports custom tool or skill sets, such as AutoGPT, LangChain-based agents, or marketplace-compatible assistants.

    The skill focuses on query-level performance and indexing; it does not cover NoSQL databases, broad data warehouse architecture, or building initial database schemas from scratch.

    Your purchase includes the full skill definition, documentation on how to integrate it into your agent, and access to all future updates and logic refinements for new engine versions.

    New in Data & Databases