Skip to content
secondsky avatar

react-composition-patterns

React composition patterns skill from Vercel that replaces boolean prop sprawl with scalable component APIs.

CCM score
63 of 100
version
3.12.0
GitHub stars
254
View on GitHub

Own this plugin? Claim it

What it does

  • Adds a react-composition-patterns skill that Claude loads when refactoring components or designing reusable APIs
  • Covers 7 rules across architecture, state management, and implementation patterns, ranked by priority
  • Guides toward compound components, lifted state in providers, and explicit variants like ThreadComposer over isThread flags
  • Designed for teams building component libraries or design systems that need composable, maintainable React APIs

React composition patterns from Vercel Engineering. Use when building scalable components, avoiding boolean prop proliferation, implementing compound components, or managing component state. Covers architecture, state management, and implementation patterns.

Add marketplace

/plugin marketplace add secondsky/claude-skills

Run it inside Claude Code once, then install the plugin below.

Install

/plugin install react-composition-patterns@claude-skills

Run it inside Claude Code after adding the marketplace.

Files

Discovered from source

React Composition Patterns

Composition patterns for building flexible, maintainable React components. Avoid boolean prop proliferation by using compound components, lifting state, and composing internals. These patterns make codebases easier for both humans and AI agents to work with as they scale.

When to Apply

Reference these guidelines when:

  • Refactoring components with many boolean props
  • Building reusable component libraries
  • Designing flexible component APIs
  • Reviewing component architecture
  • Working with compound components or context providers

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Component ArchitectureHIGHarchitecture-
2State ManagementMEDIUMstate-
3Implementation PatternsMEDIUMpatterns-

Quick Reference

1. Component Architecture (HIGH)

  • architecture-avoid-boolean-props - Don't add boolean props to customize behavior; use composition
  • architecture-compound-components - Structure complex components with shared context

2. State Management (MEDIUM)

  • state-decouple-implementation - Provider is the only place that knows how state is managed
  • state-context-interface - Define generic interface with state, actions, meta for dependency injection
  • state-lift-state - Move state into provider components for sibling access

3. Implementation Patterns (MEDIUM)

  • patterns-explicit-variants - Create explicit variant components instead of boolean modes
  • patterns-children-over-render-props - Use children for composition instead of renderX props

How to Use

Read individual rule files for detailed explanations and code examples:

rules/architecture-avoid-boolean-props.md
rules/state-context-interface.md

Each rule file contains:

  • Brief explanation of why it matters
  • Incorrect code example with explanation
  • Correct code example with explanation
  • Additional context and references

Full Compiled Document

For the complete guide with all rules expanded: AGENTS.md

Readme

React Composition Patterns

Status: ✅ Production Ready Version: 1.0.0 (Vercel source) Last Updated: 2026-01-28

Comprehensive React composition patterns guide from Vercel Engineering, containing 7 rules across 3 categories focused on building scalable, maintainable components through composition.

What This Skill Provides

✅ Component Architecture (CRITICAL) - 2 rules for structural design ✅ State Management (HIGH) - 3 rules for provider patterns and state lifting ✅ Implementation Patterns (MEDIUM) - 2 rules for composition strategies

Total: 7 production-tested rules with incorrect vs correct examples

When to Use This Skill

Use this skill when:

  • Building component libraries or design systems
  • Refactoring components with excessive boolean props
  • Implementing compound components with shared context
  • Designing flexible, composable component APIs
  • Managing component state with provider patterns
  • Creating explicit component variants instead of prop-driven customization

Core Principles

  1. Composition over configuration — Let consumers compose instead of adding props
  2. Lift your state — State in providers, not trapped in components
  3. Compose your internals — Subcomponents access context, not props
  4. Explicit variants — Create ThreadComposer, EditComposer, not Composer with isThread

Structure

  • SKILL.md - Concise overview with rule categories (~1,500 words)
  • AGENTS.md - Full compiled guide with all rules expanded (~8,000 words)
  • rules/ - 7 individual rule files for granular reference
  • metadata.json - Version and attribution metadata

Attribution

This skill packages Vercel's React Composition Patterns guide for Claude Code.

Original Author: @nandorojo (Vercel Engineering) Source: https://github.com/vercel-labs/agent-skills/tree/main/skills/composition-patterns Packaging: Claude Skills Maintainers License: MIT

We are grateful to Vercel for creating and open-sourcing this comprehensive guide.

Installation

# Add the marketplace once (if not already added)
/plugin marketplace add https://github.com/secondsky/claude-skills

# Install this plugin
/plugin install react-composition-patterns@claude-skills

Usage Examples

Example 1: Avoid Boolean Props

Ask: "How can I refactor this component that has too many boolean props?"

Claude will:

  • Reference SKILL.md architecture section
  • Suggest compound component patterns
  • Provide code examples from rules/architecture-avoid-boolean-props.md

Example 2: Implement Provider Pattern

Ask: "How should I structure state management in my component library?"

Claude will:

  • Reference state management rules
  • Show provider pattern with context
  • Point to rules/state-lift-state.md and rules/state-context-interface.md

Example 3: Create Component Variants

Ask: "Should I add an isEditing prop or create separate components?"

Claude will:

  • Reference explicit variants pattern
  • Explain composition over configuration
  • Show examples from rules/patterns-explicit-variants.md

Progressive Disclosure

SKILL.md (auto-loaded): Quick reference, rule categories, core principles AGENTS.md (on request): Full guide with all 7 rules expanded rules/ (on request): Individual rule files for specific topics

Ask Claude to "Load AGENTS.md" for the comprehensive guide.

Related Skills

  • react-best-practices - Performance optimization patterns
  • nextjs - Next.js framework patterns
  • zustand-state-management - State management
  • react-hook-form-zod - Form composition patterns
  • tailwind-v4-shadcn - UI component styling

Support

Details

Marketplace
secondsky/claude-skills
Source
plugins/react-composition-patterns
Category
Frontend
Keywords
react-composition-patterns, react, composition, patterns, frontend, components, scalable, implementation
Listed since
Apr 7, 2026

Questions

What does the react-composition-patterns plugin add to Claude Code?

It packages Vercel's React composition patterns guide as a skill with 7 rules across three categories: component architecture, state management, and implementation patterns. Claude can use it to suggest compound components, provider patterns and explicit variants instead of boolean props.

How do I install react-composition-patterns?

Run /plugin marketplace add secondsky/claude-skills in Claude Code, then run /plugin install react-composition-patterns@claude-skills. The second command adds this plugin's skill, with its guide files, to your Claude Code setup.

Which frontend plugins lead the Frontend & UI Code category?

react-composition-patterns sits in the Frontend & UI Code category on Claude Marketplaces, alongside frontend-design, nextjs, taste-skill, storybook and front-end-checklist. It focuses on how to structure React components so they stay flexible and maintainable as they grow.

Who should use the react-composition-patterns plugin?

It suits developers building component libraries or design systems, and anyone refactoring components that have grown too many boolean props. It is also useful when you need to manage component state with provider patterns and shared context.

More from secondsky/claude-skills

All 122

Similar to react-composition-patterns

More Frontend & UI Code