Skip to main content
skill Claude Code CX Codex Cursor GitHub Copilot

vercel-composition-patterns — Claude Code skill: React composition

A rule set that pushes your agent away from boolean props and toward compound components, shared context and state lifted into providers.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add vercel-labs/agent-skills --skill vercel-composition-patterns -a claude-code
npx skills add vercel-labs/agent-skills --skill composition-patterns -a claude-code
Open on GitHub

What vercel-composition-patterns does

The skill hands the agent four categories of rules for React component work, ordered by priority and tagged with prefixes: architecture-, state-, patterns-, react19-. Architecture comes first because boolean prop proliferation is what usually starts the mess.

Each rule is its own file under rules/ — rules/architecture-avoid-boolean-props.md, rules/state-context-interface.md and so on. A file shows the wrong version, explains the damage, then shows the fixed one. A compiled AGENTS.md carries the whole guide, which is the easier thing to pass to an agent that would rather read one document than open every rule separately.

The react19- category is React 19 and up only: it drops forwardRef and swaps useContext() for use(). Skip it on React 18. Worth installing once components have grown flags like isCompact, withHeader and hideFooter and the API keeps getting patched for each new case. A project with a couple of static forms can do without it.

What it helps with

  • break a component with too many boolean props into compound parts
  • build a compound Select or Modal on shared context
  • lift state into a provider so sibling components read it
  • replace render props with children in an existing API
  • drop forwardRef after the move to React 19

Example prompts for the agent

  • Refactor `Modal` — it has seven boolean props now, split it into compound components
  • Audit `src/components/ui` and remove `forwardRef`, we're on React 19
  • Design the `Tabs` API so state lives in the provider

How to install vercel-composition-patterns

1Skills CLI (Vercel)

npx skills add vercel-labs/agent-skills --skill vercel-composition-patterns -a claude-code
npx skills add vercel-labs/agent-skills --skill composition-patterns -a claude-code

2Manually: put the files in place

~/.claude/skills/composition-patterns/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/composition-patterns/

From the same set6

The whole set →

Similar

shadcn shadcn-ui This skill helps add and configure shadcn/ui components while following project conventions. Use it when building interfaces, applying presets, or working on chat UI. Claude Code CX Codex Cursor +1 122,100installs slideshow heygen-com Build live HyperFrames decks with slides, fragment reveals, branching hotspots, and presenter notes. Use it when the output should be a presentation rather than a video. Claude Code CX Codex Cursor +1 415,500installs figma heygen-com Imports assets, brand tokens and components from Figma into a HyperFrames project, then turns storyboard frames into motion. Useful when a design has to move, not sit still. Claude Code CX Codex Cursor +1 329,500installs emil-design-eng emilkowalski This skill guides UI polish, component details, and animation choices. Use it when an interface works but its states and transitions need closer review. Claude Code CX Codex Cursor +1 385,500installs review-animations emilkowalski Reviews UI animation and motion code against Emil Kowalski's design standards. Flags slow easings, non-GPU properties, and unnecessary transitions. Claude Code CX Codex Cursor +1 254,100installs frontend-design official anthropics This skill guides intentional visual design for new interfaces and redesigns. Use it when a generic generated UI is not enough. Claude Code Claude.ai 1,025,790installs design-taste-frontend Leonxlnx This skill directs the design of public pages and work screens, then checks the result in a browser through screenshots. Use it when an interface feels generic or unfinished. Claude Code CX Codex Cursor +1 673,100installs prototype Matt Pocock Creates throwaway prototypes for checking state logic or exploring UI before committing the decision to the main codebase. Claude Code 986,201installs

Questions about vercel-composition-patterns

How do I install vercel-composition-patterns in Claude Code?

Run npx skills add vercel-labs/agent-skills --skill composition-patterns -a claude-code. The skill lands at ~/.claude/skills/composition-patterns/SKILL.md; swap the -a value for codex, cursor, gemini-cli or opencode.

What does vercel-composition-patterns do?

It gives the agent rules for React component architecture: avoiding boolean props, building compound components on shared context, keeping state in providers, using explicit variants instead of mode flags.

Does it need React 19?

Only the react19- category does, with the rules on forwardRef and use(). The other three categories apply to earlier React versions as well.

Source text

SKILL.md · MIT
---
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 this section if using 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`

© vercel · MIT · vercel-labs/agent-skills

See also

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor