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.
npx skills add secondsky/claude-skills --skill react-composition-patterns -a claude-codeWhat 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-code2Manually: put the files in place
~/.claude/skills/react-composition-patterns/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/react-composition-patterns/
1Skills CLI (Vercel)
npx skills add secondsky/claude-skills --skill react-composition-patterns -a codex2Manually: put the files in place
.agents/skills/react-composition-patterns/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add secondsky/claude-skills --skill react-composition-patterns -a cursor2Manually: put the files in place
.cursor/skills/react-composition-patterns/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install secondsky/claude-skills react-composition-patterns2Manually: put the files in place
.github/skills/react-composition-patterns/SKILL.md1Skills CLI (Vercel)
npx skills add secondsky/claude-skills --skill react-composition-patterns -a gemini-cli2Platform CLI
gemini skills install https://github.com/secondsky/claude-skills --path plugins/react-composition-patterns/skills/react-composition-patternsManually: put the files in place
.devin/skills/react-composition-patterns/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add secondsky/claude-skills --skill react-composition-patterns -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
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