Rails
// Build reliable Rails apps avoiding ActiveRecord traps, N+1 queries, and callback pitfalls.
$ git log --oneline --stat
stars:1,933
forks:367
updated:March 4, 2026
SKILL.mdreadonly
SKILL.md Frontmatter
nameRails
slugrails
version1.0.1
descriptionBuild reliable Rails apps avoiding ActiveRecord traps, N+1 queries, and callback pitfalls.
metadata[object Object]
Quick Reference
| Topic | File |
|---|---|
| N+1, callbacks, validations, scopes | activerecord.md |
| Strong params, filters, render | controllers.md |
| Route conflicts, constraints | routing.md |
| Partials, helpers, caching, XSS | views.md |
| ActiveJob, Sidekiq, retries | jobs.md |
| Mass assignment, CSRF, SQL injection | security.md |
Critical Rules
savereturns false on failure —save!raises, check return or use bangupdate_all/delete_allskip callbacks and validations — data corruption if unawarefind_eachfor batches —Model.all.eachloads entire table into memoryredirect_todoesn't halt execution — code after it runs, useand returndependent: :destroymissing — orphan records accumulate foreverdefault_scopepollutes all queries including joins — almost always wrong- Callbacks chain silently —
throw :abortstops save but returns false, not exception includeswithoutreferencesinwherestring — N+1 still happens||=memoization caches nil/false — usedefined?(@var) ? @var : @var = computehas_many through:vshas_and_belongs_to_many— latter has no join model for attrs- Nested
before_action— multiple inheritance makes flow unreadable renderdoesn't stop action — code continues, duplicate render crashes