vercel-composition-patterns

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

Updated Sep 6, 2026
One-click install
npx skills add https://github.com/inventashif/helpful-code-sidekick --skill vercel-composition-patterns-inventashif
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/inventashif/helpful-code-sidekick/tree/main/scripts/hackerai/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/inventashif/helpful-code-sidekick --skill vercel-composition-patterns-inventashif

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 guidance 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. - Dependency-Injectable State: Define generic context interfaces with state, actions, and meta so the same UI works with different state implementations. - React 19 API Guidance: Apply modern patterns like ref as a regular prop and use() instead of useContext or forwardRef. - Use Case: When refactoring a message composer that has grown to accept isThread, isEditing, and isDMThread props, apply these rules to split it into explicit ThreadComposer, EditComposer, and ChannelComposer variants sharing compound internals. ## Quick Start Refactor this React component to eliminate boolean props using compound components and a shared 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 exponential conditional states.

What are compound components in React?

Compound components are subcomponents sharing a common context, exported as a group like Composer.Frame, Composer.Input, and Composer.Submit. Consumers compose the pieces they need while each subcomponent accesses shared state via context instead of props.

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

Does React 19 still require forwardRef?

No, React 19 makes ref a regular prop, so forwardRef is unnecessary. The guidance also recommends use() instead of useContext(), which additionally supports conditional calls.

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

Lift state into a provider component so any descendant within the provider boundary can access state and actions via context. Sibling components like dialog buttons or previews can read and modify state without prop drilling or refs.