vercel-composition-patterns

Refactor React components from boolean props to compound components and context providers.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

React projects often suffer from boolean prop proliferation that creates tangled, hard-to-maintain components. This guide shows how to replace flags with explicit variants, compound components, and context-driven APIs to scale UI libraries without conditional chaos.

Core Features & Use Cases

  • Explicit variant components that document intent and reduce branching logic.
  • Compound components with a shared context to avoid prop drilling and improve reusability.
  • Context providers that lift state and enable UI pieces to work with different state backends.
  • Use cases include refactoring large component libraries, designing flexible component APIs, and maintaining cross-team consistency.

Quick Start

Replace boolean-driven components with explicit variants and wrap UI in a shared provider to enable seamless reuse.

Frequently Asked Questions about vercel-composition-patterns

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

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

Refactor React component libraries by replacing boolean-driven flags with explicit variant components, compound components, and shared context providers to reduce branching logic and improve cross-team consistency.

What is the best way to build reusable React component APIs without prop drilling?

Build reusable React component APIs by adopting compound components with a shared context provider, which lifts state away from individual props and allows UI pieces to work with different state backends.

How do compound components use context providers in React?

Compound components use context providers in React to share state across UI pieces without prop drilling, enabling flexible component architectures and allowing different state backends to drive the same UI elements.

Does this React composition pattern work with React 19 APIs?

Yes, this React composition pattern works with React 19 APIs by using the new use() hook over useContext and avoiding forwardRef, ensuring explicit variant components align with modern context-driven architecture standards.

When should I use explicit variant components instead of boolean props?

Use explicit variant components instead of boolean props when scaling React UI libraries to document intent clearly, reduce conditional branching logic, and maintain cross-team consistency across complex component architectures.