vercel-composition-patterns

Refactor React components into compound structures with context providers.

Updated May 21, 2026
One-click install
npx skills add https://github.com/caiohbfurtado/apac-web --skill vercel-composition-patterns-caiohbfurtado
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/caiohbfurtado/apac-web/tree/main/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/caiohbfurtado/apac-web --skill vercel-composition-patterns-caiohbfurtado

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the common issue of unmaintainable React codebases caused by boolean prop proliferation, monolithic components, and tightly coupled state management.

Core Features & Use Cases

  • Compound Component Architecture: Structure complex UI into flexible, composable parts that share context.
  • State Decoupling: Isolate state management logic within providers to allow for dependency injection and easier testing.
  • React 19 Best Practices: Implement modern patterns like using the use hook instead of useContext and managing refs as standard props.
  • Use Case: Refactor a complex, boolean-heavy Composer component into a clean, compound-component structure that supports multiple variants like ThreadComposer and EditComposer without conditional logic.

Quick Start

Apply the vercel-composition-patterns skill to refactor the current component by replacing boolean props with compound components and lifting state into a 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 avoid boolean prop proliferation?

Refactor React components by replacing boolean props with compound components and lifting shared state into context providers. This architectural pattern isolates state management logic and eliminates conditional rendering, resulting in maintainable component variants.

What is the compound component pattern in React?

The compound component pattern structures complex UI into flexible, composable parts that share context. It decouples state management by isolating logic within providers, allowing for dependency injection and easier testing without monolithic component structures.

How do I manage shared state in a React component library?

Manage shared state in a React component library by isolating state management logic within context providers. This decoupling approach allows for dependency injection and easier testing while supporting flexible composition across multiple component variants.

Does this React composition pattern support React 19?

Yes, this composition pattern supports React 19 API compatibility by implementing modern practices like using the use hook instead of useContext and managing refs as standard props for scalable component architecture.

How do I structure multiple React component variants without conditional logic?

Structure multiple React component variants by applying compound component architecture to replace boolean-heavy conditional logic. Lifting state into a provider allows distinct variants like ThreadComposer and EditComposer to share context without conditional rendering branches.

Why does my React component have tightly coupled state management?

Tightly coupled state management in React components is caused by monolithic structures and boolean prop proliferation. Decouple this state by isolating logic within context providers to enable dependency injection and eliminate unmaintainable conditional logic.