React Composition Patterns that Scale

VerifiedSafe

Reference for scalable React component design. Covers compound components, state management, and React 19 patterns to avoid prop proliferation.

Sby Skills Guide Bot
DevelopmentIntermediate
8/29/2026
Claude CodeCursorWindsurfCopilotCodex
#react#composition-patterns#component-architecture#refactoring#react-19

Recommended for

Automated summary

A guide to React composition patterns that helps refactor components bloated with boolean props into compound components, context providers, and reusable APIs.

Strengths

  • Organizes rules into prioritized categories (architecture, state, implementation, React 19 APIs) with detailed rule files containing wrong and right code examples
  • Targets a concrete, common problem: boolean prop proliferation across components
  • Covers React 19 API changes (dropping forwardRef, using use()) with a clear version warning
  • Builds on well-established patterns: compound components, lifting state, generic context interfaces

Limitations

  • The SKILL.md is only an index; the actual content lives in rules/ files and AGENTS.md that must be read separately
  • React 19 patterns do not apply to projects on React 18 or earlier
  • Does not address performance, styling, or server rendering — only component architecture
When to use it

Use it when refactoring a component that has accumulated boolean props or when designing a reusable React component library.

When not to use it

Skip it if the project is not React-based or the task is a simple bug fix with no impact on component architecture.

Security analysis

Safe
Quality score80/100

The document is purely instructional prose about React component design patterns. It declares no tools, contains no scripts, no shell commands, no network calls, no file writes outside its own documentation, and no obfuscated payloads. Listing it carries no meaningful execution risk.

No concerns found

How this analysis is made

Examples

Refactor boolean props
This Button component has props like isPrimary, isLoading, hasIcon and isDanger. Refactor it using composition patterns.
Design a component library API
I'm building a reusable Tabs component for our design system. Design the API using compound components and a shared context provider.
React 19 migration check
Review these components for React 19: they use forwardRef and useContext. Show me what to change.

name: vercel-composition-patterns description: React composition patterns that scale. Use when refactoring components with boolean prop proliferation, building flexible component libraries, or designing reusable APIs. Triggers on tasks involving compound components, render props, context providers, or component architecture. Includes React 19 API changes. license: MIT metadata: author: vercel version: '1.0.0'

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

| Priority | Category | Impact | Prefix | | -------- | ----------------------- | ------ | --------------- | | 1 | Component Architecture | HIGH | architecture- | | 2 | State Management | MEDIUM | state- | | 3 | Implementation Patterns | MEDIUM | patterns- | | 4 | React 19 APIs | MEDIUM | react19- |

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

4. React 19 APIs (MEDIUM)

⚠️ React 19+ only. Skip these patterns if you're on React 18 or earlier.

  • react19-no-forwardref - Don't use forwardRef; use use() instead of useContext()

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

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/react-composition-patterns-that-scale-mte1lg19/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/react-composition-patterns-that-scale-mte1lg19' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/react-composition-patterns-that-scale-mte1lg19/download' --output '.skill-downloads/react-composition-patterns-that-scale-mte1lg19/SKILL.md.part' && mv '.skill-downloads/react-composition-patterns-that-scale-mte1lg19/SKILL.md.part' '.skill-downloads/react-composition-patterns-that-scale-mte1lg19/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Original excerpt: 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

4. React 19 APIs (MEDIUM)

⚠️ React 19+ only. Skip these patterns if you're on React 18 or earlier.

  • react19-no-forwardref - Don't use forwardRef; use use() instead of useContext()

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/react-composition-patterns-that-scale-mte1lg19/SKILL.md' && test -s '.skill-downloads/react-composition-patterns-that-scale-mte1lg19/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/vercel-composition-patterns' && cp -R '.skill-downloads/react-composition-patterns-that-scale-mte1lg19' '.claude/skills/vercel-composition-patterns'

Cursor
test -f '.skill-downloads/react-composition-patterns-that-scale-mte1lg19/SKILL.md' && test -s '.skill-downloads/react-composition-patterns-that-scale-mte1lg19/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/vercel-composition-patterns' && cp -R '.skill-downloads/react-composition-patterns-that-scale-mte1lg19' '.cursor/skills/vercel-composition-patterns'

Codex
test -f '.skill-downloads/react-composition-patterns-that-scale-mte1lg19/SKILL.md' && test -s '.skill-downloads/react-composition-patterns-that-scale-mte1lg19/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/vercel-composition-patterns' && cp -R '.skill-downloads/react-composition-patterns-that-scale-mte1lg19' '.agents/skills/vercel-composition-patterns'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/react-composition-patterns-that-scale-mte1lg19'

openskills read 'react-composition-patterns-that-scale-mte1lg19'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/react-composition-patterns-that-scale-mte1lg19/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills