vercel-composition-patterns

Refactor React component APIs using composition patterns and context providers.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Composition patterns help teams avoid boolean prop proliferation and brittle component APIs by encouraging explicit variants, compound components, and provider-based state management for scalable React UI.

Core Features & Use Cases

  • Avoid boolean prop proliferation by using explicit variants (for example, ThreadComposer, EditMessageComposer, ForwardMessageComposer) and compound components.
  • Lift state into providers to share state across unrelated UI parts via a generic context interface.
  • Compose internals via shared context to decouple UI from data handling, enabling flexible APIs and React 19 patterns.
  • Use cases include refactoring large component libraries, building reusable UI primitives, and designing scalable component systems.

Quick Start

Create a Provider that holds state and actions, wrap your UI with the provider, and compose your components via the exported subcomponents.

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 component APIs?

The best way to refactor large React component libraries is applying composition patterns like compound components and provider-based state lifting. This decouples internal logic, replaces brittle boolean props with explicit variants, and creates flexible APIs for reusable UI primitives.

What is the compound components pattern and when should I use it in React?

React 19 composition patterns replace forwardRef by utilizing the use() hook for context consumption. This modern convention allows you to lift state into providers and compose internals via shared context, moving away from older ref-forwarding approaches.

How do I lift state into a provider to share it across unrelated React components?

Yes, you can use composition patterns to scale React components by replacing boolean props with explicit variants like EditMessageComposer. By lifting state into context providers, unrelated UI parts share state seamlessly, resulting in flexible and maintainable component systems.

When should I not use boolean props in React component design?

To design scalable React component systems, wrap your UI with a context provider holding state and actions, then compose your components via exported subcomponents. This provider-based state lifting decouples data handling from UI, preventing boolean prop proliferation.