vercel-composition-patterns

Refactor React components into compound components with provider-lifted state.

18|Updated Jul 23, 2025
One-click install
npx skills add https://github.com/faw01/create-mf2-app --skill vercel-composition-patterns-faw01
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/faw01/create-mf2-app/tree/main/apps/cli/template/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/faw01/create-mf2-app --skill vercel-composition-patterns-faw01

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the maintenance nightmare of boolean prop proliferation and monolithic component structures in React applications, providing a standardized approach to building flexible, scalable UI.

Core Features & Use Cases

  • Compound Component Architecture: Learn to structure complex UI as modular, context-aware subcomponents.
  • State Dependency Injection: Decouple state management from UI components using generic context interfaces.
  • Explicit Variant Design: Replace complex boolean-driven logic with clear, self-documenting component variants.
  • Use Case: When refactoring a complex Composer component that has become unmaintainable due to dozens of boolean props like isThread, isEditing, and isForwarding, use these patterns to break it down into a clean, composed API.

Quick Start

Apply the vercel-composition-patterns skill to refactor the current component by replacing boolean props with compound components and lifting state into a provider.

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?▼

Refactor React components by replacing boolean props with compound components and explicit variants. This architecture breaks monolithic structures into modular, context-aware subcomponents, resolving the maintenance nightmare of prop proliferation.

What is the best way to reduce prop drilling in large React applications?▼

Reduce prop drilling in React by lifting state into providers and using state dependency injection. This decouples state management from UI components via generic context interfaces, creating a more maintainable architecture.

How do compound components work in React architecture?▼

Compound components in React structure complex UI as modular, context-aware subcomponents. This pattern allows subcomponents to communicate implicitly through shared context, replacing rigid boolean-driven logic with flexible, composed APIs.

Does this React refactoring approach support React 19?▼

Yes, the composition patterns satisfy requirements for React 19 compatibility. The architecture standardizes component design using dependency-injectable APIs and generic context interfaces that align with modern React updates.

When should I use explicit component variants instead of boolean props?▼

Use explicit component variants when a component becomes unmaintainable due to boolean props like isThread or isEditing. Variants provide clear, self-documenting APIs that prevent complex conditional logic and improve scalability.

Why does my monolithic React UI component require complex conditional rendering?▼

Monolithic React components require complex conditional rendering due to boolean prop proliferation and tight coupling. Decoupling state into providers and adopting compound component architecture replaces this with clean, composable structures.