database-query-optimizer

Detect N+1 query patterns and suggest Prisma indexes and pagination fixes.

Updated Feb 3, 2026
One-click install
npx skills add https://github.com/mouayadakel/flixCamFinal --skill database-query-optimizer-mouayadakel
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-query-optimizer
Source: https://github.com/mouayadakel/flixCamFinal/tree/main/.cursor/skills/database-query-optimizer
Command: npx skills add https://github.com/mouayadakel/flixCamFinal --skill database-query-optimizer-mouayadakel

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses performance bottlenecks in database interactions by identifying and rectifying inefficient query patterns, leading to faster application response times.

Core Features & Use Cases

  • N+1 Query Detection and Resolution: Replaces inefficient loops of single queries with optimized single queries using include or select.
  • Index Suggestion: Recommends adding database indexes on frequently filtered or sorted columns, and composite indexes for common where clauses.
  • Over-fetching Prevention: Guides users to select only necessary fields and relations, avoiding the retrieval of unneeded data.
  • Pagination Implementation: Advises on adding skip/take or cursor-based pagination for list endpoints.

Quick Start

Use the database-query-optimizer skill to suggest improvements for slow database queries.

Frequently Asked Questions about database-query-optimizer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix N+1 query problems in Prisma?

Fix N+1 query problems by replacing inefficient loops of single database queries with optimized single queries using Prisma's `include` or `select` to fetch related data together. This prevents repeated database round trips and reduces query execution times.

What is the best way to optimize slow database queries exceeding 100ms?

Optimize slow database queries by identifying missing indexes on frequently filtered or sorted columns and reducing over-fetching. Adding composite indexes for common `where` clauses and selecting only necessary fields significantly improves query execution speed.

How do I prevent over-fetching data in my application endpoints?

Prevent over-fetching data by selecting only the necessary fields and relations instead of retrieving entire records. Implementing `skip`/`take` or cursor-based pagination for list endpoints further limits the amount of unneeded data retrieved from the database.

When do I need to add composite indexes to my database?

Add composite indexes to your database when you have common `where` clauses filtering on multiple columns simultaneously. Indexing frequently filtered or sorted columns accelerates query execution and resolves performance bottlenecks in database interactions.

Does query optimization break existing application behavior?

Query optimization does not break existing application behavior when applied correctly. The process utilizes Prisma best practices to enhance query efficiency while ensuring no existing functionality is disrupted during the performance improvements.

How do I implement pagination for database list endpoints?

Implement pagination for database list endpoints by adding `skip` and `take` parameters or using cursor-based pagination. This restricts the number of records fetched, preventing over-fetching and reducing database load for large datasets.