vercel-composition-patterns

Refactor React components with composition patterns instead of boolean props.

Updated Mar 29, 2026
One-click install
npx skills add https://github.com/zizhenchen47-oss/claude-skills --skill vercel-composition-patterns-zizhenchen47-oss
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/zizhenchen47-oss/claude-skills/tree/main/composition-patterns
Command: npx skills add https://github.com/zizhenchen47-oss/claude-skills --skill vercel-composition-patterns-zizhenchen47-oss

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you refactor React components that have grown rigid from boolean prop sprawl, duplicated variants, or hard-to-reuse APIs. It guides you toward composition-based architectures that are easier to extend, test, and maintain.

Core Features & Use Cases

  • Compound components: Organize related UI pieces around shared context and clear responsibility boundaries.
  • Flexible APIs: Replace boolean modes with explicit variants, children-based composition, and renderless patterns when appropriate.
  • React 19 guidance: Account for newer API changes such as avoiding forwardRef in contexts where React 19 patterns apply.
  • Use case: A design system button, modal, or form control can be refactored into a composable API that scales without adding more boolean props.

Quick Start

Ask Claude to review a React component and refactor it into a composition-based API using the rules in this skill.

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 with too many boolean props into a scalable API?

To refactor React components with boolean prop sprawl, replace rigid boolean modes with explicit variants, children-based composition, and renderless patterns. This approach creates flexible APIs that are easier to extend, test, and maintain without adding more boolean props.

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

The compound component pattern organizes related UI pieces around shared context and clear responsibility boundaries. Use it when a component like a modal or form control needs to scale through composition rather than duplicated implementation logic or complex prop configurations.

How do I replace render props with composition patterns in React?

Replace render props with composition-oriented guidance by lifting state and using context-based contracts. This allows you to build reusable React components with explicit variants and children-based composition, avoiding the deep prop drilling often associated with render props.

Do I need to use forwardRef when building React 19 components with composition?

When building React 19 components with composition, you can avoid forwardRef in contexts where newer React 19 patterns apply. The skill provides guidance on updating APIs to leverage these newer native capabilities for ref forwarding.

Can I use this composition approach for my React design system library?

Yes, applying composition-based architectures is ideal for reusable library development. It helps refactor design system controls like buttons into composable APIs that scale cleanly, replacing brittle component APIs caused by duplicated variants and prop proliferation.

What's the best way to lift state and create context-based contracts for React components?

The best way to lift state and create context-based contracts is to organize related UI pieces around shared context. This establishes clear responsibility boundaries, allowing flexible APIs that replace boolean modes with explicit, composable variants.