
React Composition Patterns
FreeBuild flexible and maintainable React components.
Free · Opens the source repo
What React Composition Patterns does
The React Composition Patterns skill provides a comprehensive set of guidelines for creating scalable and maintainable React components. It focuses on avoiding the common pitfalls associated with boolean prop proliferation by advocating for the use of composition techniques such as compound components and lifting state. By following these patterns, developers can enhance the readability and maintainability of their codebases, making them easier for both humans and AI agents to work with as they grow in complexity.
This skill is particularly beneficial for developers who are refactoring existing components that rely heavily on boolean props or for those who are building reusable component libraries. It offers structured approaches to component architecture, state management, and implementation patterns, ensuring that components are designed with flexibility in mind. The skill also includes guidance on adapting to the latest React 19 API changes, which is crucial for developers looking to leverage the newest features in their applications.
The skill is organized into several rule categories, each with varying levels of priority. High-priority rules focus on component architecture, emphasizing the importance of avoiding boolean props and structuring complex components with shared context. Medium-priority rules cover state management and implementation patterns, providing strategies for decoupling state management from component implementation and using explicit variants instead of boolean modes. This structured approach helps developers make informed decisions when designing their components.
In summary, the React Composition Patterns skill is an essential resource for developers and designers aiming to improve their component architecture and state management practices in React applications. By adhering to these guidelines, users can create more robust, reusable, and maintainable components that stand the test of time.
When to use it
Use this skill when refactoring components, building reusable libraries, or designing flexible APIs in React.
When not to use it
This skill is not suitable for projects that do not utilize React or for those using React versions prior to 19.
What you can build with it
Refactoring Boolean Props
When a component has too many boolean props, use this skill to refactor it by implementing compound components instead.
Building a Component Library
When creating a reusable component library, refer to the guidelines to ensure your components are flexible and maintainable.
Designing APIs for Components
Use this skill to design component APIs that are intuitive and avoid the pitfalls of boolean prop proliferation.
How to install React Composition Patterns
View source1. Install with the skills CLI
npx skills add calesthio/openmontage/vercel-composition-patterns --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by calesthioReact 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.
Extended reference:
AGENTS.mdin this directory is the long-form upstream guide (vendored from Vercel). It is supplementary reference material scoped to this skill only —SKILL.mdis the loadable entry point and the authority. It does not override or extend the repository-rootAGENTS.md/AGENT_GUIDE.md.
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 compositionarchitecture-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 managedstate-context-interface- Define generic interface with state, actions, meta for dependency injectionstate-lift-state- Move state into provider components for sibling access
3. Implementation Patterns (MEDIUM)
patterns-explicit-variants- Create explicit variant components instead of boolean modespatterns-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 useforwardRef; useuse()instead ofuseContext()
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
Frequently asked questions about React Composition Patterns
Similar skills
Playwright Component Testing
Test React and Vue components in isolation with Playwright.
Fluent UI Blazor
Integrate Fluent UI components in Blazor applications effortlessly.
Build MCP App
Create interactive UI widgets for MCP servers.
Web Design Reviewer
Identify and fix design issues in websites efficiently.
Markstream Install
Seamlessly integrate Markstream for Markdown rendering.
GSAP & Framer Scroll Animation
Create advanced scroll animations effortlessly.
