vercel-composition-patterns

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

Updated May 22, 2026
One-click install
npx skills add https://github.com/viniciuscs84/sdd-toolkit --skill vercel-composition-patterns-viniciuscs84
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/viniciuscs84/sdd-toolkit/tree/main/skills/vercel-composition-patterns
Command: npx skills add https://github.com/viniciuscs84/sdd-toolkit --skill vercel-composition-patterns-viniciuscs84

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. ## 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 different state implementations like useState or Zustand. - React 19 API Guidance: Apply modern patterns such as ref as a regular prop and use() instead of 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 compound internals. ## Quick Start Ask the AI to refactor a React component with many boolean props using the composition rules 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 composition by creating explicit variant components like ThreadComposer or EditComposer. Each variant composes shared compound components such as Composer.Frame, Composer.Input, and Composer.Footer, eliminating conditional logic.

What are compound components in React?

Compound components are a pattern where a parent component and its subcomponents share state through context instead of props. Consumers compose the pieces they need, such as Composer.Input and Composer.Submit, without hidden conditionals or prop drilling.

When should I use children instead of render props in React?

Use children when 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 with per-item data.

Does React 19 still require forwardRef?

No, React 19 makes ref a regular prop, so forwardRef is no longer needed. The skill also recommends using the use() hook 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 that wraps the UI tree. Any component inside the provider boundary, even siblings outside the visual component, can access state and actions through context without prop drilling or refs.