vercel-composition-patterns

Refactor React component libraries using compound components and context providers.

Updated Apr 30, 2026
One-click install
npx skills add https://github.com/rishi-harti768/persona-chat --skill vercel-composition-patterns-rishi-harti768
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/rishi-harti768/persona-chat/tree/main/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/rishi-harti768/persona-chat --skill vercel-composition-patterns-rishi-harti768

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Refactoring React codebases to replace boolean prop proliferation with scalable composition patterns, enabling reusable component libraries and clearer API boundaries.

Core Features & Use Cases

  • Use compound components with shared context to avoid prop drilling and conditional rendering.
  • Lift state into provider components to enable cross-component access and reuse.
  • Create explicit variants (ThreadComposer, EditMessageComposer, ForwardMessageComposer) to keep code self-descriptive and maintainable.
  • Adopt React 19 API patterns (use() instead of useContext, regular props for refs).

Quick Start

Refactor a React component library to replace boolean props with explicit variants using compound components and context 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 refactor React components to stop using boolean props for conditional rendering?

Refactor React components by replacing boolean props with explicit variants (like ThreadComposer) and compound components. This resolves boolean prop proliferation by creating self-descriptive APIs and enforcing consistent architecture across your UI library.

What is the best way to manage shared state across React compound components without prop drilling?

The best way to manage shared state without prop drilling is by lifting state into provider components. This allows compound components to access cross-component state directly through shared context, ensuring reusability and flexible API boundaries.

How do I use React 19 APIs like use() instead of useContext for component composition?

Adopt React 19 APIs by using the use() hook instead of useContext for state lifting and passing regular props for refs instead of forwardRef. This modernizes compound components and enforces scalable context architecture.

When should I use explicit variants over boolean props in a React component library?

Use explicit variants when a React component library needs to handle multiple distinct UI states. Creating variants like EditMessageComposer and ForwardMessageComposer keeps code self-descriptive, avoiding conditional rendering complexity and improving maintainability.

Does refactoring to compound components require external dependencies?

No, applying compound components with shared context requires zero external dependencies. It relies entirely on native React patterns and React 19 APIs to enforce consistent architecture and resolve boolean prop proliferation.

How do I scale React component APIs for large architecture without conditional rendering?

Scale React component APIs by building flexible boundaries with compound components and shared context providers. This architecture replaces boolean prop proliferation with explicit variants, enabling robust reuse across large component libraries.