Works with the AI tools you already use

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

    DB Query Optimizer

    1

    Detects and fixes N+1 queries, missing indexes, and ORM performance bottlenecks in SQL, Prisma, Django, and more.

    Free

    0 installsSecurity scanned

    See it in action

    You say

    Why is this Prisma call slow? It fetches all posts, and then for each post, my UI displays the author name and the count of comments. It works fine locally but hangs in production.

    Your agent does

    This is a classic N+1 query. You are fetching N posts, then triggering 2 additional queries per post for the author and comments. In production with 100 posts, this is 201 queries.

    Fix: Update your Prisma findMany to include: include: { author: true, _count: { select: { comments: true } } }

    About this skill

    The problem

    Database performance issues often stay hidden during development because ORM code looks clean despite executing inefficiently. N+1 queries and missing indexes only reveal themselves as catastrophic slowdowns or connection pool exhaustion once your data volume grows in production.

    What it does

    • Identifies N+1 query patterns in ORM code and provides the exact eager-loading or batching syntax for your specific framework.
    • Analyzes EXPLAIN and EXPLAIN ANALYZE output to detect sequential scans and inefficient query plans.
    • Flags missing indexes on foreign keys, WHERE clauses, and ORDER BY statements, accounting for composite index column order.
    • Detects application-level filtering and pagination bugs that should be handled at the database layer.
    • Diagnoses connection pool exhaustion caused by high query volume per request.

    Frameworks & tools

    Supports Prisma, Sequelize, TypeORM, Django ORM, ActiveRecord, SQLAlchemy, and Eloquent. Works with PostgreSQL, MySQL, and SQLite.

    Why this beats prompting it yourself

    General LLMs often suggest generic fixes or hallucinate ORM methods that do not exist. This skill uses framework-specific reference patterns to ensure the suggested fix is syntactically correct and actually addresses the underlying execution plan rather than just making the code look better.

    Use cases

    • Auditing an API endpoint that has become progressively slower as the database grows.
    • Refactoring legacy ORM code to eliminate N+1 queries in serializers and view layers.
    • Optimizing database performance by analyzing slow query logs and execution plans.
    • Troubleshooting intermittent database timeouts and connection pool errors under load.

    How to install

    Drop the file into your AI Agent. Works with Claude, Cursor, ChatGPT, and 20+ more.

    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

    Fresh listing

    Recently published to Agensi

    Free forever

    No account required to browse

    Trust & safety

    Security scanned

    Verified clean today

    • Free to download with an account

    Listedtoday

    Frequently Asked Questions

    Free