vercel-composition-patterns

Replace boolean props with explicit variant components and shared context in React.

Updated Feb 4, 2026
One-click install
npx skills add https://github.com/memorysaver/agentpit-gg --skill vercel-composition-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/memorysaver/agentpit-gg/tree/main/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/memorysaver/agentpit-gg --skill vercel-composition-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps software teams design scalable React codebases by avoiding boolean prop proliferation through composition patterns, compound components, and context.

Core Features & Use Cases

  • Explicit variant components: ThreadComposer, EditMessageComposer, and ForwardMessageComposer reuse shared UI primitives to replace boolean prop gates.
  • Compound components with context: A central ComposerContext enables pieces like Frame, Input, and Submit to be composed without prop drilling.
  • State sharing via providers: Lift state to providers so unrelated UI pieces can access and mutate shared state without tight coupling.

Quick Start

  • Create explicit variant components (ThreadComposer, EditMessageComposer, ForwardMessageComposer) using the shared Composer primitives, and wire them under a common provider. Then compose simple UIs by including Frame, Input, and Submit from the Composer family.

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 avoid boolean prop proliferation?

Replace boolean props with explicit variant components and composition patterns. Create dedicated component variants (like ThreadComposer, EditMessageComposer) that compose shared primitives through a central context, eliminating conditional rendering gates and prop drilling.

What are compound components and how do they work with context in React?

Compound components are related pieces (Frame, Input, Submit) composed together under a shared provider. Context passes state and actions between them without prop drilling, enabling flexible UI assembly where each piece independently accesses shared state.

How do I design a scalable React component library without boolean props?

Use composition patterns with explicit variants and a generic context interface (state, actions, meta). Lift state to pluggable providers so unrelated UI pieces access shared state, and compose primitives into higher-level components for reuse across design systems.

When should I use composition patterns instead of prop-based component variants?

Use composition patterns when managing multiple boolean props creates bloated APIs or tight coupling. They're essential for design systems and reusable component libraries where flexibility, readability, and scalability matter more than simple conditional rendering.

Can I apply composition patterns to refactor an existing React codebase?

Yes. Composition patterns directly target refactoring existing codebases by replacing boolean-gated logic with explicit variants and shared context. Incrementally introduce compound components and providers to modernize component APIs without full rewrites.

What's the difference between prop drilling and context-based composition?

Prop drilling passes data through intermediate components; context-based composition lifts state to a provider so any composed piece accesses it directly. Composition patterns eliminate the intermediate layers, reducing component complexity and coupling in large UIs.