vercel-composition-patterns

Refactor React component libraries to replace boolean props with composition patterns.

2|1|Updated Mar 16, 2026
One-click install
npx skills add https://github.com/ByeongminLee/nextjs-claude-code --skill vercel-composition-patterns-byeongminlee
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/ByeongminLee/nextjs-claude-code/tree/main/template/.claude/skills/vercel-composition-patterns
Command: npx skills add https://github.com/ByeongminLee/nextjs-claude-code --skill vercel-composition-patterns-byeongminlee

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Refactors React components to eliminate boolean prop proliferation and to design reusable, scalable APIs through composition patterns, enabling consistent UI libraries.

Core Features & Use Cases

  • Avoid boolean prop proliferation by building explicit component variants (ThreadComposer, EditMessageComposer, ForwardMessageComposer).
  • Implement compound components with shared context to enable flexible composition without prop drilling.
  • Lift and share state via providers, enabling UI components to work with different state implementations.
  • Adopt React 19 API practices (use() instead of useContext, ref as a regular prop) to streamline context usage.

Quick Start

Start by replacing boolean props with explicit variant components and wiring shared state through a provider, then compose UI using the new pattern.

Frequently Asked Questions about vercel-composition-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I stop boolean prop proliferation in my React component library?

Compound components in React share state via context providers, enabling flexible composition without prop drilling. This pattern allows UI components to work with different state implementations by lifting state through shared providers.

How do I share state across React components without prop drilling?

To share state across React components without prop drilling, implement compound components with shared context providers. Lifting state via providers enables UI components to work with different state implementations seamlessly.

Does this React composition pattern work with React 19 APIs?

Yes, this composition pattern supports React 19 APIs by replacing useContext with the use() hook and treating ref as a regular prop. This avoids forwardRef pitfalls and streamlines context usage in modern React applications.

How do I refactor React components to use explicit variants?

Refactor React components to use explicit variants by replacing boolean props with distinct, purpose-built component types like ThreadComposer. Wire shared state through a provider, then compose your UI using these new variants.

When should I use the use() hook instead of useContext in React 19?

Use the use() hook instead of useContext in React 19 when streamlining context consumption in composition patterns. It modernizes context usage and helps avoid forwardRef pitfalls while building scalable component libraries.