vercel-composition-patterns

Replace boolean prop families with explicit composition patterns in React components.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The patterns help teams avoid boolean prop proliferation and fragile component APIs by teaching structured composition, explicit variants, and shared state via providers.

Core Features & Use Cases

  • Explicit variant components that replace boolean flags (e.g., ThreadComposer, EditMessageComposer) to improve clarity and maintainability.
  • Compound components with a shared context to avoid prop drilling and enable flexible composition.
  • Lifted state in providers to enable cross-cut UI access and reuse across data sources.
  • Guidance for integrating with React 19 APIs (use() instead of useContext, ref as a regular prop).

Quick Start

To begin, wrap your UI in a provider and compose using explicit variant components (e.g., ThreadComposer, EditMessageComposer).

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 explosion in React components?

To avoid boolean prop explosion in React components, replace boolean flags with explicit variant components like ThreadComposer or EditMessageComposer. This structured composition pattern prevents fragile APIs and combinatorial explosion by making each state an explicit, maintainable component.

What is the best way to share state across React components without prop drilling?

The best way to share state across React components without prop drilling is lifting state into providers and using compound components with a shared context. This allows cross-cutting UI access and reuse across various data sources without passing props manually.

Can I use React 19 APIs like use() with composition patterns?

Yes, you can use React 19 APIs with composition patterns. The approach integrates React 19 guidance by using the use() hook instead of useContext for reading contexts and treating ref as a regular prop, ensuring your component libraries remain compatible with modern React features.

When should I build explicit variant components instead of using boolean flags?

You should build explicit variant components instead of using boolean flags when developing scalable component libraries, UI kits, or design systems. If your component API suffers from combinatorial explosion due to multiple interacting true/false states, explicit variants provide necessary clarity and maintainability.

How do I make my React contexts generic for scalable UI kits?

To make React contexts generic for scalable UI kits, lift state into providers and ensure your contexts are generic enough to enable cross-cutting UI access. This allows shared state to be reused seamlessly across different data sources within your design system.