database-query-optimizer

Detect N+1 query patterns and suggest indexes from EXPLAIN ANALYZE output.

1|Updated Mar 17, 2025
One-click install
npx skills add https://github.com/MaciWP/CV_Astro --skill database-query-optimizer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-query-optimizer
Source: https://github.com/MaciWP/CV_Astro/tree/main/.claude/skills/database-query-optimizer
Command: npx skills add https://github.com/MaciWP/CV_Astro --skill database-query-optimizer

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires PostgreSQL, MySQL, MongoDB, Redis, SQLAlchemy, Prisma, TypeORM, Mongoose, Drizzle, and includes references (resource) components.

What problem does it solve?

This Skill identifies and resolves common database performance bottlenecks, such as slow queries, N+1 problems, and missing indexes, ensuring your applications run faster and more efficiently.

Core Features & Use Cases

  • N+1 Query Detection & Fixes: Automatically find and eliminate inefficient N+1 query patterns using eager loading (JOINs) in ORMs like SQLAlchemy or Prisma.
  • Index Suggestions: Analyze query plans and recommend optimal database indexes to speed up WHERE, ORDER BY, and JOIN clauses.
  • Use Case: Analyze a slow API endpoint that fetches users and their associated posts, then optimize the query to fetch all data in a single database hit, or interpret EXPLAIN ANALYZE output to pinpoint performance issues.

Quick Start

Analyze the following SQLAlchemy query for N+1 problems and suggest eager loading: users = db.query(User).all(); for user in users: print(user.posts).