ActiveRecord Patterns

Community

Optimize Rails data access for fast queries

Authorbetamatt
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Rails apps frequently fall into N+1 queries, inefficient eager loading, and brittle associations that hamper performance and complicate migrations. This skill consolidates production-grade ActiveRecord patterns to help engineers write scalable, maintainable data access code in Rails 7+.

Core Features & Use Cases

  • Query optimization guidance for includes, preload, and eager_load with nested associations.
  • Association patterns, including counter caches, inverse_of, and polymorphic relations.
  • Safe migrations, indexing strategies, and zero-downtime patterns for Rails 7+.

Quick Start

Write a small example to optimize a slow query by eager loading and pluck specific columns with a concise script that you can run in a Rails console, to immediately see reduced queries.

Dependency Matrix

Required Modules

None required

Components

references

💻 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: ActiveRecord Patterns
Download link: https://github.com/betamatt/claude-plugins/archive/main.zip#activerecord-patterns

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.