vercel-composition-patterns

Refactor React components using composition, compound components, and context providers.

182|28|Updated Nov 29, 2025
One-click install
npx skills add https://github.com/julianromli/ai-skills --skill vercel-composition-patterns-julianromli
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/julianromli/ai-skills/tree/main/skills/composition-patterns
Command: npx skills add https://github.com/julianromli/ai-skills --skill vercel-composition-patterns-julianromli

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Refactor complex React components to avoid boolean prop proliferation by adopting composition, compound components, and context-driven APIs, enabling scalable, reusable UI patterns.

Core Features & Use Cases

  • Explicit variant components replace boolean flag complexity.
  • Compound components with shared context enable flexible UI assembly without prop drilling.
  • State lifting into providers allows UI components to be composed anywhere while sharing state across siblings.
  • Real-world scenarios include building design systems, UI libraries, and scalable component APIs.

Quick Start

Wrap a Frame with Input and Submit inside a Provider to observe shared state flow.

Frequently Asked Questions about vercel-composition-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I avoid boolean prop proliferation in React components?

To avoid boolean prop proliferation in React components, refactor using composition, compound components, and context providers. This approach replaces complex boolean flags with explicit variant components, ensuring a scalable and maintainable API.

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

The best way to share state across sibling React components without prop drilling is lifting state into context providers. This allows UI components to be composed anywhere while seamlessly sharing state across siblings within the provider.

How do compound components work in React 19?

Compound components in React 19 work by using shared context to enable flexible UI assembly. Wrapping sibling components inside a context provider allows them to communicate and share state without explicit prop passing.

When should I use explicit component variants instead of boolean flags?

You should use explicit component variants instead of boolean flags when building reusable UI libraries or design systems. Explicit variants reduce complexity and improve maintainability across diverse UI scenarios compared to managing multiple boolean props.

Does this composition pattern approach work for building React design systems?

Yes, this composition pattern approach works directly for building React design systems. It leverages generic context interfaces, state lifting, and React 19 API practices to ensure components remain testable and scalable.