| name | rails-controllers |
| description | Rails controllers: strong parameters, filters, respond_to, streaming, and HTTP semantics. Use when implementing request handling. |
Rails Controllers
Keep controllers thin; push domain logic to models, services, or jobs.
When to Use This Skill
- New controller actions
- Strong params and authorization hooks
- Turbo Stream responses
Defaults (This Plugin)
- Toolchain: mise — not rbenv, rvm, or asdf directly
- Ruby: 4.0.0+ unless the project pins otherwise
- Rails: 8+ conventions and generators when applicable
- Execution: Prefer
mise exec --, bin/rails, bin/rspec, and bundle exec
Core Guidance
- Strong parameters — always permit explicitly:
params.expect(user: [:name, :email])
-
Before actions for auth and setup; avoid business rules in filters.
-
respond_to / respond_to do |format| for HTML/Turbo/JSON.
-
Status codes: head :no_content, render :show, status: :created.
-
Service objects when an action exceeds ~15 lines or has many branches.
Quick Commands
mise exec -- bin/rails generate controller Posts index
mise exec -- bundle exec rubocop app/controllers
Anti-Patterns
- Mass assignment without strong params
- N+1 queries in index without
includes
- Instance variables for non-view side effects
See Also
- rails-routing
- rails-hotwire-turbo