vercel-composition-patterns

Refactor React components into compound components with explicit variants.

Updated Feb 15, 2026
One-click install
npx skills add https://github.com/ricable/mcai --skill vercel-composition-patterns-ricable
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/ricable/mcai/tree/main/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/ricable/mcai --skill vercel-composition-patterns-ricable

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you eliminate boolean prop overload, tangled rendering logic, and brittle one-off component APIs in React codebases. It gives you a clear way to redesign components so they are easier to reuse, easier to read, and easier to maintain as they grow.

Core Features & Use Cases

  • Compound component design: Split large UI surfaces into smaller pieces that share state through a provider and context.
  • Explicit component variants: Replace many boolean modes with clear, self-documenting variants such as thread, edit, or forward flows.
  • Children over render props: Prefer composable children for static structure and cleaner API design.
  • React 19 guidance: Update code to use ref as a normal prop and use in place of useContext when working with modern React patterns.
  • Use case: Refactor a messaging composer, dialog, or form-heavy dashboard component so custom actions, previews, and controls can share state without prop drilling.

Quick Start

Ask the skill to review a React component with boolean props and rewrite it into explicit variants and compound components with a provider-based context API.

Frequently Asked Questions about vercel-composition-patterns

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

FAQPage Schema
How do I refactor React components to remove boolean prop proliferation?

Refactor React components by replacing boolean prop proliferation with explicit variants and compound components. This approach uses a provider-based context API to share state, eliminating tangled rendering logic and creating cleaner, self-documenting component interfaces.

What is the best way to share state in a React UI library without prop drilling?

The best way to share state without prop drilling is using compound component design with a shared context interface. This pattern splits large UI surfaces into smaller pieces that access state, actions, and meta through an explicit provider boundary.

How do I update React context usage for React 19 patterns?

Update React context usage for React 19 by replacing useContext with the use hook and passing ref as a normal prop instead of using forwardRef. These modern patterns simplify component architecture and clean up ref handling in reusable UI libraries.

When should I use compound components instead of render props in React?

Use compound components instead of render props when you need composable children for static structure and a cleaner API design. Compound components provide explicit variants and provider-based context, making component architecture easier to read and maintain.

Can I use explicit variants to fix unclear React component APIs?

You can fix unclear React component APIs by replacing multiple boolean modes with explicit, self-documenting variants such as thread, edit, or forward flows. This clears up tangled rendering logic and makes custom actions and previews easier to reuse.