vercel-composition-patterns

Refactor React components using composition, compound components, and context providers.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guide provides a structured approach to refactoring React components by replacing boolean prop proliferation with composition, compound components, and context-driven state management to build scalable APIs.

Core Features & Use Cases

  • Refactor components using explicit variants (ThreadComposer, EditMessageComposer, ForwardMessageComposer) instead of boolean props.
  • Build flexible component libraries with compound components and a shared context that decouples UI from state.
  • Apply patterns across codebases to support component architecture improvements and React 19 API changes.

Quick Start

Begin by implementing explicit variant components and wrapping them in a shared Provider and Frame to compose the UI.

Frequently Asked Questions about vercel-composition-patterns

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

FAQPage Schema
How do I refactor React components to stop using boolean props for UI variations?

Refactor React components by replacing boolean props with explicit variant components like ThreadComposer or EditMessageComposer. This decouples UI from state management and enables scalable component libraries through composition and context providers.

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

The compound components pattern in React builds flexible component libraries by decoupling UI from state through a shared context. Use this pattern to compose complex interfaces by wrapping explicit variants in a shared Provider and Frame.

Can I use context providers to manage state in a scalable React component library?

Yes, you can use generic context interfaces and provider-based state to manage data in a scalable React component library. This approach enforces explicit variants and decouples the UI structure from underlying state logic.

What's the best way to structure component architecture for React 19 API changes?

Structure component architecture by applying composition patterns, explicit variants, and generic context interfaces to support React 19 API changes. This ensures your component libraries remain scalable and adaptable to new API requirements.

Why does my React component architecture become hard to scale with boolean props?

React component architecture becomes hard to scale with boolean props because they tightly couple UI rendering with state logic. Applying composition and explicit variants decouples these concerns, preventing prop proliferation and enabling maintainable libraries.