vercel-composition-patterns

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

Updated Sep 1, 2026
One-click install
npx skills add https://github.com/zamansepeti43/c-rak-agent --skill vercel-composition-patterns-zamansepeti43
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/zamansepeti43/c-rak-agent/tree/main/video-engine/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/zamansepeti43/c-rak-agent --skill vercel-composition-patterns-zamansepeti43

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 Management Patterns: Lift state into provider components and define generic context interfaces (state, actions, meta) for dependency injection. - React 19 Guidance: Apply modern APIs such as ref-as-prop and use() instead of forwardRef and useContext. - Use Case: When refactoring a messaging Composer component with many boolean flags, use this Skill to restructure it into ThreadComposer, EditComposer, and ForwardMessageComposer variants sharing a common context provider. ## Quick Start Ask the AI to refactor a React component that has too many boolean props using composition patterns from 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 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.

What are compound components in React?

Compound components are structured as a parent provider with subcomponents that access shared state via context instead of props. Consumers explicitly compose the pieces they need, eliminating hidden conditionals and prop drilling.

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 or state back to the child, such as rendering list items.

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.

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.