vercel-composition-patterns

Refactor React components using compound components, render props, and context providers.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Refactor React components to avoid boolean prop proliferation by adopting composition patterns that enable scalable, maintainable API design for reusable UI primitives.

Core Features & Use Cases

  • Use compound components with shared context to minimize prop drilling and enable flexible assembly.
  • Replace boolean flags with explicit variant components (ThreadComposer, EditMessageComposer, ForwardMessageComposer) for self-documenting code.
  • Decouple state management with providers to allow UI to remain UI-focused while data and behavior live in providers.
  • Align with React 19 APIs by adopting use() over useContext and treating ref as a regular prop.

Quick Start

Start by introducing explicit variant components (e.g., ThreadComposer, EditMessageComposer) to replace boolean flags in your UI.

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

Refactor React components by replacing boolean flags with explicit variant components like ThreadComposer or EditMessageComposer. This composition pattern creates self-documenting APIs, preventing prop drilling and keeping component logic maintainable as your UI primitives scale.

What is the compound components pattern in React and when should I use it?

The compound components pattern in React uses shared context to let flexible component assemblies manage state internally. Use it to minimize prop drilling and decouple UI focus from data logic, enabling robust and reusable component architectures.

How do I decouple state management from React UI components?

Decouple state management from React UI by moving data and behavior into context providers. This approach keeps your UI components focused purely on presentation while providers handle state, resulting in a modular architecture.

Does the use() hook replace useContext for React 19 context providers?

Yes, React 19 introduces the use() hook to replace useContext for reading context providers. Adopting use() aligns your composition patterns with modern React APIs, alongside treating ref as a regular prop for cleaner component design.

What is the best way to design scalable APIs for React UI libraries?

Design scalable React UI library APIs by applying composition patterns like explicit variants and provider-based state management. This avoids boolean prop complexity, enabling flexible assembly and self-documenting code for reusable primitives.

When should I avoid using boolean flags in React components?

Avoid boolean flags in React components when an API grows complex and requires multiple conditional behaviors. Replace them with explicit variant components to keep the code self-documenting, prevent prop drilling, and maintain a scalable architecture.