vercel-composition-patterns

Replace boolean props with explicit variant components and shared context providers in React.

Updated Apr 6, 2026
One-click install
npx skills add https://github.com/alexwox/genesis-template --skill vercel-composition-patterns-alexwox
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/alexwox/genesis-template/tree/main/.cursor/skills/composition-patterns
Command: npx skills add https://github.com/alexwox/genesis-template --skill vercel-composition-patterns-alexwox

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Composition complexity in React often grows from boolean prop proliferation, leading to brittle, hard-to-maintain components. This Skill guides teams toward explicit variants, compound components, and context-driven state sharing to create scalable libraries and APIs.

Core Features & Use Cases

  • Avoid boolean prop proliferation by replacing boolean flags with explicit variant components (e.g., ThreadComposer, EditMessageComposer, ForwardMessageComposer).
  • Enable UI composition through shared context providers, allowing state to be lifted and shared across decoupled components.
  • Leverage React 19 APIs (use instead of useContext, and ref as a normal prop) to simplify context usage and component definitions.

Quick Start

Replace boolean-driven components with explicit variants and wrap your UI with a Provider to share state via context.

Frequently Asked Questions about vercel-composition-patterns

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

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

To avoid boolean prop proliferation in React components, replace boolean flags with explicit variant components like ThreadComposer or EditMessageComposer. This pattern creates distinct, maintainable component APIs instead of brittle logic driven by multiple overlapping true or false conditions.

What is the best way to share state across decoupled React components?

The best way to share state across decoupled React components is using context-driven state sharing. By wrapping your UI in shared context providers, you can lift and distribute state without prop drilling, enabling flexible UI composition through compound components.

How do I use React 19 use() for context access?

To use React 19 use() for context access, replace the standard useContext hook with the use() API. This simplifies context usage within your component definitions and allows more flexible integration of context-driven state sharing in your React applications.

When should I use compound components in my React library?

You should use compound components in your React library when you need scalable UI composition and explicit variant components. This architecture pattern prevents brittle component APIs by allowing state to be lifted and shared across decoupled components via context providers.

Why does my React component API become brittle with multiple boolean flags?

Your React component API becomes brittle with multiple boolean flags because boolean prop proliferation leads to complex and unpredictable component states. Replacing boolean flags with explicit variant components solves this issue by promoting clear, distinct component definitions.