vercel-composition-patterns

Refactor React components using compound components, state lifting, and context providers.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

React components often suffer from boolean prop proliferation, leading to bloated conditional logic and hard-to-maintain code. This skill provides structured composition patterns to create flexible, reusable component APIs.

Core Features & Use Cases

  • Compound components with a shared context to avoid prop drilling and enable flexible assembly.
  • State lifting into provider components to share state across unrelated UI parts.
  • Explicit variants (ThreadComposer, EditMessageComposer, ForwardMessageComposer) for clear, self-documenting usage.
  • Guidance for modern React (React 19) API practices, including the use of use() and context-agnostic UI.

Quick Start

Create explicit variant components (ThreadComposer, EditMessageComposer, ForwardMessageComposer) that reuse shared internals and providers.

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?

To reduce boolean prop proliferation in React components, apply explicit variants and compound components. This eliminates bloated conditional logic by creating clear, self-documenting component APIs with shared internals instead of stacking conditional props.

What is the best way to share state across unrelated React UI parts without prop drilling?

The best way to share state across unrelated React UI parts without prop drilling is state lifting into provider components. Compound components leverage a shared context to enable flexible assembly and avoid passing props deeply through the tree.

How do I build reusable React component libraries with explicit variants?

Build reusable React component libraries by creating explicit variant components like ThreadComposer or EditMessageComposer. These variants reuse shared internals and context providers to establish flexible, self-documenting APIs for distinct use cases without conditional logic.

Does this React composition approach work with React 19 context APIs?

Yes, this React composition approach works with React 19 context APIs by providing guidance on modern practices. It includes using the new use() hook and context-agnostic UI methodologies to build flexible component structures.

When should I avoid compound components in React?

Avoid compound components in React when dealing with highly isolated UI elements that require no shared state or context. If your components do not suffer from boolean prop proliferation or prop drilling, simpler direct composition is sufficient.