vercel-composition-patterns

Refactor React components to replace boolean props with provider-based composition patterns.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guide eliminates boolean prop proliferation and fragile conditional logic that make React components hard to reason about, test, and maintain, especially as codebases grow or when AI agents assist with refactors.

Core Features & Use Cases

  • Compound Components & Providers: Design components as composable parts that share state via a provider rather than prop drilling.
  • State Lifting & Dependency Injection: Move state into provider boundaries and define generic context interfaces (state, actions, meta) so the same UI works with different state implementations.
  • Explicit Variants & Composition Patterns: Replace boolean modes with explicit variant components and prefer children composition over render props for clarity.
  • React 19 Guidance: Adjust patterns for React 19 APIs, e.g., prefer use() over useContext() and treat ref as a normal prop when applicable.
  • Use Cases: Refactoring legacy components with many booleans, building reusable component libraries, reviewing component architecture, and implementing consistent patterns across a UI system.

Quick Start

Refactor a Composer component to remove boolean props by introducing a Provider with a state/actions/meta context and split the UI into compound subcomponents that consumers compose.

Frequently Asked Questions about vercel-composition-patterns

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

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

Boolean prop proliferation in React components is reduced by replacing conditional logic with explicit variant components and compound patterns. Refactoring involves splitting a monolithic UI into composable subcomponents that share state via a context provider.

What is the best way to share state in compound components without prop drilling?

The best way to share state in compound components without prop drilling is lifting state into a provider boundary. Define generic context interfaces for state, actions, and meta so the same UI works with different state implementations.

How do I refactor a monolithic React component into composable parts?

Refactoring a monolithic React component into composable parts requires introducing a provider with state, actions, and meta context. Consumers then compose the UI using explicit compound subcomponents instead of relying on boolean props.

Does React 19 change how context is consumed in compound components?

React 19 changes context consumption by allowing the use() API instead of useContext(). Refactoring compound components for React 19 also involves treating ref as a normal prop when applicable to maintain consistent composition patterns.

When should I use children composition instead of render props in React?

Children composition should be used instead of render props in React when you want clearer component structure and predictability. Preferring children composition over render props eliminates brittle conditional logic and improves component scalability.

Why does my component library become hard to maintain with many boolean props?

Component libraries become hard to maintain with many boolean props because they create brittle conditional logic that is difficult to reason about and test. Replacing boolean modes with explicit variant components and provider-based state lifting solves this.