What problem does it solve?
This Skill helps you build reliable, reusable Rails ViewComponents without scattering UI logic across partials, while keeping markup testable through a tight TDD loop.
Core Features & Use Cases
- ViewComponent fundamentals: Build UI as Ruby objects with explicit interfaces instead of partial lookup.
- TDD workflow: Use a RED→GREEN cycle to drive component design (write tests first, generate skeletons, iterate to passing tests).
- Common component patterns: Cards, badges with variants, tables with nested components, modals, and presenter-like wrapping components.
- Slots and composition: Create flexible APIs with
renders_one and renders_many for headers/footers/actions.
- Collections and rendering: Render repeated component instances via
with_collection and test behavior across items.
- Testing & previews: Structure Minitest component tests and development previews to validate DOM output quickly.
Quick Start
Ask your AI to generate a ViewComponent card-style UI in a Rails 8 app by writing the component test first, then implementing the Ruby class and ERB template until the test is green.