vercel-composition-patterns

Refactor React components into explicit variants with shared provider context.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Boolean props proliferate and create hard-to-maintain components; this skill teaches composition patterns to simplify APIs and improve reusability.

Core Features & Use Cases

  • Use compound components with shared context to compose UIs without prop drilling.
  • Lift state into providers to enable cross-component access and better reuse.
  • Create explicit component variants instead of multi-mode boolean props for clarity.
  • Apply React 19 API concepts like using use() and avoiding forwardRef when possible.
  • Real-world use: refactor a Button+Dialog system into a composable, scalable library.

Quick Start

Refactor components by converting boolean props into explicit variants and a shared provider-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 reduce React component API complexity from too many boolean props?

Reduce React component API complexity by replacing multi-flag boolean props with explicit component variants and shared context. This composition pattern simplifies maintenance and improves reusability across your UI library.

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

Manage shared state in compound components by lifting it into providers. This enables cross-component access via context, eliminating prop drilling and decoupling state management for better reuse.

Does this React composition approach work with React 19 APIs?

Yes, this React composition approach works with React 19 APIs by applying concepts like using use() for context and avoiding forwardRef when possible to modernize component architecture.

How do I refactor a Button and Dialog system into a composable library?

Refactor a Button and Dialog system into a composable library by converting multi-mode boolean props into explicit variants and wrapping them with a shared provider-based composition for scalable architecture.

When should I use explicit component variants instead of boolean props?

Use explicit component variants instead of boolean props when component APIs proliferate and become hard to maintain. Variants provide clarity and prevent invalid component states that boolean flags often create.