rails-patterns
Installation
SKILL.md
Rails Patterns
Rails gives you models, controllers, and views. Reality gives you business logic that doesn't fit neatly into any of them. This skill covers when and how to extract that logic into well-named Ruby objects.
The Core Question
Before extracting anything, ask: where does this logic want to live?
- Logic about a single ActiveRecord object → model method or concern
- Logic that orchestrates multiple models or external services → service object
- Logic for validating/coercing user input across multiple models → form object
- Logic for presenting a model differently in different contexts → decorator
- Logic that varies by type or context → strategy
- Logic that reacts to events in other objects → observer / callback
Extraction has a cost — more files, more indirection, more to hold in your head. Only extract when the alternative is clearly worse.