hotwire-patterns
Installation
SKILL.md
Hotwire Patterns
Iron Laws
- Keep server-rendered interactions simple before reaching for custom JS.
- Broadcast after commit when Turbo Stream updates depend on committed state.
- Keep Stimulus controllers focused on browser concerns, not business rules.
- Avoid duplicating the same state in DOM, session, cache, and
Currentwithout a clear source of truth. - Use Turbo Frames for scoped navigation; Turbo Streams for server-driven updates.
- Progressive enhancement: pages work without JavaScript, enhanced with it.
Overview
Hotwire provides tools for building modern web applications with minimal JavaScript:
- Turbo Drive — Handles page navigation without full reloads
- Turbo Frames — Scoped page updates, independent navigation
- Turbo Streams — Server-driven page changes via WebSocket or HTTP
- Stimulus — JavaScript controllers for progressive enhancement