performance-optimization

Identify and fix Rails performance issues including N+1 queries and memory problems.

Updated Nov 1, 2025
One-click install
npx skills add https://github.com/nschneble/rails-superstack --skill performance-optimization-nschneble
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: performance-optimization
Source: https://github.com/nschneble/rails-superstack/tree/main/.agents/skills/performance-optimization
Command: npx skills add https://github.com/nschneble/rails-superstack --skill performance-optimization-nschneble

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Identifies and fixes Rails performance issues including N+1 queries, slow queries, and memory problems. Use when optimizing query performance, addressing N+1 query patterns, or improving response times, especially when Bullet gem alerts appear.

Core Features & Use Cases

  • N+1 detection: Identify where extra queries are triggered.
  • Query optimization: Suggest eager loading, selective columns, and batching.
  • Memory management: Highlight memory bloat and propose mitigations.
  • Use Case: Rails apps with slow endpoints, large datasets, and complex associations.

Quick Start

Analyze a Rails app to identify N+1 queries and slow endpoints, then generate a prioritized optimization plan.

Frequently Asked Questions about performance-optimization

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

FAQPage Schema
How do I fix N+1 query problems in a Rails app?

Fix N+1 queries in Rails by applying eager loading patterns like includes or preload to batch association queries. This Skill identifies where extra queries are triggered and generates a prioritized optimization plan to reduce database load.

What is the best way to resolve Bullet gem warnings for slow Rails endpoints?

Resolve Bullet gem warnings by analyzing the alerted endpoints and applying selective column loading or batching. This Skill interprets Bullet alerts and suggests targeted query refactoring to eliminate unnecessary database calls and improve response times.

How does rack-mini-profiler help with Rails memory profiling?

rack-mini-profiler helps with Rails memory profiling by highlighting memory bloat during request cycles. This Skill integrates profiler data to pinpoint memory-heavy operations and proposes mitigations to reduce overall application memory consumption.

When do I need counter caches for Rails query optimization?

You need counter caches for Rails query optimization when frequently counting associated records without loading them into memory. This Skill identifies slow queries and recommends indexing or counter cache implementations to speed up data retrieval.

Can I use this for memory management in Rails apps with large datasets?

Yes, you can use this for memory management in Rails apps handling large datasets. It highlights memory bloat from complex associations and proposes batching or selective loading mitigations to keep response times fast under heavy data loads.

Why are my Rails endpoints slow despite having proper database indexes?

Rails endpoints might be slow despite indexes due to N+1 query patterns or memory bloat from loading unnecessary associations. This Skill analyzes your query performance to identify hidden bottlenecks and proposes targeted refactoring.