- Home
- Skills
- Data & Databases
- DB Query Optimizer
Works with the AI tools you already use
DB Query Optimizer
Detects and fixes N+1 queries, missing indexes, and ORM performance bottlenecks in SQL, Prisma, Django, and more.
$5
DB Query Optimizer
Example session with this skill installed
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.
- Read your context and instructions
- Compiled the db query optimizer
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 } } }
Connects securely to your tools. The creator never sees your data.
What you get
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
EXPLAINandEXPLAIN ANALYZEoutput to detect sequential scans and inefficient query plans. - Flags missing indexes on foreign keys,
WHEREclauses, andORDER BYstatements, 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
Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.
- 1
Download the ZIP
Free skills download straight away. Paid skills unlock right after purchase.
- 2
Unzip into your skills folder
Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.
- 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
3 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