vercel-composition-patterns

Replace boolean props with composition patterns in React component APIs.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps teams avoid boolean prop proliferation by using composition patterns such as compound components, lifting state into providers, and defining generic context interfaces, enabling scalable React component libraries.

Core Features & Use Cases

  • Avoid Boolean Prop Proliferation by using compound components, lifting state, and composing internals.
  • Lift state into providers to enable sharing across UI parts and reduce prop drilling.
  • Define generic context interfaces for dependency injection to enable swapping state implementations.
  • Create explicit component variants to replace boolean flags and improve readability.
  • React 19 API considerations: forwardRef and use() patterns.

Quick Start

Identify monolithic components, extract providers, and replace booleans with explicit variants.

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, replace conditional flags with composition patterns. You can use compound components, lift state into providers, and define generic context interfaces to build scalable, flexible APIs.

What is the best way to refactor a monolithic React component into reusable parts?

Refactoring a monolithic React component involves extracting shared state into providers and replacing boolean flags with explicit variants. This composition pattern simplifies complex component APIs and reduces unwanted prop drilling across your UI library.

How does lifting state into providers reduce prop drilling in React?

Lifting state into providers reduces prop drilling in React by centralizing shared data. Provider-driven state enables different UI parts to consume context directly, bypassing intermediate components and simplifying data flow.

Does this React composition pattern approach work with React 19?

Yes, this React composition pattern approach works with React 19 practices. It specifically incorporates modern API considerations, utilizing the use() pattern for context consumption and handling forwardRef behavior for flexible component ref forwarding.

When should I replace boolean flags with explicit component variants?

You should replace boolean flags with explicit component variants when your React component API becomes hard to read and maintain. Creating distinct variant components improves readability and prevents complex conditional rendering logic.

How do I define generic context interfaces for dependency injection in React?

Defining generic context interfaces for dependency injection in React involves creating typed context providers that allow swapping state implementations. This composition technique decouples internal state logic from UI rendering.