viewcomponent-agent

Generate reusable Rails ViewComponents with RSpec tests and Lookbook previews.

Updated Feb 8, 2026
One-click install
npx skills add https://github.com/mlbright/notes --skill viewcomponent-agent
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: viewcomponent-agent
Source: https://github.com/mlbright/notes/tree/main/.github/skills/viewcomponent-agent
Command: npx skills add https://github.com/mlbright/notes --skill viewcomponent-agent

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines the creation of robust, well-tested, and maintainable UI components for Rails applications, ensuring consistency and reducing development time.

Core Features & Use Cases

  • Component Generation: Quickly scaffold new ViewComponents with optional sidecars, Stimulus controllers, and previews.
  • Testing & Previews: Automatically generates RSpec tests and Lookbook previews for immediate validation and documentation.
  • Use Case: When building a new feature that requires a consistent button style across multiple pages, use this Skill to generate a ButtonComponent with associated tests and previews, ensuring it's reusable and maintainable.

Quick Start

Use the viewcomponent-agent skill to generate a new ButtonComponent with text and variant options.

Frequently Asked Questions about viewcomponent-agent

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

FAQPage Schema
How do I generate reusable ViewComponents for Rails UI elements?

Generate reusable ViewComponents by scaffolding elements like cards, tables, and modals with slots, variant options, and attached Stimulus controllers. This process ensures consistent UI styling across multiple pages while maintaining component reusability and reducing development time.

How do I test and preview Rails ViewComponents automatically?

Test and preview Rails ViewComponents by automatically generating RSpec test suites and Lookbook previews alongside the component code. This provides immediate validation for UI elements and serves as living documentation for visual states and slot configurations.

Does this ViewComponent generator require RSpec and Lookbook?

Yes, generating ViewComponents with comprehensive tests and previews requires RSpec for testing and Lookbook for previews. These dependencies ensure that every generated Rails UI component is immediately validated and visually documented within your application.

What is the best way to build consistent button styles across Rails pages?

The best way to build consistent button styles is to generate a reusable ButtonComponent with text and variant options. This creates a single source of truth for UI styling, automatically including RSpec tests and Lookbook previews to validate the component.

Can I scaffold ViewComponents with Stimulus controllers and sidecars?

Yes, you can scaffold new ViewComponents with optional sidecars and Stimulus controllers. This allows you to build interactive Rails UI components that combine server-rendered HTML with client-side JavaScript behavior, fully tested with RSpec and previewed in Lookbook.

When should I use ViewComponent slots for Rails UI elements?

Use ViewComponent slots when building complex, reusable Rails UI elements like cards or modals that require multiple distinct content areas. Slots allow you to pass structured content into components cleanly, ensuring maintainable markup and consistent rendering across your application.