vercel-composition-patterns

Refactor React components into compound variants with context providers.

Updated Apr 22, 2026
One-click install
npx skills add https://github.com/wixels/sab-colour-profile --skill vercel-composition-patterns-wixels
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/wixels/sab-colour-profile/tree/main/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/wixels/sab-colour-profile --skill vercel-composition-patterns-wixels

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the common pain point of React components becoming unmaintainable as codebases scale, caused by excessive boolean prop proliferation, messy conditional logic, and inflexible component APIs that are hard to refactor or reuse.

Core Features & Use Cases

  • Avoid Boolean Prop Proliferation: Replace toggle props like isThread or isEditing with explicit, self-documenting component variants to eliminate exponential state complexity.
  • Compound Component Patterns: Build flexible, reusable UI components with shared context, enabling composition without prop drilling or monolithic parent components.
  • Dependency-Injectable State: Lift state into provider components to decouple UI from state implementation, allowing the same UI components to work with local, global, or server-synced state.
  • React 19 Best Practices: Guidance on using modern React 19 APIs like use() instead of useContext() and ref as a regular prop instead of forwardRef.
  • Use Case Example: When building a shared message composer component for a chat app, use these patterns to create separate ThreadComposer, EditComposer, and ForwardMessageComposer variants that share internal UI pieces but have distinct behaviors and state requirements.

Quick Start

Ask the AI to refactor your existing React Composer component that uses multiple boolean props like isThread, isEditing, and isDMThread into explicit compound component variants following the vercel-composition-patterns guidelines.

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?

Avoid React boolean prop proliferation by replacing toggle variables like isEditing with explicit, self-documenting component variants. This refactoring eliminates exponential state complexity and messy conditional logic, resulting in maintainable and flexible reusable UI APIs.

What is the compound component pattern in React?

The compound component pattern in React builds flexible, reusable UI components with shared context. It enables component composition without prop drilling or monolithic parent designs, allowing internal UI pieces to share state while maintaining distinct behaviors.

How do I manage shared state in a React component library without prop drilling?

Manage shared state in a React component library by lifting state into context provider components. This dependency-injectable state decouples UI from state implementation, allowing identical UI components to function with local, global, or server-synced state without prop drilling.

Does this React refactoring approach work with React 19 APIs?

Yes, this React refactoring approach works with React 19 APIs by providing specific best practices. It guides developers to use modern React 19 features like use() instead of useContext() and treat ref as a regular prop instead of using forwardRef.

When should I split a monolithic React component into variants?

Split a monolithic React component into variants when excessive toggle props create unmaintainable conditional logic. For example, separate a chat message composer into ThreadComposer, EditComposer, and ForwardMessageComposer variants that share internal UI pieces but maintain distinct state requirements.