From superpowers-rails
Defines conventions for Rails views, partials, and ViewComponents. Uses Hotwire/Turbo for dynamic updates, Stimulus for JavaScript, and prohibits custom helpers. Promotes dumb views and ViewComponents for presentation logic.
How this skill is triggered — by the user, by Claude, or both
Slash command
/superpowers-rails:rails-view-conventionsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Views are dumb templates. Presentation logic lives in ViewComponents, domain logic lives in models.
Views are dumb templates. Presentation logic lives in ViewComponents, domain logic lives in models.
app/helpers/ is prohibited. Use ViewComponents insteadWhy? Testability. Logic in views cannot be unit tested.
Use for: formatting, conditional rendering, computed display values — anything that would go in a helper.
Models vs ViewComponents: Models answer domain questions ("what is the deadline?"). ViewComponents answer presentation questions ("how do we display it?" — colors, icons, formatting).
Ask models, don't reach into their internals (see rails-model-conventions for the full pattern):
<%# WRONG - reaching into associations %>
<% if current_user.bookmarks.exists?(academy: academy) %>
<%# RIGHT - ask the model %>
<% if current_user.bookmarked?(academy) %>
form_with for all forms| Do | Don't |
|---|---|
current_user.bookmarked?(item) | current_user.bookmarks.exists?(...) |
task.requires_review? | task.review_criteria.any? in component |
| Turbo frames for updates | JSON API calls |
| Stimulus for JS behavior | Inline JavaScript |
| Partials for simple markup | Duplicated markup |
| ViewComponents for logic | Custom helpers |
Remember: Views render. ViewComponents present. Models decide.
npx claudepluginhub fryga-io/superpowers-rails --plugin superpowers-railsGuides building consistent, maintainable Rails UI with design tokens, Turbo, Stimulus, partials, and form builders. Use when creating or refactoring views, components, or design system audits.
Defines conventions for Stimulus controllers in Rails: Turbo-first, thin controllers with DOM-only logic, proper cleanup, and preferred naming.
Builds maintainable Rails views with partials, helpers, forms, nested forms, and layouts ensuring WCAG 2.1 AA accessibility compliance.