vercel-composition-patterns

Guide React developers in structuring scalable component architectures with explicit variants and compound components.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the challenge of managing complex React component architectures by promoting best practices such as avoiding boolean prop proliferation, using compound components, and defining explicit variants, thereby simplifying maintenance and enhancing readability.

Core Features & Use Cases

  • Component Architecture Guidance: Recommends structuring components with explicit variants instead of boolean flags.
  • Shared Context & Compound Components: Demonstrates structuring complex components with shared state via context providers.
  • State Decoupling & Lifted State: Teaches how to separate state logic from UI, enabling reuse across different implementations.
  • React 19 API Updates: Covers new React 19 APIs like use() and native ref handling, ensuring modern best practices.
  • Use Case: Simplify a chat application's message composer to handle multiple modes (edit, thread, forward) with clear, explicit components rather than complex boolean props or conditionals.

Quick Start

Load the composition pattern guidelines into your React project, update component architecture by creating explicit variant components, and refactor complex composite components into shared, context-based structures.

Frequently Asked Questions about vercel-composition-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I manage complex React component architecture without boolean prop proliferation?

To manage complex React component architecture, you should avoid boolean prop proliferation by defining explicit variants and using compound components, which simplifies maintenance and enhances code readability across complex UI states.

What is the best way to structure shared state in compound React components?

The best way to structure shared state in compound React components is by using context providers, which allows you to decouple state logic from the UI and enable reuse across different implementations.

How do I refactor a chat message composer handling multiple modes like edit, thread, and forward?

To refactor a multi-mode chat message composer, replace complex boolean props and conditionals with explicit, context-based variant components, ensuring clear mode separation and scalable component architecture.

Does this React composition pattern approach cover React 19 API integration?

Yes, the React composition pattern approach covers React 19 API integration, including new APIs like the use() hook and native ref handling, ensuring modern best practices for component stability and reusability.

When should I use explicit variants instead of boolean flags in React components?

You should use explicit variants instead of boolean flags in React components when managing complex composite structures, as this prevents complex conditionals and improves code clarity, reusability, and stability across interactions.

Why does decoupling state logic from UI improve React component reusability?

Decoupling state logic from UI improves React component reusability by enabling state management via context providers, allowing the same UI structures to operate across different implementations without relying on tightly coupled conditionals.