vercel-composition-patterns

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

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

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 rules for replacing prop proliferation with composition, making component codebases easier to maintain and extend. ## Core Features & Use Cases - Boolean Prop Elimination: Replace boolean prop modes with explicit component variants and compound components sharing context. - State Lifting & Dependency Injection: Define generic context interfaces (state, actions, meta) so the same UI works with different state implementations like local useState or global synced stores. - React 19 API Guidance: Apply modern patterns such as ref-as-prop and use() instead of forwardRef and useContext(). - Use Case: When refactoring a message composer that has grown to accept isThread, isEditing, and isForwarding props, use these rules to split it into explicit ThreadComposer, EditComposer, and ForwardComposer variants sharing compound component internals. ## Quick Start Ask the AI to refactor a React component with many boolean props into compound components using the composition patterns rules.

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 explicit component variants that compose shared internals. Create separate components like ThreadComposer or EditComposer, each composing only the pieces it needs from a compound component structure, eliminating hidden conditionals.

What are compound components in React?

Compound components are a pattern where a parent component shares state with subcomponents through context rather than props. Consumers compose pieces like Composer.Frame, Composer.Input, and Composer.Submit explicitly, accessing shared state via context.

Should I use children or render props for React composition?

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

Does React 19 still require forwardRef?

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

How do I share React state with components outside the main UI?

Lift state into a provider component that wraps the UI tree. Any component inside the provider boundary, even siblings outside the main component frame, can access state and actions through context without prop drilling or refs.

When should I not use compound components?

Compound components add indirection that may be unnecessary for simple, single-purpose components with few variants. The patterns target complex components with multiple modes or shared state across sibling UI elements.