vercel-composition-patterns

Refactor React component APIs into compound components with provider-managed state.

Updated Mar 17, 2026
One-click install
npx skills add https://github.com/alexzhang1030/platform-demo --skill vercel-composition-patterns-alexzhang1030
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/alexzhang1030/platform-demo/tree/main/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/alexzhang1030/platform-demo --skill vercel-composition-patterns-alexzhang1030

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you refactor React components that have become hard to maintain because of boolean prop proliferation, tangled conditional rendering, and state that is trapped inside a single component.

Core Features & Use Cases

  • Compound component design: Break monolithic components into explicit building blocks that consumers compose directly.
  • Provider-based state sharing: Lift state into context providers so sibling UI can read and update shared state without prop drilling.
  • Generic context contracts: Standardize state, actions, and meta so multiple providers can drive the same UI.
  • Explicit variants: Replace many boolean modes with self-documenting component variants such as thread, edit, and forward flows.
  • React 19 guidance: Apply updated patterns for refs and context usage when working in React 19 and later.
  • Use case: Ideal for reviewing or redesigning design-system components, chat composers, toolbars, dialogs, and other reusable UI APIs that need flexible composition.

Quick Start

Ask the Skill to refactor a React component with too many boolean props into compound components with provider-managed state.

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

To eliminate boolean prop proliferation in React components, refactor monolithic APIs into compound components and lift shared state into context providers. This approach replaces tangled conditional rendering with explicit, composable building blocks that consumers assemble directly.

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

The best way to share state across sibling UI components without prop drilling is lifting state into context providers. Define standardized state, actions, and meta context contracts so multiple providers can drive the same UI elements seamlessly.

When should I use compound components instead of render props in React?

You should use compound components instead of render props when you need flexible UI composition without rigid API structures. Composing children directly provides a cleaner, more self-documenting API compared to render props, especially for design-system components.

Does this React composition approach work with React 19 ref and use APIs?

Yes, this composition approach works with React 19 by applying updated patterns for refs and context usage. It provides specific guidance for leveraging the React 19 ref and use APIs when refactoring reusable component libraries and design-system elements.

How do I replace boolean mode props with explicit variants in a design system?

To replace boolean mode props with explicit variants in a design system, refactor rigid UI modes into self-documenting component variants such as thread, edit, and forward flows. This creates clear, distinct component APIs instead of relying on tangled conditional rendering.