vercel-composition-patterns

Refactor React component APIs into explicit variants and compound components.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Designing scalable React component libraries can lead to boolean prop proliferation and fragile code. This guide provides composition-based patterns to replace many boolean switches with explicit variants and shared context.

Core Features & Use Cases

  • Provide explicit variant components (e.g., ThreadComposer, EditMessageComposer, ForwardMessageComposer) to replace ad-hoc boolean props and improve readability.
  • Promote compound components and shared context to lift state and avoid prop drilling across UI boundaries.
  • Address React 19 API changes and how to transition from useContext to use() for cleaner context usage and safer composition patterns.

Quick Start

Apply these patterns to refactor a React component library, replacing boolean props with explicit variants and compound components.

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

Compound components in React scale component APIs by lifting shared state into context providers, preventing prop drilling across UI boundaries and allowing independent subcomponents to access state cleanly.

How do I refactor a React component to use composition patterns?

Refactor React components into composition patterns by identifying boolean switches and replacing them with explicit variants, then applying compound components and shared context interfaces to manage state across boundaries.

Does React 19 change how to use context for state management?

React 19 changes context usage by introducing the use() API, allowing you to transition from useContext to use() for cleaner context consumption and safer composition patterns within your component library.

Can I use context providers to avoid prop drilling in React?

Yes, you can use context providers to avoid prop drilling in React by establishing a shared context interface that lifts state management across UI boundaries, enabling compound components to access data directly.

When should I use explicit variants instead of boolean props in React?

Use explicit variants instead of boolean props in React when your component API becomes fragile and unreadable, replacing multiple conditional switches with distinct components like ForwardMessageComposer for better code maintenance.