
React Composition Patterns
FreeBuild flexible and maintainable React components.
Free · Opens the source repo
What React Composition Patterns does
React Composition Patterns provides a set of guidelines for creating flexible and maintainable components in React applications. This skill is particularly useful for developers looking to refactor existing components that rely heavily on boolean props, which can lead to complex and unwieldy code. By adopting these composition patterns, you can simplify your component architecture, making it easier for both humans and AI agents to understand and maintain the codebase as it scales.
The skill emphasizes the importance of using compound components and lifting state to create a clearer separation of concerns. By avoiding boolean prop proliferation, developers can focus on building reusable component libraries and designing flexible component APIs. This approach not only enhances code readability but also promotes better state management practices, ensuring that components are easier to work with in various contexts.
The guidelines are organized into categories based on priority, covering component architecture, state management, implementation patterns, and specific React 19 APIs. Each category contains detailed rules that provide insights into best practices, along with code examples to illustrate correct and incorrect implementations. This structured approach allows developers to quickly reference and apply the most relevant rules to their projects.
Overall, React Composition Patterns serves as a valuable resource for developers aiming to improve their component design and architecture. Whether you are building new components or refactoring existing ones, these guidelines will help you create more maintainable and scalable React applications.
When to use it
Use this skill when refactoring components, building reusable libraries, or designing flexible APIs.
When not to use it
Avoid using this skill for tasks unrelated to component design or when working with non-React environments.
What you can build with it
Refactoring Boolean Props
When refactoring a component that uses multiple boolean props, refer to the guidelines to restructure it using compound components.
Building a Component Library
Use this skill to ensure that your component library is built on solid composition patterns, enhancing reusability and maintainability.
Designing Flexible APIs
When designing a new component API, apply these patterns to create a more intuitive and flexible interface for users.
How to install React Composition Patterns
View source1. Install with the skills CLI
npx skills add sickn33/agentic-awesome-skills/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 sickn33React 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 Use
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
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
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.
