vercel-composition-patterns

Replace boolean props with composition in React component APIs.

29.9k|2.7k|Updated Dec 8, 2025
One-click install
npx skills add https://github.com/vercel-labs/agent-skills --skill vercel-composition-patterns-vercel-labs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/vercel-labs/agent-skills/tree/main/skills/composition-patterns
Command: npx skills add https://github.com/vercel-labs/agent-skills --skill vercel-composition-patterns-vercel-labs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guide provides patterns to avoid boolean prop proliferation by using composition to build scalable, reusable React component APIs. It covers compound components, render props, and context providers, including guidance for React 19 API changes.

Core Features & Use Cases

  • Use Compound Components to share state via context and reduce prop drilling.
  • Lift state into Providers to enable UI components to work with different state implementations.
  • Create explicit variants (ThreadComposer, EditMessageComposer, ForwardMessageComposer) for clear, maintainable code.

Quick Start

Provide an explicit ThreadComposer example that uses a provider to share state and a simple Frame with Input and Submit

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?

Replace boolean props with composition to build scalable React component APIs, using explicit variants and compound components to keep code maintainable.

What is the best way to share state across React components without prop drilling?

Use compound components with context providers to share state, lifting state into providers so UI components work with different state implementations.

How do I create explicit variants for different message types in React?

Create explicit variant components like ThreadComposer, EditMessageComposer, and ForwardMessageComposer to replace boolean props for clear, maintainable code.

When should I use children versus render props in React composition?

Use children for standard composition and render props when you need explicit control over rendering logic, applying guidance on when to use each pattern.

Does this composition pattern support React 19 API changes?

Yes, it applies composition patterns to React 19 API changes across architecture, state management, and implementation patterns using generic context interfaces.

Why lift state into providers for React component composition?

Lifting state into providers enables UI components to work with different state implementations, reducing prop drilling and decoupling state from rendering.