vercel-composition-patterns

Refactor React components with explicit variants and context providers.

3|1|Updated Jan 14, 2026
One-click install
npx skills add https://github.com/heyAyushh/stacc --skill vercel-composition-patterns-heyayushh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/heyAyushh/stacc/tree/main/configs/stacks/nextjs/composition-patterns
Command: npx skills add https://github.com/heyAyushh/stacc --skill vercel-composition-patterns-heyayushh

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps teams refactor React components by replacing boolean prop proliferation with explicit composition patterns, enabling more maintainable, reusable APIs. It focuses on compound components, render props, and context providers, and it accounts for React 19 API changes.

Core Features & Use Cases

  • Explicit variants: replace multi-flag components with dedicated ThreadComposer, EditMessageComposer, and ForwardMessageComposer variants.
  • State that travels with providers: lift state into providers so UI components stay decoupled from state management.
  • Composable internals via context: subcomponents access shared state through a common context rather than prop drilling.
  • Suitable for building scalable component libraries, refactoring large UIs, and designing flexible APIs that teams can extend.

Quick Start

Inspect existing code to identify where boolean props are used and plan explicit variant components (ThreadComposer, EditMessageComposer, ForwardMessageComposer). Implement a Provider-based UI using a shared Composer context and a Frame/Input/Submit subcomponent set to assemble the UI. Swap providers to reuse the same UI across different use cases without prop drilling; then render the appropriate variant in your app.

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?

To refactor React components and avoid boolean prop proliferation, replace multi-flag components with explicit variant components like ThreadComposer or EditMessageComposer. This approach uses dedicated providers and compound components to create more maintainable and reusable APIs.

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

The best way to manage shared state across React compound components is lifting state into context providers. This keeps UI subcomponents decoupled from state management, allowing them to access shared state through a common context rather than relying on prop drilling.

How do I update React context usage for React 19?

To update React context usage for React 19, modernize your APIs by replacing useContext with the use() hook and passing refs as regular props. This skill guides these modernization steps alongside establishing a generic context interface for state, actions, and meta.

When should I use explicit variant components instead of boolean props in React?

You should use explicit variant components instead of boolean props when building scalable component libraries or refactoring large UIs. If a single component handles multiple distinct use cases like editing or forwarding messages, splitting it into dedicated variants prevents complex and unmanageable prop combinations.

Can I reuse the same React UI components for different use cases without prop drilling?

Yes, you can reuse the same React UI components for different use cases without prop drilling by swapping context providers. Implement a Provider-based UI with a shared Composer context and subcomponents, then render the appropriate provider variant to instantly change the UI's behavior.