vercel-composition-patterns

Refactor React components into compound components with context providers.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guidance addresses the challenge of boolean prop proliferation in React components by promoting composition patterns that use compound components, lifted state, and context providers to create scalable, reusable APIs.

Core Features & Use Cases

  • Explicit, variant-driven component design that replaces scattered boolean props with dedicated components.
  • Shared-state via context providers and consumer components, reducing prop drilling and enabling UI fragments outside the main frame.
  • Guidelines for decoupling UI from state implementation and adopting React 19 APIs for cleaner context usage.

Quick Start

Create a basic Composer using a Provider to supply state and actions, then render a Frame with Input and a Footer containing Submit.

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 scattered conditional props with dedicated, explicit variant components. This composition pattern creates scalable, reusable APIs by structuring distinct visual states as separate components rather than configuring one monolithic component.

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

The best way to share state without prop drilling is lifting state into context providers. By decoupling UI from state implementation, context providers enable consumer components to access shared state and actions directly, even when rendered outside the main component frame.

How do I structure reusable React component libraries using composition?

Structure reusable React component libraries using compound components with shared context. This pattern pairs a Provider to supply state and actions with child components like Input or Submit, allowing flexible UI assembly while maintaining centralized state management.

Can I use React 19 APIs for cleaner context usage in compound components?

Yes, you can use React 19 APIs for cleaner context usage in compound components. The composition guidelines adhere to React 19 API standards, enabling generic context interfaces for dependency injection and streamlined state lifting into providers.

When should I not use compound components for React UI design?

You should not use compound components when building simple, single-use UI elements that lack shared state requirements. This pattern imposes requirements for explicit variants and generic context interfaces, adding structural overhead unnecessary for isolated, lightweight components.