vercel-composition-patterns

Refactor React component architectures to replace boolean props with compound components.

2|Updated Jan 30, 2026
One-click install
npx skills add https://github.com/LinXueyuanStdio/viben --skill vercel-composition-patterns-linxueyuanstdio
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/LinXueyuanStdio/viben/tree/main/.claude/skills/vercel-composition-patterns
Command: npx skills add https://github.com/LinXueyuanStdio/viben --skill vercel-composition-patterns-linxueyuanstdio

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It solves unmaintainable React component APIs caused by boolean prop proliferation and tangled state/UI responsibilities, making code harder to extend safely as features grow.

Core Features & Use Cases

  • Compound components with shared context: Replace monolithic components and prop drilling with a provider + composable subcomponents.
  • State lifted into providers: Share state/actions across sibling UI elements (not just inside one visual component boundary).
  • Explicit variants over boolean modes: Create self-documenting component variants that avoid impossible prop combinations.
  • Children-based composition and React 19 API guidance: Prefer children over render props where appropriate, and follow React 19 changes (use use() instead of useContext() and avoid forwardRef where possible).

Quick Start

Apply vercel-composition-patterns to your React codebase by redesigning components that use many boolean props into explicit variants that share state through a context provider.

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 boolean prop proliferation?

To eliminate boolean prop proliferation, refactor React components into explicit variants that share state through context providers. This approach replaces monolithic components with composable subcomponents, avoiding impossible prop combinations and making the API self-documenting.

What is the best way to share state across sibling UI elements in React 19?

The best way to share state across sibling UI elements in React 19 is by lifting state and actions into a context provider. This allows sibling components to access shared data without prop drilling, using the React 19 use() API instead of useContext().

How do compound components work with context providers?

Compound components work by combining a context provider with composable subcomponents. State is lifted into the provider, allowing sibling UI elements to share data and actions directly without prop drilling or tangled monolithic component boundaries.

When should I use explicit variants over boolean modes in React component architecture?

You should use explicit variants over boolean modes when your component API has many boolean props that create impossible combinations. Creating self-documenting variant components improves maintainability and makes the codebase safer to extend as features scale.

Does React 19 require forwardRef for component composition?

No, React 19 does not require forwardRef for component composition. You can treat ref as a regular prop. Additionally, React 19 introduces the use() API, which replaces useContext() for consuming context in compound components.

Can I use children-based composition instead of render props in React 19?

Yes, you can prefer children-based composition over render props where appropriate in React 19. This refactoring technique simplifies component APIs and improves maintainability by leveraging standard children passing alongside context providers.