From superpowers-rails
Creates and modifies Pundit authorization policies with role-based permissions, ensuring policies check user permissions not resource state.
How this skill is triggered — by the user, by Claude, or both
Slash command
/superpowers-rails:rails-policy-conventionsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Policies answer one question: "Is this user allowed to attempt this action?" They check WHO, not WHAT or WHEN.
Policies answer one question: "Is this user allowed to attempt this action?" They check WHO, not WHAT or WHEN.
mentor_or_above?, content_creator_or_above? from ApplicationPolicyspec/policies/, NOT request specs. Request specs use authorized users (happy path) and never mock policies# WRONG - checking state
def publish?
user.admin? && !record.published? # State check doesn't belong here
end
# RIGHT - permission only
def publish?
content_creator_or_above?
end
mentor_or_above? # mentor? || content_creator? || company_admin?
content_creator_or_above? # content_creator? || company_admin?
| Do | Don't |
|---|---|
| Check user permissions | Check resource state |
| Use role helper methods | Complex inline role checks |
authorize @resource in every action | Skip authorization |
| Return boolean only | Raise errors in policies |
| Keep policies thin | Business logic in policies |
mentor_or_above? not inline checksRemember: Policies are gatekeepers, not validators. They check WHO, not WHAT or WHEN.
npx claudepluginhub fryga-io/superpowers-rails --plugin superpowers-railsImplements and tests authorization in Rails using Pundit or CanCanCan. Covers policy objects, role-based access control, and verification by attempting unauthorized actions.
Creates ActionPolicy authorization in Rails: policy classes, controller integration with authorize!, scopes, caching, I18n, tests, GraphQL/ActionCable support. Proactive alternative to Pundit.
Enforces Rails controller conventions: thin controllers, Pundit authorization, message passing, RESTful CRUD for state changes, and Turbo responses.