vercel-composition-patterns

Refactor React component libraries into explicit variants and compound components.

Updated Jan 17, 2026
One-click install
npx skills add https://github.com/lDuang/mcp-skill-registry --skill vercel-composition-patterns-lduang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/lDuang/mcp-skill-registry/tree/main/skill/composition-patterns
Command: npx skills add https://github.com/lDuang/mcp-skill-registry --skill vercel-composition-patterns-lduang

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guide provides patterns to replace boolean props with explicit component variants and compound components, enabling scalable, maintainable React libraries.

Core Features & Use Cases

  • Explicit variants for common tasks (ThreadComposer, EditMessageComposer, ForwardMessageComposer) to avoid prop explosion.
  • Compound components with a shared context to avoid prop drilling.
  • Provider-based state management enabling UI reuse with different state backends.
  • Migration guidance for React 19 API patterns (use instead of useContext; regular props for ref).

Quick Start

Refactor a React component library to replace boolean props with explicit variant components and a shared provider.

Frequently Asked Questions about vercel-composition-patterns

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

FAQPage Schema
How do I scale React components without boolean prop proliferation?

You can resolve boolean prop proliferation in React by introducing explicit variant components and compound components, which standardizes your component library API and prevents prop explosion.

What is the best way to avoid prop drilling in a React design system?

The best way to avoid prop drilling in a React design system is using compound components with a shared context provider, enabling UI components to consume state, actions, and meta via a use-like contract.

How do I refactor React components to use context providers and render props?

Refactor React components by building a shared provider pattern and a context interface that exposes state, actions, and meta, allowing UI components to consume data through a use-like contract instead of prop drilling.

Does this React composition pattern work with React 19 API updates?

Yes, the composition pattern supports React 19 API updates by migrating context consumption to the use hook instead of useContext and passing regular props for ref.

When should I use explicit variants instead of boolean props in React?

Use explicit variants instead of boolean props in React when building reusable component libraries that handle distinct tasks, preventing prop explosion and standardizing architecture through a shared provider pattern.