/superpowers-rails:rails-controller-conventionsfrom superpowers-rails
Enforces Rails controller conventions: thin controllers, Pundit authorization, message passing, RESTful CRUD for state changes, and Turbo responses.
Ships in superpowers-rails. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Controllers are thin request handlers. They authorize, delegate to models, and respond — nothing more.
authorize. No exceptionsrails-model-conventions)resource :closure not post :close. Create enables, destroy disablesEvery controller action MUST call authorize to enforce Pundit policies.
def create
@article = Article.new(article_params)
authorize @article # BEFORE performing the action
@article.save!
redirect_to @article
end
def index
authorize Article # Class, not instance
@articles = policy_scope(Article)
end
[:companies, resource] for namespaced policiesindex/new: authorize the class (no instance yet)# WRONG - reaching into associations
@bookmark = current_user.academy_bookmarks.find_by(academy: @academy)
# RIGHT - ask the object
@bookmark = current_user.bookmark_for(@academy)
See rails-model-conventions for the full pattern and model-side implementation.
State changes are CRUD on a nested resource, not custom actions. See rails-model-conventions for the concern side.
resources :cards do
resource :closure, only: %i[create destroy]
end
class ClosuresController < ApplicationController
def create
authorize @card, :close?
@card.close
# respond with turbo_stream
end
def destroy
authorize @card, :reopen?
@card.reopen
# respond with turbo_stream
end
end
Authorize against the parent record using intent-named policy methods. No state logic in the controller.
| Do | Don't |
|---|---|
resource :closure | post :close, :reopen |
authorize @resource in every action | Skip authorization |
user.bookmarked?(academy) | user.bookmarks.exists?(...) |
| Model methods for state | Inline association queries |
| Turbo Streams | JSON responses |
| 7 RESTful actions | Custom action proliferation |
authorizeRemember: Controllers authorize and delegate. Everything else belongs in models.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
rails-controllers, pundit, authorization, hotwire, turbo, restful
npx claudepluginhub fryga-io/superpowers-rails --plugin superpowers-rails23 skills in this plugin
/brainstormingYou MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation./diagnosing-superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness./dispatching-parallel-agentsUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesOther plugins' skills for the same job