vercel-composition-patterns

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

Updated Apr 16, 2026
One-click install
npx skills add https://github.com/quangtuyennguyen/loan-application-workflow --skill vercel-composition-patterns-quangtuyennguyen
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/quangtuyennguyen/loan-application-workflow/tree/main/.claude/skills/vercel-composition-patterns
Command: npx skills add https://github.com/quangtuyennguyen/loan-application-workflow --skill vercel-composition-patterns-quangtuyennguyen

SYSTEM DOCUMENTATION & REQUIREMENTS

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 patterns that scale. ## Core Features & Use Cases - Compound Component Architecture: Structure complex components with shared context so subcomponents access state without prop drilling. - State Lifting & Dependency Injection: Define generic context interfaces (state, actions, meta) so the same UI works with different state implementations like useState or Zustand. - React 19 API Guidance: Apply modern patterns such as ref-as-prop and use() instead of forwardRef and useContext. - Use Case: When refactoring a messaging composer that has grown to handle threads, edits, and forwards via boolean flags, apply these rules to split it into explicit variant components sharing composed internals. ## Quick Start Ask the AI to refactor a React component with 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 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 common context provider, eliminating conditional logic and impossible states.

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 compose exactly the pieces they need, such as Composer.Frame, Composer.Input, and Composer.Submit, without hidden conditionals.

When should I use children instead of render props in React?▼

Use children when composing static structure because they are more readable and compose naturally. Reserve render props for cases where 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 makes ref a regular prop, so forwardRef is unnecessary. The guidance also replaces useContext with the use() hook, which can additionally be called conditionally unlike useContext.

How do I share React state between sibling components without prop drilling?▼

Lift state into a dedicated provider component that wraps the siblings. Any component inside the provider boundary can access state and actions through context, even if it is not visually nested inside the main UI.