vercel-composition-patterns

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

Updated Jul 16, 2026
One-click install
npx skills add https://github.com/X-manist/Cohmira --skill vercel-composition-patterns-x-manist
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/X-manist/Cohmira/tree/main/src/builtin-plugins/openmontage/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/X-manist/Cohmira --skill vercel-composition-patterns-x-manist

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? React components often accumulate boolean props like isThread or isEditing, creating 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 - Boolean Prop Elimination: Replace prop proliferation with explicit component variants and compound components sharing context. - State Lifting & Dependency Injection: Move state into provider components with generic state/actions/meta interfaces so UI works with any state implementation. - React 19 Guidance: Apply modern APIs such as ref-as-prop and use() instead of forwardRef and useContext. - Use Case: When refactoring a Composer component overloaded with conditional flags, apply these rules to split it into ThreadComposer, EditComposer, and ForwardMessageComposer variants sharing a common context provider. ## Quick Start Ask the agent to refactor a React component that has too many boolean props using the composition patterns in this 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 a React component with too many boolean props?

Replace boolean props with explicit variant components that compose shared internals. Create separate components like ThreadComposer or EditComposer, each composing only the pieces it needs from a compound component structure.

What are compound components in React?

Compound components are a pattern where a parent component and its subcomponents share state through context rather than props. Consumers compose the exact pieces they need, such as Composer.Frame, Composer.Input, and Composer.Submit, without hidden conditionals.

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 needs to pass data back to the child, such as rendering list items.

Does forwardRef still work in React 19?

In React 19, ref is a regular prop, so forwardRef is no longer needed. You can accept ref directly in the component's props and pass it to the underlying element.

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.