vercel-composition-patterns

Guides React component refactoring using compound components, context providers, and composition patterns.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? React components often accumulate boolean props like isThread or isEditing that create exponential state combinations and unmaintainable conditional logic. This Skill provides structured composition patterns to refactor such components into flexible, maintainable architectures. ## Core Features & Use Cases - Compound Component Patterns: Structure complex components with shared context so consumers compose exactly the pieces they need without prop drilling. - State Lifting and Dependency Injection: Move state into provider components with generic state/actions/meta interfaces, letting the same UI work with different state implementations. - React 19 API Guidance: Apply modern React 19 conventions such as ref as a regular prop and use() instead of useContext(). - Use Case: When refactoring a messaging Composer component overloaded with boolean flags, apply these rules to split it into explicit ThreadComposer, EditComposer, and ForwardMessageComposer variants sharing composed internals. ## Quick Start Ask the agent to refactor a React component that has too many boolean props using the composition patterns skill.

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 with too many boolean props?

Replace boolean props with composition by creating explicit variant components like ThreadComposer or EditComposer. Each variant composes shared subcomponents through a compound component structure, eliminating conditional logic and impossible states.

What are compound components in React?

Compound components are a pattern where a parent component shares state with its subcomponents through context rather than props. Consumers compose pieces like Composer.Frame, Composer.Input, and Composer.Submit explicitly, gaining flexible layouts without prop drilling.

Should I use children or render props for React composition?

Prefer children for composing static structure because they are more readable and compose naturally. Use render props only when the parent must pass data back to the child, such as rendering list items with per-item data.

Does React 19 still require forwardRef?

No, React 19 treats ref as a regular prop, so forwardRef wrappers are unnecessary. The use() hook also replaces useContext() and can be called conditionally, unlike useContext.

When should I lift state into a provider component?

Lift state into a provider when sibling components outside the main UI need access to that state or its actions. This avoids prop drilling, useEffect syncing, and ref-based workarounds while keeping UI decoupled from state implementation.