vercel-composition-patterns

Refactor React components into compound structures with explicit variants and lifted state using Context APIs.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you design and refactor React components so they stay flexible, readable, and maintainable as they grow. It is especially useful when boolean props, deep prop drilling, or one-size-fits-all component APIs are making UI code hard to extend.

Core Features & Use Cases

  • Compound Components: Break large components into composable parts that share state through context rather than props.
  • Lifted State: Move state into provider components so sibling UI, dialogs, previews, and action buttons can all participate cleanly.
  • Explicit Variants: Replace boolean mode flags with self-documenting components like ThreadComposer, EditMessageComposer, and ForwardMessageComposer.
  • Children Over Render Props: Prefer natural composition with children when building static UI structure.
  • React 19 Guidance: Update component patterns for modern React APIs, including ref as a regular prop and use() instead of useContext().
  • Use Case: Refactor a chat composer, form builder, or design-system component library that has grown too many flags into a clearer, dependency-injected composition model.

Quick Start

Ask me to refactor a React component or component library into compound components with lifted state, explicit variants, and React 19-compatible context patterns.

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 to avoid too many boolean props?

To refactor React components and avoid boolean prop proliferation, replace mode flags with explicit variants like ThreadComposer and EditMessageComposer, using compound components and context providers to share state without prop drilling.

What is the best way to use compound components with React 19 context?

The best way to use compound components in React 19 is injecting state through context providers and reading them with the use() hook instead of useContext(), allowing sibling UI parts to share state cleanly without prop bloat.

How do I replace render props with children composition in React?

To replace render props with children composition in React, prefer natural JSX children for static UI structure and lift shared state into context providers, eliminating deeply nested boolean flags and conditional rendering logic.

Why does my React design system have tangled conditional rendering?

Tangled conditional rendering in React design systems happens when single components handle too many modes via boolean props, which can be solved by refactoring into explicit variants and dependency-injected composition models.

Can I use context providers instead of prop drilling for sibling UI elements?

Yes, you can use context providers instead of prop drilling by lifting state into a provider component, allowing sibling dialogs, previews, and action buttons to participate cleanly in shared state without passing props deeply.

Does React 19 require forwardRef for passing refs to child components?

React 19 does not require forwardRef for passing refs to child components, as ref can now be passed as a regular prop, simplifying component architectures when refactoring to compound components and context-driven state.