Skip to main content
skill CX Codex

react-composition-patterns — Claude Code skill: install and usage

Teaches coding agents clean React composition patterns. Replaces boolean prop clutter with compound components and decoupled context providers.

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

What react-composition-patterns does

This skill guides AI agents through scalable React component design using a three-tier priority system. At the top level stands component architecture. It prevents flag proliferation and favors compound structures with shared context.

Lower tiers focus on state management and implementation patterns. The guidelines instruct models to isolate state inside providers with structured interfaces (state, actions, meta) and favor children over renderX callbacks. Every rule in the rules directory includes bad and good code examples.

Without the individual rule markdown files or compiled AGENTS.md, the agent relies on top-level summaries alone.

What it helps with

  • eliminate boolean prop sprawl in bloated components
  • structure reusable UI libraries around compound components
  • isolate shared state inside context providers
  • replace render props with direct children composition

Example prompts for the agent

  • Refactor this Modal component into compound components to eliminate boolean flags
  • Design an accessible Tabs component with context-managed state
  • Update the Table row rendering to use children instead of renderAction props

How to install react-composition-patterns

1Skills CLI (Vercel)

npx skills add secondsky/claude-skills --skill react-composition-patterns -a claude-code

2Manually: put the files in place

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

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

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about react-composition-patterns

How to install react-composition-patterns in Claude Code?

Run npx skills add secondsky/claude-skills --skill react-composition-patterns -a claude-code in your terminal. This writes the skill to ~/.claude/skills/react-composition-patterns/SKILL.md.

What does react-composition-patterns do?

It injects React design principles into AI coding agents. The agent stops adding boolean props and uses compound components and clean context interfaces.

What rule categories are included in the skill?

Rules are grouped into three categories: high-priority Component Architecture (architecture-), medium-priority State Management (state-), and Implementation Patterns (patterns-).

Source text

SKILL.md · MIT
---
name: react-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.
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-`     |

## 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`

© vercel · MIT · secondsky/claude-skills

Similar skills

Everything for Frontend and UI →

From the same set116

architecture-patterns A skill that gives your agent backend architecture templates: Clean Architecture layers, ports and adapters, and Domain-Driven Design building blocks. CX Codex +1 493installs api-rate-limiting A skill that walks you through rate limiting an API with token bucket, sliding window and Redis-backed counters. Useful when you open an endpoint to the public or split access by plan. CX Codex +1 491installs better-auth Guides Better Auth setup across TypeScript stacks, Cloudflare D1, and Drizzle ORM. Prevents broken adapter imports and schema migration bugs. CX Codex +1 488installs api-security-hardening Security layers for a REST API on Express: rate limits and input validation. Useful before the API goes to production. CX Codex +1 487installs design-system-creation A skill that walks the agent through building a design system: tokens, typography, components and their docs. Useful when UI standards need to be settled before code. CX Codex +1 481installs api-contract-testing Verifies API contracts between microservices with consumer-driven tests and OpenAPI schemas, skipping full end-to-end setups. CX Codex +1 475installs technical-specification This skill walks the agent through a technical spec template: requirements, architecture, API design, rollout plan, tests and risks. Useful before a feature turns into code. CX Codex +1 470installs mobile-app-testing A skill for testing mobile apps: unit tests, UI automation, E2E and performance. Useful when you need to set up test infrastructure. CX Codex +1 467installs

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