vercel-composition-patterns

Guide React component variants and compound components to replace boolean props.

4|2|Updated Mar 6, 2026
One-click install
npx skills add https://github.com/hiimtrung/coder --skill vercel-composition-patterns-hiimtrung
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/hiimtrung/coder/tree/main/.agents/skills/composition-patterns
Command: npx skills add https://github.com/hiimtrung/coder --skill vercel-composition-patterns-hiimtrung

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Address the problem of boolean prop proliferation in React components by teaching teams to adopt explicit variant components and compound components, enabling scalable, maintainable UI libraries.

Core Features & Use Cases

  • Explicit variants (ThreadComposer, EditMessageComposer, ForwardMessageComposer) to document intent and reduce branching
  • Compound components with a shared context to avoid prop drilling and enable flexible composition
  • Context-driven state management and provider-based architecture aligned with React 19 patterns

Quick Start

Refactor a component library to replace boolean props with explicit variants, then compose using the provided providers and frame components.

Frequently Asked Questions about vercel-composition-patterns

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

FAQPage Schema
How do I stop boolean prop proliferation in React components?

Boolean prop proliferation occurs when a single React component handles too many mutually exclusive states. Refactor it by replacing conditional flags with explicit variant components like ThreadComposer or EditMessageComposer to document intent and reduce internal branching.

What is the best way to build scalable React UI libraries with compound components?

The best way to build scalable React UI libraries is using compound components sharing a single context. This avoids prop drilling, enables flexible composition, and decouples state via provider-based architecture aligned with React 19 patterns.

How do I refactor React components to use context-driven state management?

Refactor React components to use context-driven state management by wrapping compound components in a shared provider. This decouples internal state from the UI, prevents prop drilling, and aligns with generic context interfaces in React 19.

When should I use explicit component variants instead of boolean props?

Use explicit component variants instead of boolean props when building design systems or UI libraries that require scalable, reusable building blocks. Variants clearly document component intent and prevent complex conditional rendering across projects.

Does this React composition pattern work with React 19 context APIs?

Yes, this composition pattern works with React 19 context APIs. It targets generic context interfaces and provider-based architecture, ensuring decoupled state management aligns directly with React 19 API patterns for UI libraries.