vercel-composition-patterns

Refactor React components into explicit variants with compound components and context providers.

Updated Feb 26, 2026
One-click install
npx skills add https://github.com/Trimud/Sheep-Vampires-Yoghurt --skill vercel-composition-patterns-trimud
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/Trimud/Sheep-Vampires-Yoghurt/tree/main/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/Trimud/Sheep-Vampires-Yoghurt --skill vercel-composition-patterns-trimud

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

React components often suffer from boolean prop proliferation, leading to bloated conditionals and brittle APIs. This Skill provides patterns to unlock flexible composition, enabling reusable APIs through compound components, lifted state, and context-based providers.

Core Features & Use Cases

  • Explicit variants (e.g., ThreadComposer, EditMessageComposer, ForwardMessageComposer) reduce confusion and improve maintainability.
  • Use compound components with shared context to avoid prop drilling and enable flexible composition.
  • Lift state into provider components and define generic context interfaces for dependency injection, enabling UI components to work with multiple state implementations.

Quick Start

Refactor a React component library to use explicit variants and compound components, lifting state into providers for shared access.

Frequently Asked Questions about vercel-composition-patterns

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

FAQPage Schema
How do I replace boolean props in React components to scale my UI?

Replace boolean props in React by applying composition patterns like explicit variants and compound components. This refactoring eliminates bloated conditionals and produces scalable, maintainable UIs with clear, reusable APIs.

What is the best way to avoid prop drilling when building compound components in React?

The best way to avoid prop drilling with compound components is lifting state into context providers. This pattern allows flexible composition and shared access without passing props deeply through the component tree.

Does this React composition pattern use useContext and forwardRef for dependency injection?

No, these React composition patterns follow React 19 API guidelines by using the use() hook over useContext and avoiding forwardRef. Generic context interfaces are defined to enable dependency injection for multiple state implementations.

How do I create explicit variants for a React component library?

Create explicit variants by refactoring generic components into specialized ones, such as ThreadComposer or EditMessageComposer. This reduces confusion and improves maintainability by replacing boolean flags with distinct, purpose-built components.

When should I use context providers over render props in React?

Use context providers over render props when you need to lift state into provider components for shared access across compound components. Generic context interfaces enable dependency injection, allowing UI components to work with multiple state implementations.