vercel-composition-patterns

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

Updated Aug 6, 2026
One-click install
npx skills add https://github.com/ferrarifankid04/ai-skills-public --skill vercel-composition-patterns-ferrarifankid04
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/ferrarifankid04/ai-skills-public/tree/main/claude-code/skills/vercel-composition-patterns
Command: npx skills add https://github.com/ferrarifankid04/ai-skills-public --skill vercel-composition-patterns-ferrarifankid04

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 patterns that scale. ## 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 any provider implementation. - React 19 API Guidance: Apply modern patterns like ref-as-prop and use() instead of forwardRef and useContext. - Use Case: When refactoring a Composer component overloaded with boolean flags, apply these rules to split it into explicit variants like ThreadComposer and EditComposer that share internals through a common context. ## Quick Start Ask the AI to refactor a React component with many boolean props using the composition patterns from 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 compound component structure, eliminating conditional logic and impossible states.

What are compound components in React?

Compound components are a pattern where a parent component and its subcomponents share state through context rather than props. Consumers compose pieces like Composer.Frame, Composer.Input, and Composer.Submit explicitly, accessing shared state via use(ComposerContext).

Should I use children or render props for React composition?

Prefer children for composing static structure since 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 per-item data.

Does forwardRef still work in React 19?

React 19 makes ref a regular prop, so forwardRef is no longer needed. You can accept ref directly in function component props, and use() replaces useContext() for reading context, with the added benefit of conditional calls.

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

Lift state into a provider component that wraps the entire subtree. Any component within the provider boundary, even siblings outside the visual component frame, can access state and actions through context without prop drilling or refs.