vercel-composition-patterns

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

1|Updated May 6, 2026
One-click install
npx skills add https://github.com/surfingalien/FinSurfing --skill vercel-composition-patterns-surfingalien
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/surfingalien/FinSurfing/tree/main/.claude/skills/vercel-composition-patterns
Command: npx skills add https://github.com/surfingalien/FinSurfing --skill vercel-composition-patterns-surfingalien

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, making component codebases easier to maintain and extend. ## Core Features & Use Cases - Boolean Prop Elimination: Replace boolean prop modes with explicit variant components 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: Covers React 19 API changes including ref as a regular prop and use() replacing useContext(). - Use Case: When refactoring a message composer component with flags like isThread, isEditing, and isForwarding, apply these rules to split it into explicit ThreadComposer, EditComposer, and ForwardComposer variants sharing compound component internals. ## Quick Start Ask the AI 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 React components with too many boolean props?

Replace boolean props with explicit variant components that compose shared internals. Each variant like ThreadComposer or EditComposer composes only the pieces it needs from a compound component, 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.

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 with item data.

Does forwardRef still work in React 19?

In React 19, ref is a regular prop so forwardRef is no longer needed. The use() hook also replaces useContext() and can be called conditionally. These rules only apply to React 19 or later, not React 18.

When should state be lifted 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, since any component within the provider boundary can consume the context.