Rails Conventions & Patterns

Enforce Rails conventions and design patterns in controllers, models, and services.

10|1|Updated Dec 20, 2025
One-click install
npx skills add https://github.com/Kaakati/rails-enterprise-dev --skill rails-conventions-patterns
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: Rails Conventions & Patterns
Source: https://github.com/Kaakati/rails-enterprise-dev/tree/main/plugins/rails-enterprise-dev/skills/rails-conventions
Command: npx skills add https://github.com/Kaakati/rails-enterprise-dev --skill rails-conventions-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides authoritative guidance on Ruby on Rails conventions, design patterns, and idiomatic code standards for production apps.

Core Features & Use Cases

  • Ruby & Rails Versions: ruby: "3.2+ (prefer 3.3+ for YJIT benefits)", rails: "7.1+ (prefer 8.0+ for new projects)"
  • Rails 7.1+ Features: Composite Primary Keys, ActiveRecord::Encryption, Horizontal Sharding, Async Query Loading, Normalization
  • Rails 8.0+ Features and Modern Ruby 3.3+: examples include Solid Queue, Solid Cache, credentials
  • Modern Ruby 3.3+ examples (pattern matching, data classes, etc.)

Quick Start

Adopt these conventions in new and existing Rails apps to ensure readable, maintainable, and scalable code.

Frequently Asked Questions about Rails Conventions & Patterns

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

FAQPage Schema
How do I structure Rails controllers and models following best practices?▼

Rails conventions emphasize skinny controllers and fat models, keeping business logic in models and ActiveRecord. For complex logic, extract into service objects. Use Rails 7.1+ or 8.0+ with modern patterns like composite primary keys and ActiveRecord encryption for production apps running Ruby 3.2+.

What naming conventions and standards should I follow in a Rails project?▼

Rails naming conventions standardize models, controllers, and database tables for readability and maintainability. Follow singularized model names (User), pluralized controllers (UsersController), and snake_case for files and database columns. Document these patterns across your codebase for consistency.

How do I handle encryption and data normalization in Rails 7.1+?▼

Rails 7.1+ includes ActiveRecord::Encryption for transparent encryption and normalization features for standardized data storage. Use these built-in tools instead of external gems to simplify production apps and maintain Rails idioms across models and schemas.

What Rails version should I use for new projects?▼

Rails 8.0+ with Ruby 3.3+ is recommended for new projects, offering Solid Queue, Solid Cache, and modern features. Existing projects should target Rails 7.1+ with Ruby 3.2+ minimum. Plan migrations to access pattern matching, encryption, and horizontal sharding capabilities.

When should I use service objects in Rails architecture?▼

Extract complex business logic into service objects when controllers or models grow beyond single responsibility. Service objects encapsulate multi-step workflows, external API calls, or cross-model operations, keeping your codebase organized and testable.

How do Rails conventions handle database scaling with horizontal sharding?▼

Rails 7.1+ supports horizontal sharding for distributing data across databases. Follow Rails conventions when implementing sharding strategies: keep models and migrations aligned, use composite primary keys where needed, and document sharding rules for team consistency.