vercel-composition-patterns

Provide React composition patterns to replace boolean props with compound components.

3|Updated Feb 21, 2026
One-click install
npx skills add https://github.com/ihatesea69/HieuNghi-AI-Skills --skill vercel-composition-patterns-ihatesea69
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/ihatesea69/HieuNghi-AI-Skills/tree/main/engineering_skills/composition-patterns
Command: npx skills add https://github.com/ihatesea69/HieuNghi-AI-Skills --skill vercel-composition-patterns-ihatesea69

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and rules (resource) components.

What problem does it solve?

This Skill addresses the complexity of managing numerous boolean props in React components, which can lead to unmaintainable code and difficult scaling. It provides patterns to create more flexible, readable, and maintainable component architectures.

Core Features & Use Cases

  • Avoid Boolean Prop Proliferation: Replace conditional logic driven by boolean props with compositional patterns.
  • Compound Components: Structure components with shared context, allowing subcomponents to access state without prop drilling.
  • State Management Patterns: Learn to lift state into provider components for easier sharing and dependency injection.
  • Use Case: Refactor a complex Modal component that currently uses many boolean props (e.g., showCloseButton, showTitle, isLarge, isCentered) into a set of composable components like Modal.Header, Modal.Body, Modal.Footer, and Modal.CloseButton.

Quick Start

Apply the architecture-avoid-boolean-props rule to refactor components with excessive boolean props.

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 logic with compositional patterns like compound components. Structuring UI elements such as Header and Body separately prevents unmaintainable code and difficult scaling.

What is the best way to manage state in complex React components without prop drilling?

The best way to manage state in complex React components without prop drilling is to use compound components with shared context. Lifting state into provider components allows subcomponents to access necessary data directly.

How do I refactor a complex React Modal component into composable parts?

To refactor a complex React Modal component, replace numerous boolean props like showCloseButton or isLarge with composable subcomponents. Structure your modal using Modal.Header, Modal.Body, Modal.Footer, and Modal.CloseButton for a flexible architecture.

Does this React composition pattern support React 19 APIs like use() and ref handling?

Yes, these React composition patterns support React 19 APIs. The guidelines include specific best practices for utilizing the use() hook and handling refs within scalable component architectures and context providers.

When should I use compound components and context providers in my React architecture?

You should use compound components and context providers when managing complex React component architectures that require shared state. This pattern enables dependency injection and easier state sharing without excessive prop drilling.