vercel-composition-patterns

Refactor React boolean props into provider-backed compound components.

1|Updated Feb 22, 2026
One-click install
npx skills add https://github.com/SiddharthChillale/cloud-operations-reasoning-agent --skill vercel-composition-patterns-siddharthchillale
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/SiddharthChillale/cloud-operations-reasoning-agent/tree/main/skills/composition-patterns
Command: npx skills add https://github.com/SiddharthChillale/cloud-operations-reasoning-agent --skill vercel-composition-patterns-siddharthchillale

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guide addresses unmaintainable React components caused by boolean prop proliferation, tight coupling of UI to state implementations, and hidden conditional complexity. It helps teams design explicit, composable component APIs and provider-driven state boundaries so components remain reusable and predictable as codebases grow.

Core Features & Use Cases

  • Compound Components: Patterns for splitting complex UIs into Provider + subcomponents that share a typed context (state, actions, meta).
  • State as Dependency Injection: Define generic context interfaces so the same UI works with local, global, or synced state implementations.
  • Explicit Variants & Composition: Replace multi-mode boolean props with explicit variant components (ThreadComposer, EditComposer, ForwardComposer) to document behavior and avoid impossible states.
  • React 19 Notes: Guidance for React 19 API changes such as using use() instead of useContext() and treating ref as a regular prop.
  • Use Cases: Refactoring legacy components with many toggles, authoring a shared component library, and reviewing architecture during code health sprints.

Quick Start

Use the vercel-composition-patterns guidance to refactor a component that uses multiple boolean props into an explicit provider-backed compound component.

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 with too many boolean props?

To refactor React components with boolean prop proliferation, replace conditional toggles with explicit variant components and provider-backed contexts. This approach splits complex UIs into compound components, ensuring APIs remain predictable and maintainable as your codebase grows.

What is the compound component pattern in React?

The compound component pattern in React splits complex UIs into a Provider and subcomponents that share a typed context. This structure defines explicit state, actions, and meta interfaces, allowing state to act as dependency injection for flexible implementations.

How do I manage shared state boundaries in a React component library?

Manage shared state boundaries in a React component library by defining generic context interfaces as dependency injection. This allows identical UI components to function seamlessly with local, global, or synced state implementations without tight coupling.

Does this React composition pattern support React 19 API changes?

Yes, this React composition pattern supports React 19 API adjustments. It provides specific guidance for replacing useContext with use and treating ref as a regular prop, ensuring your explicit variants and provider-backed contexts remain compatible.

Why should I use explicit variant components instead of boolean props?

Use explicit variant components instead of boolean props to document behavior and avoid impossible states. Defining distinct components like ThreadComposer or EditComposer prevents hidden conditional complexity and eliminates tight coupling between UI and state implementations.

When should I not use boolean props for React component variants?

Avoid boolean props for React component variants when facing unmaintainable conditional complexity or tight coupling. If your codebase requires reusable and predictable components, boolean prop proliferation creates hidden states that should be replaced with composition.