action-view-best-practices

Refactor Rails views into Hotwire patterns and ViewComponents.

3|3|Updated Jan 18, 2026
One-click install
npx skills add https://github.com/CodySwannGT/lisa --skill action-view-best-practices
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: action-view-best-practices
Source: https://github.com/CodySwannGT/lisa/tree/main/plugins/lisa-rails/skills/action-view-best-practices
Command: npx skills add https://github.com/CodySwannGT/lisa --skill action-view-best-practices

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

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.

Frequently Asked Questions about action-view-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor Rails views to use Hotwire and ViewComponent?

Refactor Rails views by replacing inline Ruby logic and nested partials with ViewComponents and presenters, while integrating Turbo Frames, Turbo Streams, and Stimulus controllers to produce clean, maintainable template code.

What is the best way to remove inline Ruby logic from ERB templates?

The best way to remove inline Ruby logic from ERB templates is by extracting display rules into presenters and encapsulating reusable UI elements as ViewComponents, yielding strictly typed locals and testable view code.

When should I use Turbo Frames versus Turbo Streams in Rails view refactoring?

Use Turbo Frames to isolate and update specific sections of a Rails view asynchronously, while Turbo Streams broadcast targeted page changes, both replacing legacy JavaScript and HTML-returning helpers during view refactoring.

Can I modernize Rails partials with Stimulus controllers without a JavaScript build step?

Yes, you can modernize Rails partials by attaching Stimulus controllers to manage interactivity, entirely avoiding a JavaScript build step while replacing legacy JavaScript patterns in your views.

How does ViewComponent improve testability for legacy Rails helpers that return HTML?

ViewComponent improves testability by replacing HTML-returning helpers with encapsulated Ruby classes and ERB templates, allowing direct unit testing of rendered output and enforcing strict locals for view data.