From rails-specialist
Use when reviewing Rails code for quality issues, refactoring problematic code, or encountering symptoms like fat controllers, god models, callback chains with side effects, N+1 queries, logic-heavy views, or non-idempotent background jobs. Covers controller, model, query, view, job, and migration anti-patterns with bad/good examples and fixes.
npx claudepluginhub chaserx/cpc --plugin rails-specialistThis skill uses the workspace's default tool permissions.
A guide to recognizing and fixing common anti-patterns in Rails applications. Each reference file shows what to avoid (Bad), explains why it's problematic, and demonstrates the correct approach (Good).
Generates design tokens/docs from CSS/Tailwind/styled-components codebases, audits visual consistency across 10 dimensions, detects AI slop in UI.
Records polished WebM UI demo videos of web apps using Playwright with cursor overlay, natural pacing, and three-phase scripting. Activates for demo, walkthrough, screen recording, or tutorial requests.
Delivers idiomatic Kotlin patterns for null safety, immutability, sealed classes, coroutines, Flows, extensions, DSL builders, and Gradle DSL. Use when writing, reviewing, refactoring, or designing Kotlin code.
A guide to recognizing and fixing common anti-patterns in Rails applications. Each reference file shows what to avoid (Bad), explains why it's problematic, and demonstrates the correct approach (Good).
Business logic in controllers, non-RESTful route proliferation, and synchronous external calls in the request cycle.
service-patterns skill).For detailed Bad/Good examples, see references/controller-antipatterns.md.
God objects, callback-driven side effects, invisible query scoping, and misused concerns.
default_scope Abuse — Use explicit named scopes instead of default_scope, which applies silently to every query.For detailed Bad/Good examples, see references/model-antipatterns.md.
Tight coupling through deep object graphs, inefficient Ruby-side processing, and N+1 queries.
delegate instead of reaching deep into object graphs.active-record-patterns skill.includes, preload, or eager_load. See rails-performance skill.For detailed Bad/Good examples, see references/query-antipatterns.md.
Logic-heavy templates, hidden partial dependencies, nil gymnastics, and misuse of Turbo/Stimulus. See hotwire-patterns skill for correct Hotwire patterns.
DOMContentLoaded listeners.For detailed Bad/Good examples, see references/view-antipatterns.md.
Non-idempotent jobs, race conditions from enqueueing inside transactions, and serialization issues.
after_commit.For detailed Bad/Good examples, see references/job-antipatterns.md.
Fragile migrations that mix concerns or depend on application code.
For detailed Bad/Good examples, see references/migration-antipatterns.md.
| Anti-Pattern | Fix |
|---|---|
| Fat controller | Extract to service object |
| Non-RESTful actions | Model as nested resources |
| Blocking external calls | Move to background jobs |
| God object | Extract concerns, services, and query objects |
| Callback hell | Use service objects for orchestration |
default_scope | Use explicit named scopes |
| Concerns as junk drawers | Keep concerns small and cohesive |
| Law of Demeter violations | Use delegate |
| Ruby where SQL suffices | Use ActiveRecord query methods |
| N+1 queries | Use includes, preload, or eager_load |
| Logic-heavy views | Extract to helpers or presenters |
| Instance vars in partials | Use strict locals |
| Nil gymnastics | Null Object pattern |
| Streams when Frames suffice | Use Turbo Frames for in-place updates |
| Stimulus for everything | Let Turbo Drive and Frames handle navigation |
DOMContentLoaded listeners | Use Stimulus controllers |
| Non-idempotent jobs | Add guard clauses and idempotency keys |
| Enqueueing inside transactions | Enqueue after commit |
| Complex objects as job args | Pass primitive IDs only |
| Mixed schema/data migrations | Separate into distinct migrations |
| Model classes in migrations | Use raw SQL or inline stubs |
For detailed Bad/Good code examples organized by category:
references/controller-antipatterns.md — Fat controllers, non-RESTful actions, blocking callsreferences/model-antipatterns.md — God objects, callbacks, default_scope, concernsreferences/query-antipatterns.md — Law of Demeter, Ruby vs SQL, N+1 queriesreferences/view-antipatterns.md — Logic-heavy views, partials, nil handling, Hotwire misusereferences/job-antipatterns.md — Idempotency, transaction timing, serializationreferences/migration-antipatterns.md — Schema/data mixing, model referencesservice-patterns — Service object, form object, and interactor patternshotwire-patterns — Correct Turbo Frames, Turbo Streams, and Stimulus patternsactive-record-patterns — Query and association patternsrails-performance — Eager loading and optimization strategies