vercel-composition-patterns

Refactor React components using composition patterns to reduce boolean props.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps developers reduce boolean prop proliferation by applying React composition patterns to build flexible, maintainable UIs.

Core Features & Use Cases

  • Use compound components with a shared context to compose complex components without prop drilling.
  • Lift state into providers to enable cross-component state sharing.
  • Create explicit component variants instead of boolean prop combinations.
  • Follow React 19 API guidelines (use() over useContext, avoid forwardRef when possible).

Quick Start

Start by selecting a target UI component and refactoring it into a framed container using a Frame/Provider pattern. Create an explicit variant component (e.g., ThreadComposer, EditMessageComposer, ForwardMessageComposer) and replace boolean flags with dedicated subcomponents. Implement a shared context and a provider to lift state, then compose UI with the frame and subgroup components as shown in the guide.

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 props in React components?

To reduce boolean prop proliferation in React, replace boolean flags with explicit component variants like ThreadComposer or EditMessageComposer. This composition pattern creates dedicated subcomponents, building flexible and maintainable UIs without complex prop combinations.

How do I use compound components with context providers to avoid prop drilling?

Use compound components with a shared context to compose complex UIs without prop drilling. Lift state into a context provider to enable cross-component state sharing, composing UI with a frame container and subgroup components.

Does React 19 require using the use() hook instead of useContext?

React 19 API guidelines recommend using the use() hook over useContext for managing context providers. Following React 19 API changes like use() and avoiding forwardRef where possible ensures modern, reusable component API design.

What is the best way to design reusable React component library APIs?

The best way to design reusable React component library APIs is applying composition patterns like render props and explicit variants. Create a framed container using a Frame/Provider pattern to lift state and compose UI with dedicated subcomponents.

When should I use explicit component variants instead of boolean prop combinations?

Use explicit component variants instead of boolean prop combinations when refactoring components to reduce boolean prop proliferation. This composition pattern builds flexible, maintainable UIs by replacing boolean flags with dedicated subcomponents.

How do I refactor a React UI component into a Frame/Provider pattern?

To refactor a React UI component into a Frame/Provider pattern, select a target component and transform it into a framed container. Implement a shared context and provider to lift state, then compose UI with the frame and subgroup components.