vercel-composition-patterns

Refactor React component APIs to replace boolean props with explicit variants.

Updated Jan 8, 2026
One-click install
npx skills add https://github.com/soham2008xyz/trade-tycoon --skill vercel-composition-patterns-soham2008xyz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/soham2008xyz/trade-tycoon/tree/main/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/soham2008xyz/trade-tycoon --skill vercel-composition-patterns-soham2008xyz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps you fix React component designs that have grown unmaintainable due to boolean prop proliferation and tangled state/UI logic.

Core Features & Use Cases

  • Compound component architecture: Structure components with a shared context so consumers compose exactly what they need.
  • State lifting & provider-first design: Move state management into provider components so sibling UI can access actions/state without prop drilling.
  • Generic context interfaces for dependency injection: Define a consistent state, actions, and meta contract so the same UI works across multiple state implementations.
  • Explicit variants over boolean modes: Replace “one component + many booleans” with clearly named variants (e.g., ThreadComposer, EditComposer).
  • React 19 best practices: Use React 19’s use() pattern for context consumption and treat ref as a regular prop.

Quick Start

Ask the skill to refactor your component by replacing boolean props with explicit variant components, lifting state into a provider, and converting render-prop patterns to children-based composition.

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 modes?

To refactor React components and eliminate boolean prop proliferation, replace a single component with many boolean modes by creating explicit variant components like ThreadComposer and EditComposer. This avoids impossible prop combinations and improves maintainability.

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

The best way to manage shared state without prop drilling is lifting state into a provider component. This provider-first design uses a shared context so sibling UI pieces can access state and actions directly through context providers.

How do I use React 19 context providers and the use pattern for component composition?

React 19 context providers are consumed using the use() pattern instead of useContext. For component composition, define a generic context interface exposing state, actions, and meta to inject dependencies and allow flexible UI assembly.

Why should I replace render props with children-based composition in my React components?

You should replace render props with children-based composition to achieve safer React component composition. Structuring components with compound component architecture allows consumers to compose exactly what they need without complex render-prop logic.

When do I need to use compound components for React UI development?

You need compound components when your React UI requires a shared context for consumers to compose exactly what they need. This architecture pairs with provider-first state management to decouple state logic from UI rendering.

Does this React refactoring approach require specific dependencies or external libraries?

This React refactoring approach does not require external libraries or dependencies. It relies purely on React 19 features like the use() pattern and ref as a regular prop, alongside architectural patterns like context providers and state lifting.