vercel-composition-patterns

Refactor React components into explicit variants with compound components and provider-managed context.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps you turn React components with growing boolean flags, duplicated variants, and prop drilling into clearer, reusable APIs that are easier to maintain.

Core Features & Use Cases

  • Replaces boolean prop combinations with explicit component variants.
  • Uses compound components and shared context to keep state and UI separate.
  • Supports provider-based state lifting so sibling UI can read or update the same data.
  • Guides refactors for design systems, form builders, messaging flows, and other reusable React interfaces.
  • Includes React 19 guidance for ref handling and context access.

Quick Start

Ask this skill to refactor your React component into an explicit variant with compound children and a provider-managed context.

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 conditional flag combinations with explicit component variants and shared context contracts. This approach untangles conditional rendering by establishing clear provider boundaries and lifting state.

What is the compound components pattern in React and when should I use it?

The compound components pattern in React separates state from UI by using shared context to manage data across parent and child components. Use it to build flexible, reusable interfaces like design systems or form builders without prop drilling.

How do I lift state and share it between sibling React components?

Lift state and share it between sibling React components using a provider-driven state sharing architecture. This method establishes clear provider boundaries, allowing sibling UI elements to read or update the same data without boolean prop drilling.

Does this React refactoring approach work with React 19 context and ref APIs?

Yes, this React refactoring approach works with React 19 by applying modern context usage and ref handling APIs. It guides TypeScript React codebases to establish shared context contracts that are compatible with React 19 improvements.

What is the best way to replace render props in modern React applications?

The best way to replace render props in modern React applications is refactoring to compound components with explicit variants. This uses shared context contracts and provider-driven state to achieve flexible UIs without render prop complexity.

When should I not use compound components for state management?

Avoid compound components for state management when your UI requires only a single isolated component without shared siblings. If your architecture lacks tangled conditional rendering or boolean prop combinations, explicit variants and provider boundaries are unnecessary.