ViewComponents Specialist

Design, implement, and debug ViewComponents for Rails applications.

10|1|Updated Dec 20, 2025
One-click install
npx skills add https://github.com/Kaakati/rails-enterprise-dev --skill viewcomponents-specialist
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ViewComponents Specialist
Source: https://github.com/Kaakati/rails-enterprise-dev/tree/main/plugins/rails-enterprise-dev/skills/viewcomponents-specialist
Command: npx skills add https://github.com/Kaakati/rails-enterprise-dev --skill viewcomponents-specialist

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Expert guidance on building and testing ViewComponents, ensuring proper method exposure and delegation.

Core Features & Use Cases

  • Pre-work protocol, verification steps
  • Component creation checklist and patterns
  • Slot usage, previews, and delegation examples

Quick Start

Create a simple component and wire a wrapper service to expose methods to the view.

Frequently Asked Questions about ViewComponents Specialist

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

FAQPage Schema
How do I create ViewComponents with proper slot implementation in Rails?

ViewComponents use slots to compose flexible, reusable UI patterns. Define slots in your component class, render them in the template, and pass content blocks from the view. Slots enable slot-based and inline template patterns while maintaining clean separation between logic and presentation.

What's the best way to expose service methods through a ViewComponent?

Use Service Wrapper pattern: delegate public methods from your service to the component via Ruby's `delegate` keyword, then access them in the template with the `helpers` prefix. This ensures proper method exposure and maintains functional requirements across component patterns.

How do I set up and debug ViewComponent previews?

Create preview files that instantiate components with sample data, then configure them in your Rails app to render in isolation. Previews let you test rendering logic, verify slot behavior, and debug component issues without a full page context.

What are the main ViewComponent patterns and when should I use each?

Simple components render static markup; Service Wrapper components delegate to business logic; Slot-based components compose content blocks; Inline Template components define views inline. Choose based on complexity, reusability, and whether you need slots or service integration.

Can I use ViewComponents with Rails helpers and why use the helpers prefix?

Yes. Access helpers via the `helpers` prefix to maintain consistent, scoped access and avoid naming conflicts. This enforces the pattern across all component methods and ensures proper delegation from services to the view layer.

What pre-work validation should I do before building a ViewComponent?

Run the component creation checklist: verify Rails version compatibility, confirm service interfaces if using Service Wrapper pattern, check slot requirements, and validate helper availability. Pre-work protocol catches issues before implementation.