vercel-composition-patterns

Refactor React components with boolean props into compound components using context.

2|Updated Dec 3, 2025
One-click install
npx skills add https://github.com/mfuentesg/capo-app --skill vercel-composition-patterns-mfuentesg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/mfuentesg/capo-app/tree/main/.copilot/skills/vercel-composition-patterns
Command: npx skills add https://github.com/mfuentesg/capo-app --skill vercel-composition-patterns-mfuentesg

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Complex React component APIs often suffer from boolean prop proliferation, fragile inheritance, and tangled render logic. This Skill provides scalable composition patterns to create flexible, maintainable component libraries.

Core Features & Use Cases

  • Use compound components to encapsulate related UI parts and share state via context.
  • Lift state to shared owners to avoid prop drilling and improve API clarity.
  • Design clear, extensible APIs that compose internals without leaking implementation details.
  • Real-world use: refactoring a Button/Modal family into a cohesive set of components with predictable behavior.

Quick Start

Refactor a component with boolean props into a parent component that exposes subcomponents and context-driven APIs.

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, apply scalable composition patterns like compound components and lifted state. This approach replaces fragile inheritance and tangled render logic with maintainable, extensible component architectures.

What is the compound components pattern in React?

The compound components pattern in React encapsulates related UI parts into separate subcomponents that share state via context. This allows you to compose internals predictably without leaking implementation details or requiring excessive prop drilling.

How do I refactor a React component to avoid prop drilling?

To refactor a React component and avoid prop drilling, lift state to shared owners and use contextual APIs. This design pattern improves API clarity by allowing subcomponents to access shared state without passing props through every layer.

When should I use composition patterns for React UI libraries?

Use composition patterns for React UI libraries when you need to design clear, extensible APIs that scale. They are specifically suited for design systems where maintainability and avoiding brittle, tangled component logic are primary concerns.

What's the best way to manage state in compound components?

The best way to manage state in compound components is lifting it to a shared owner and distributing it through React context. This prevents prop drilling while keeping the component architecture explicit and maintainable.