vercel-composition-patterns

Refactor React components into compound variants with context-backed state.

1|2|Updated Apr 13, 2026
One-click install
npx skills add https://github.com/jgwill/dotagents --skill vercel-composition-patterns-jgwill
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/jgwill/dotagents/tree/main/skills/vercel-composition-patterns
Command: npx skills add https://github.com/jgwill/dotagents --skill vercel-composition-patterns-jgwill

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It solves the maintainability collapse caused by boolean prop proliferation and hidden conditional UI logic in growing React component codebases.

Core Features & Use Cases

  • Compound component architecture with shared context: Build flexible component libraries where subcomponents consume shared state via context instead of prop drilling.
  • Lifted state into provider components: Move state management out of leaf UI components so sibling and external UI can read and trigger actions cleanly.
  • Explicit component variants: Replace “one component + many booleans” with clear, self-documenting variant components that include the right providers and UI pieces.
  • React 19+ API alignment: Use use() instead of useContext() and treat ref as a regular prop as required by React 19.

Quick Start

Use vercel-composition-patterns to refactor a React component that currently uses multiple boolean props into explicit compound variants with context-backed state management.

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 boolean prop proliferation?

To avoid boolean prop proliferation, refactor React components into explicit compound component variants backed by context providers, replacing hidden conditional logic with composable children-based architecture.

What is the compound component pattern in React and when should I use it?

The compound component pattern in React builds flexible component libraries where subcomponents consume shared state via context instead of prop drilling. Use it when growing UIs suffer from hidden conditional rendering and maintainability collapse.

How do I lift state into provider components for sibling access in React?

Lifting state into provider components moves state management out of leaf UI components into context boundaries, allowing sibling and external UI components to read state and trigger actions cleanly without prop drilling.

Does this React refactoring approach work with React 19 APIs like use() and ref-as-prop?

Yes, the React refactoring approach aligns with React 19+ APIs by replacing useContext() with the use() hook and treating ref as a regular prop, ensuring context-injected state and action contracts remain compatible.

What's the best way to handle edit, thread, and forward modes without boolean props?

The best way to handle edit, thread, and forward modes without boolean props is creating explicit variant components wrapped in the correct providers and UI pieces, ensuring self-documenting composition over hidden conditional rendering.

When should I not use compound components for React state management?

Avoid compound components for React state management when the UI logic is simple enough that context boundaries and provider wrappers would introduce unnecessary abstraction overhead compared to straightforward prop passing.