vercel-composition-patterns

Applies React composition patterns to refactor components with boolean prop proliferation.

Updated Mar 22, 2026
One-click install
npx skills add https://github.com/Ahmed-Eldalatony/airbnb-clone-bench --skill vercel-composition-patterns-ahmed-eldalatony
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/Ahmed-Eldalatony/airbnb-clone-bench/tree/main/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/Ahmed-Eldalatony/airbnb-clone-bench --skill vercel-composition-patterns-ahmed-eldalatony

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 rules for replacing prop-driven configuration with compound components, lifted state, and dependency-injected context. ## Core Features & Use Cases - Compound Component Architecture: Structure complex components with shared context so consumers compose exactly the pieces they need. - State Lifting and Dependency Injection: Define generic context interfaces (state, actions, meta) so the same UI works with local state, global stores, or server sync. - React 19 API Guidance: Replace forwardRef with ref-as-prop and useContext with the use() hook. - Use Case: When refactoring a message composer that has grown boolean props for thread, edit, and forward modes, apply these rules to split it into explicit ThreadComposer, EditComposer, and ForwardComposer variants sharing composed internals. ## Quick Start Ask the AI to refactor a React component that has too many boolean props using these composition patterns.

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 provides shared context and subcomponents access that state via context instead of props. Consumers compose pieces like Composer.Frame, Composer.Input, and Composer.Submit explicitly.

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?

React 19 makes ref a regular prop, so forwardRef wrappers are no longer needed. 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.