vercel-composition-patterns

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Prevents React component APIs from becoming unmaintainable as complexity grows, especially when boolean props, conditional rendering, and tight state coupling start multiplying variants and making code harder to reason about.

Core Features & Use Cases

  • Avoid boolean prop proliferation by replacing “mode” booleans with composition-based, explicit variants.
  • Build compound components with shared context so consumers compose only the parts they need without prop drilling.
  • Lift and inject state via provider boundaries using a generic context contract (state, actions, meta) so UI stays decoupled from implementation.
  • Use React 19+ API guidance by preferring use() over useContext() and treating ref as a regular prop instead of using forwardRef.

Quick Start

Ask the AI to refactor your existing React component(s) by removing boolean props, introducing explicit variant components, and restructuring shared state into a provider-backed compound component API (React 19+).

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 mode booleans with explicit, composition-based variant components. This reduces conditional complexity and prevents unmaintainable variant multiplication in scalable component libraries.

What is the best way to manage shared state in compound components without prop drilling?

The best way to manage shared state in compound components without prop drilling is lifting state into context provider boundaries. Using a generic context contract for state, actions, and meta keeps the UI decoupled from implementation details.

Does this React component refactoring approach work with React 19?

Yes, this React component refactoring approach works with React 19 and leverages its new APIs. It enforces React 19+ usage rules by preferring the use() hook over useContext() and treating ref as a regular prop instead of using forwardRef.

How do I refactor a React component to use dependency-injected state?

To refactor a React component to use dependency-injected state, restructure shared state into a provider-backed compound component API. This involves defining generic state, action, and meta context contracts within provider boundaries to decouple UI from state implementation.

When should I use compound components with shared context?

You should use compound components with shared context when your React component APIs become unmaintainable due to tight state coupling and multiplying variants. This pattern allows consumers to compose only the parts they need without prop drilling.