vercel-composition-patterns

Refactor React components to reduce boolean props using compound components and providers.

1|Updated Apr 6, 2026
One-click install
npx skills add https://github.com/pkoka888/server-infra-templates --skill vercel-composition-patterns-pkoka888
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/pkoka888/server-infra-templates/tree/main/.kilo/skills/marketplace/vercel-composition-patterns
Command: npx skills add https://github.com/pkoka888/server-infra-templates --skill vercel-composition-patterns-pkoka888

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill addresses unmaintainable React components caused by boolean prop proliferation and tightly coupled state, enabling clearer, safer component APIs and easier AI-assisted refactors.

Core Features & Use Cases

  • Compound Components: Structure components as composable pieces with a shared context so consumers assemble only what they need.
  • State as Provider: Lift state into providers that expose a generic state/actions/meta interface so UI remains implementation-agnostic.
  • Explicit Variants & Patterns: Replace boolean-mode components with explicit variant components, prefer children composition over render props, and adopt React 19 API practices.
  • Use Cases: Refactoring large component libraries, designing reusable UI primitives, performing code reviews to eliminate complex conditional logic.

Quick Start

Refactor the Composer component to remove boolean props, introduce a Provider exposing state/actions/meta, and replace modes with explicit variant components while adapting to React 19 APIs.

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

Refactor React components by replacing boolean props with explicit variant components and lifting shared state into context providers. This pattern exposes a generic state, actions, and meta interface to keep the UI implementation-agnostic and eliminate complex conditional logic.

What is the compound components pattern in React?

The compound components pattern structures a UI element as composable pieces sharing a single context. Consumers assemble only the pieces they need, which creates clearer component APIs and avoids tightly coupled state management found in monolithic components.

How do I adapt React context usage for React 19?

Adapt React context for React 19 by replacing the useContext hook with the new use API and treating ref as a regular prop. These API changes streamline context consumption and simplify ref forwarding in compound component architectures.

When should I use a state provider instead of render props in React?

Use a state provider instead of render props when lifting state out of tightly coupled components. Providers expose a generic state, actions, and meta interface so the UI remains implementation-agnostic, whereas render props often create deeply nested callback structures.

Can I use these composition patterns for React code reviews?

Yes, you can apply these composition patterns during React code reviews to identify and eliminate complex conditional logic. Reviewing for boolean prop proliferation and tightly coupled state helps enforce explicit variants and maintainable component APIs.