vercel-composition-patterns

Refactors React components using compound components, context providers, and composition patterns.

Updated Jan 9, 2026
One-click install
npx skills add https://github.com/amitpo23/cfo --skill vercel-composition-patterns-amitpo23
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/amitpo23/cfo/tree/main/.cursor/skills/vercel-composition-patterns
Command: npx skills add https://github.com/amitpo23/cfo --skill vercel-composition-patterns-amitpo23

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? React components accumulate boolean props like isThread, isEditing, and isDMThread as features grow, creating exponential state combinations, hidden conditionals, and unmaintainable code. This Skill provides concrete refactoring patterns to replace prop proliferation with composition. ## Core Features & Use Cases - Compound Component Architecture: Structure complex components with shared context so consumers compose exactly the pieces they need without prop drilling. - Dependency-Injectable State: Define generic context interfaces (state, actions, meta) so the same UI works with local useState, Zustand, or server-synced providers. - React 19 API Guidance: Replace forwardRef with ref-as-prop and useContext with the use() hook for React 19 codebases. - Use Case: When refactoring a message composer that has grown to six boolean props, apply these patterns to split it into explicit ThreadComposer, EditComposer, and ForwardComposer variants sharing compound internals. ## Quick Start Refactor this React component to eliminate its boolean props using compound components and a lifted context provider.

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 that compose shared internals. Each variant like ThreadComposer or EditComposer declares exactly what it renders, eliminating hidden conditionals and impossible states.

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?

Use children for 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.

Does forwardRef still work in React 19?

React 19 makes ref a regular prop, so forwardRef wrappers are no longer needed. You can accept ref directly in the function signature, and use() replaces useContext() for reading context, including conditionally.

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

Lift state into a provider component that wraps the siblings in a shared context. Components anywhere inside the provider boundary can read state and call actions, even if they are not visually nested inside the main UI.