active-record-patterns
Installation
SKILL.md
Active Record Patterns
Iron Laws
- Use
decimalor integer cents for money. - Prevent N+1 queries with intentional preload strategy.
- Put invariants inside transactions and use locks when races matter.
- Prefer
after_commitfor external side effects. - Keep schema constraints aligned with application validations.
Default Moves
- use foreign keys and indexes deliberately
- choose
includes,preload, oreager_loadintentionally - use
find_eachfor large backfills and batch work - use optimistic or pessimistic locking where correctness depends on it
- make migrations reversible and production-safe