From rails-specialist
Use when adding interactive UI to a Rails application without custom JavaScript — inline editing, live updates, real-time notifications, or partial page navigation. Also applies when choosing between Turbo Frames, Turbo Streams, and Stimulus, or reviewing Hotwire implementation for correctness.
How this skill is triggered — by the user, by Claude, or both
Slash command
/rails-specialist:hotwire-patternsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Hotwire (HTML Over The Wire) provides a modern approach to building interactive Rails applications with minimal JavaScript. It consists of Turbo (Drive, Frames, Streams) and Stimulus.
Hotwire (HTML Over The Wire) provides a modern approach to building interactive Rails applications with minimal JavaScript. It consists of Turbo (Drive, Frames, Streams) and Stimulus.
| Component | Purpose | When to Use |
|---|---|---|
| Turbo Drive | Full page navigation without reload | Default — enabled automatically |
| Turbo Frames | Independently updatable page sections | Inline editing, tabbed content, scoped navigation |
| Turbo Streams | Targeted DOM updates via CRUD actions | Multi-element updates from form submissions |
| ActionCable + Streams | Real-time server-pushed updates | Chat, notifications, live dashboards |
| Stimulus | Lightweight client-side behavior | Toggles, form feedback, debounced search |
Stimulus controllers add client-side behavior to HTML elements using data attributes.
data-controller="search" maps to search_controller.jsdata-search-target="input" accesses this.inputTargetdata-action="input->search#search" calls search() methoddata-search-url-value="/api/search" accesses this.urlValuedata-search-active-class="highlighted" accesses this.activeClassDeclare targets, values, and classes as static properties. Always implement disconnect() to clean up event listeners and timers.
Turbo Frames decompose pages into independently updatable sections. Key principles:
dom_id helper for unique, meaningful frame IDsdata-turbo-frame="_top" to break out of frame scope| Action | Description |
|---|---|
append | Add to end of container |
prepend | Add to beginning of container |
replace | Replace entire element |
update | Update content of element |
remove | Remove element |
before | Insert before element |
after | Insert after element |
morph | Morph element (Rails 7.1+) |
refresh | Reload page via morph (Rails 7.1+) |
Respond with format.turbo_stream in controllers. Use .turbo_stream.erb templates for complex responses, or render inline for simple cases.
name_controller.js)event->controller#method)disconnect() cleans up event listeners and timersdom_id helper)| Need | Solution |
|---|---|
| Navigate without reload | Turbo Drive (default) |
| Update part of a page | Turbo Frames |
| Multiple DOM updates | Turbo Streams |
| Real-time server push | ActionCable + Turbo Streams |
| Client-side behavior | Stimulus controller |
| Form with live updates | Turbo Frame wrapping form |
| Toast notifications | Turbo Stream append |
| Infinite scroll | Turbo Frame with lazy loading |
For detailed code examples and implementation patterns, consult:
references/stimulus-patterns.md — Stimulus controller examples (search, toggle, form feedback) and conventions tablereferences/turbo-frames-patterns.md — Turbo Frames examples (basic frames, lazy loading, inline editing, breaking out) and Turbo Drive configurationreferences/turbo-streams-patterns.md — Turbo Streams controller responses, templates, inline streams, ActionCable model broadcasting, custom broadcasting, and morphing (Rails 7.1+)npx claudepluginhub chaserx/cpc --plugin rails-specialistImplements Hotwire Turbo (Drive, Frames, Streams, Morph) and Stimulus controllers in Rails views for SPA-like interactivity, real-time updates, and progressive enhancement.
Implements Hotwire features with Turbo Drive, Turbo Frames, and Turbo Streams in Rails 8, covering morphing, broadcasts, lazy loading, and real-time updates.
Guides building reactive Rails apps with Hotwire (Turbo Drive/Frames/Streams, Stimulus): installation, ActionCable/Redis setup, core patterns.