n-plus-one-killer
CommunityDetect and fix Rails N+1 queries for faster endpoints.
Authorsandeepmvl
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This Skill solves the pervasive Rails performance issue of undetected N+1 queries, which AI coding agents frequently introduce when generating controller and view code, leading to excessive database load and slow endpoint response times.
Core Features & Use Cases
- N+1 Detection: Uses Bullet for association-aware detection in development and test, and Prosopite to catch raw query pattern N+1s that Bullet misses.
- Optimization Patterns: Provides step-by-step fixes including eager loading with
includes/preload/eager_load, counter cache implementation for count N+1s, and denormalization guidance for complex query scenarios. - Production Diagnosis: Includes workflows for identifying production-only N+1s via query log tags, APM tools, and
pg_stat_statements, plus an EXPLAIN ANALYZE reference for deep SQL analysis. - Use Case: For a slow
/postsindex that loads post authors and comment counts per row, the skill identifies both N+1s, adds the correct eager loading, recommends a counter cache for comment counts, and wires up Bullet to catch future regressions in test suites.
Quick Start
Use the n-plus-one-killer skill to diagnose and fix the slow /posts endpoint that loads post authors and comment counts per row.
Dependency Matrix
Required Modules
bullet
Components
scriptsreferences
💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: n-plus-one-killer Download link: https://github.com/sandeepmvl/rails-skills/archive/main.zip#n-plus-one-killer Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 537,000+ vetted skills library on demand.