What problem does it solve?
This Skill addresses the common issues of complex, hard-to-maintain Rails views by guiding the refactoring process towards modern, efficient patterns like Hotwire and ViewComponents.
Core Features & Use Cases
- Modernization: Updates legacy Rails views to leverage Turbo Frames, Turbo Streams, and Stimulus controllers for enhanced interactivity without a build step.
- Code Quality: Refactors views to eliminate inline Ruby logic, HTML-returning helpers, and deeply nested partials, promoting cleaner, more testable code.
- Componentization: Guides the extraction of reusable UI patterns into ViewComponents and organizes display logic using presenters.
- Use Case: Refactor a large, complex ERB file containing inline JavaScript and multiple partials into a set of well-defined ViewComponents and Stimulus controllers, improving maintainability and performance.
Quick Start
Use the action-view-best-practices skill to refactor the provided Rails view code into modern Hotwire patterns.