vercel-composition-patterns

Define and apply scalable React composition patterns to reduce boolean prop proliferation.

8|1|Updated Jul 7, 2025
One-click install
npx skills add https://github.com/dasheck0/qraft-templates --skill vercel-composition-patterns-dasheck0
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/dasheck0/qraft-templates/tree/main/opencode/skills/composition-patterns
Command: npx skills add https://github.com/dasheck0/qraft-templates --skill vercel-composition-patterns-dasheck0

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

React composition patterns that scale. Use when refactoring components with boolean prop proliferation, building flexible component libraries, or designing reusable APIs. Triggers on tasks involving compound components, render props, context providers, or component architecture. Includes React 19 API changes.

Core Features & Use Cases

  • Patterns for building flexible, maintainable React components using composition (compound components, lifting state, and internal composition).
  • Guidance on addressing boolean-prop proliferation and designing reusable APIs across teams.
  • Real-world scenarios include refactoring large component libraries and implementing explicit variant components.

Quick Start

Use explicit variant components (ThreadComposer, EditMessageComposer, ForwardMessageComposer) with dedicated providers and the shared Composer pieces.

Frequently Asked Questions about vercel-composition-patterns

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

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

To reduce boolean prop proliferation in React components, replace conditional flags with explicit variant components like ThreadComposer or EditMessageComposer. Combined with shared context interfaces and dedicated providers, this approach keeps UI elements decoupled from state implementations.

What are compound components and how do they help build reusable React libraries?

Compound components form a React composition pattern where parent and child elements share state via context providers. This structure helps build reusable React libraries by creating flexible APIs, preventing prop drilling, and maintaining decoupled architecture across complex projects.

How do I refactor a React component to use explicit variants and context providers?

Refactor React components into explicit variants by lifting state into context providers and defining a shared context interface. Replace boolean props with dedicated variant components to ensure UI elements remain decoupled from state implementations across the refactored architecture.

Do React composition patterns change with the React 19 API?

React composition patterns accommodate React 19 API changes when applying context providers, explicit variants, and compound components. The methodology enforces lifting state into providers and using shared context interfaces, keeping components decoupled from state implementations in React 19.

When should I use render props versus context providers for React state management?

Use context providers for React state management when lifting shared state to keep UI components decoupled, and apply render props for flexible rendering logic within composition patterns. Both techniques reduce boolean prop proliferation and support compound component architectures.

What is the best way to decouple React UI components from state implementations?

The best way to decouple React UI components from state implementations is lifting state into context providers and using a shared context interface. This composition pattern ensures UI components remain decoupled while reducing boolean prop proliferation across explicit variants.