vercel-composition-patterns

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

Updated Sep 7, 2026
One-click install
npx skills add https://github.com/raphaelmans/spectralpointengineering --skill vercel-composition-patterns-raphaelmans
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/raphaelmans/spectralpointengineering/tree/main/.skillshare/skills/vercel-composition-patterns
Command: npx skills add https://github.com/raphaelmans/spectralpointengineering --skill vercel-composition-patterns-raphaelmans

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 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 backed by shared context. - State Lifting & Dependency Injection: Move state into provider components with generic state/actions/meta context interfaces so UI works with any state implementation. - React 19 API Guidance: Apply modern patterns such as ref as a regular prop and use() instead of useContext or forwardRef. - Use Case: When refactoring a messaging Composer component that has grown to accept isThread, isEditing, and isForwarding props, apply these rules to split it into ThreadComposer, EditComposer, and ForwardMessageComposer variants sharing composed 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 declares exactly what it renders, eliminating exponential state combinations and hidden conditionals.

What are compound components in React?▼

Compound components are subcomponents sharing a common context, exported together (e.g., Composer.Frame, Composer.Input, Composer.Submit). Consumers compose only the pieces they need, and subcomponents access shared state via context instead of props.

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 must pass data back to the child, such as rendering list items with per-item data.

Does React 19 still require forwardRef?▼

No. In React 19, ref is a regular prop, so function components can accept ref directly without the forwardRef wrapper. The use() hook also replaces useContext() and can be called conditionally.

How do I share React state with components outside the main UI?▼

Lift state into a provider component that wraps the UI tree. Any component inside the provider boundary, even siblings outside the main component's visual frame, can access state and actions through context without prop drilling or refs.

When should I not use compound components?▼

Compound components add context and provider overhead, so they are unnecessary for simple components with few variations. They pay off when a component has multiple variants, shared state across subcomponents, or needs swappable state implementations.