vercel-composition-patterns

Refactor React 19+ component libraries using compound components and context providers.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/CodeStorm-Hub/stormcomui --skill vercel-composition-patterns-codestorm-hub
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/CodeStorm-Hub/stormcomui/tree/main/.opencode/skills/vercel-composition-patterns
Command: npx skills add https://github.com/CodeStorm-Hub/stormcomui --skill vercel-composition-patterns-codestorm-hub

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Composition patterns address boolean prop proliferation by enabling scalable, reusable React APIs using compound components, state lifting, and context providers.

Core Features & Use Cases

  • Explicit variants: replace boolean props with dedicated variant components to improve clarity and maintainability.
  • Compound components with shared context: compose UI from independent pieces that share state via a provider.
  • Context-driven state management and React 19 API guidance (use() over useContext, no forwardRef wrappers) to future-proof codebases.

Quick Start

Refactor a component library by introducing explicit variant components and a provider-based pattern to enable scalable composition.

Frequently Asked Questions about vercel-composition-patterns

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

FAQPage Schema
How do I fix boolean prop proliferation in my React component library?

Resolve boolean prop proliferation by replacing conditional props with explicit variant components. This refactoring approach improves API clarity and maintainability by ensuring each component variant handles its own logic independently without complex boolean combinations.

What is the best way to implement compound components with shared state in React 19?

Implement compound components with shared state by using context-driven state management and context providers. This pattern allows independent UI pieces to compose together while seamlessly sharing state through a centralized provider without excessive prop drilling.

Does this React composition pattern use the use() hook instead of useContext?

Yes, the React 19 composition pattern enforces using the use() hook over useContext and removes forwardRef wrappers. This future-proofs your codebase by adopting the latest React 19 API standards for context consumption and ref management.

How do I refactor a monolithic React component into explicit variants?

Refactor a monolithic React component into explicit variants by introducing dedicated variant components and a provider-based pattern. This enables scalable composition by separating distinct UI configurations into independent, reusable elements sharing context.

When should I use render props and context providers over standard React props?

Use render props and context providers over standard props when building reusable APIs that require scalable React component composition. These patterns solve complex state sharing needs that exceed standard prop drilling capabilities in large libraries.