Back to Skills

vercel-composition-patterns

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.

24,686stars2,245forksUpdated 4/8/2026

Security Assessment

Safe(100/100)
Security Score100/100

About vercel-composition-patterns

The vercel-composition-patterns skill provides a structured approach to building scalable and maintainable React components through composition patterns. It addresses common challenges in component design, such as boolean prop proliferation and tightly coupled state, which can make codebases difficult to manage and extend. By promoting best practices like compound components, render props, and context providers, this skill helps developers create flexible and reusable component architectures that are easier for both humans and AI systems to work with. It also incorporates guidance for React 19 API changes, ensuring modern compatibility and forward-looking practices.

The skill includes categorized rules that cover component architecture, state management, implementation patterns, and React 19-specific APIs. High-priority rules focus on avoiding boolean props and structuring complex components with shared context, while medium-priority rules address state decoupling, lifting state for sibling access, explicit variant components, and preferring children composition over render props. For React 19, it provides updated guidance on avoiding forwardRef and using use() instead of useContext(). Each rule is documented with explanations, incorrect and correct code examples, and additional references to facilitate practical application.

Targeted at React developers, this skill is particularly useful for teams building reusable component libraries, refactoring legacy components, or designing flexible APIs. It serves as a reference during code reviews, component architecture planning, and library development. By following these patterns, developers can improve code readability, maintainability, and adaptability, making it suitable for both small projects and large-scale applications where consistent, scalable component patterns are essential.

FAQ

How do I apply these composition patterns in my React project?

You can apply the patterns by following the categorized rules in the skill, reading the individual rule files for explanations and code examples, and refactoring components according to the recommended best practices such as compound components and lifted state.

Is this skill compatible with React versions earlier than 19?

Yes, most patterns apply to all React versions, but the React 19 API-specific rules should be skipped if you are using React 18 or earlier.

Can this skill help reduce boolean prop proliferation in my components?

Absolutely. One of the main goals is to replace boolean props with composition patterns and explicit variants, which leads to more readable and maintainable code.

Do I need to rewrite my entire codebase to use these patterns?

No, the skill is intended to guide refactoring incrementally. You can apply the patterns selectively to components that benefit most from improved architecture and state management.

All Files

14 files
rules/patterns-children-over-render-props.md1.8 KB
View
AGENTS.md22.1 KB
View
rules/_sections.md0.8 KB
View
metadata.json0.5 KB
View
rules/architecture-compound-components.md2.5 KB
View
rules/state-context-interface.md4.9 KB
View
SKILL.md2.8 KB
View
rules/architecture-avoid-boolean-props.md2.2 KB
View
rules/react19-no-forwardref.md0.9 KB
View
README.md2.1 KB
View
rules/_template.md0.3 KB
View
rules/patterns-explicit-variants.md2.3 KB
View
rules/state-lift-state.md3.1 KB
View
rules/state-decouple-implementation.md2.6 KB
View

Install vercel-composition-patterns

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill