rails:debug

Diagnose Ruby on Rails performance bottlenecks via code, log, and schema analysis.

1|Updated Apr 2, 2026
One-click install
npx skills add https://github.com/fabn/claude-plugins --skill rails-debug
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rails:debug
Source: https://github.com/fabn/claude-plugins/tree/main/plugins/rails/skills/debug
Command: npx skills add https://github.com/fabn/claude-plugins --skill rails-debug

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers identify and resolve performance issues in Ruby on Rails applications, including N+1 queries, slow requests, excessive memory usage, and missing or suboptimal indexes. It guides code inspection, log and trace analysis, and profiling to find root causes and propose actionable fixes.

Core Features & Use Cases

  • N+1 detection and eager-loading fixes: Trace association access paths, find missing includes/preload/eager_load, and recommend the appropriate loading strategy.
  • Memory and batch processing analysis: Detect large dataset instantiations, recommend find_each/in_batches, pluck optimizations, and streaming solutions for exports.
  • Request and production profiling guidance: Suggest rack-mini-profiler, Bullet, ActiveSupport::Notifications, and APM trace checks, and outline verification steps.
  • Index and query plan recommendations: Read schema files or structure SQL, identify missing or redundant indexes, and craft migration examples with verification steps.
  • GraphQL-aware diagnostics: Check for DataLoader/BatchLoader patterns and recommend loader implementations to avoid resolver N+1s.

Quick Start

Ask the rails:debug skill to analyze a slow controller action or log excerpt and propose specific eager loading, indexing, and profiling steps to verify the fix.

Frequently Asked Questions about rails:debug

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

FAQPage Schema
How do I fix N+1 queries in a Rails controller action?

Fix Rails N+1 queries by tracing association access paths and applying the appropriate eager loading strategy. Use includes, preload, or eager_load to batch database queries and verify the fix with tools like Bullet.

What's the best way to reduce memory bloat in Rails background jobs?

Reduce Rails memory bloat by replacing large dataset instantiations with batch processing methods. Use find_each, in_batches, or pluck to stream records and optimize export jobs, preventing excessive memory allocation.

How do I find missing database indexes for slow Rails requests?

Find missing indexes by reading schema files or structure SQL to identify suboptimal query patterns. Craft database migrations with the recommended indexes and verify query plan improvements using profiling tools.

Does this approach work for resolving N+1 queries in GraphQL resolvers?

Yes, it works for GraphQL resolvers by checking for DataLoader and BatchLoader patterns. Implementing the recommended loader implementations batches association queries and avoids resolver-level N+1 issues.

How do I profile a slow Rails request in production?

Profile slow Rails requests in production by analyzing APM traces and using rack-mini-profiler or ActiveSupport::Notifications. Inspect request latency and query patterns to identify bottlenecks and verify applied fixes.