vercel-composition-patterns

Refactors React 19 component APIs into compound structures with shared context.

Updated Nov 1, 2025
One-click install
npx skills add https://github.com/mhfed/portfolio-2025 --skill vercel-composition-patterns-mhfed
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/mhfed/portfolio-2025/tree/main/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/mhfed/portfolio-2025 --skill vercel-composition-patterns-mhfed

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you refactor and design React components that are easier to maintain by removing boolean prop sprawl, reducing hidden state combinations, and making component behavior explicit.

Core Features & Use Cases

  • Compound component architecture: Break large UI pieces into composable subcomponents that share state through context.
  • State provider patterns: Lift state into provider components so sibling UI can read and update shared data without prop drilling.
  • Explicit variants over boolean modes: Replace ambiguous multi-flag component APIs with clear, self-documenting variants.
  • React 19 guidance: Apply modern APIs such as using ref as a prop and use() for context access.
  • Use case: A team can convert a complex composer, dialog, or form component into a reusable API where headers, footers, actions, and previews can be assembled independently.

Quick Start

Use this skill to review a React component with multiple boolean props and rewrite it into explicit compound components with a provider-driven state interface.

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?

Refactor React components by replacing ambiguous boolean flags with explicit compound components and provider-based state management. This approach makes component behavior self-documenting and eliminates hidden conditional rendering logic.

What is the best way to share state across React components without prop drilling?

The best way to share state without prop drilling is implementing state provider patterns. Lift state into provider components using shared context contracts with state, actions, and meta, allowing sibling UI components to read and update shared data independently.

How do I build composable React APIs for reusable UI libraries?

Build composable React APIs by adopting compound component architecture. Break large UI pieces into subcomponents that share state through context, allowing headers, footers, and actions to be assembled independently without rigid prop dependencies.

Does this React composition pattern work with React 19?

Yes, this composition pattern explicitly supports React 19 codebases. It applies modern APIs such as passing ref as a prop and using the use() hook for context access to design scalable component variants.

When should I replace boolean mode props with explicit variants?

Replace boolean mode props with explicit variants when your component API suffers from hidden state combinations. Converting ambiguous multi-flag interfaces into clear variants creates self-documenting APIs that are easier to maintain and scale.