A structured repository for React composition patterns that scale. These patterns help avoid boolean prop proliferation by using compound components, lifting state, and composing internals. - rules/ - Individual rule files (one per rule) - sections.md - Section metadata (titles, impacts, descriptions) - template.md - Template for creating new rules - area-description.md - Individual rule files - m
Add this skill
npx mdskills install vercel-labs/composition-patternsWell-organized composition patterns with clear categorization and priorities, but lacks actionable triggers
1---2name: vercel-composition-patterns3description:4 React composition patterns that scale. Use when refactoring components with5 boolean prop proliferation, building flexible component libraries, or6 designing reusable APIs. Triggers on tasks involving compound components,7 render props, context providers, or component architecture. Includes React 198 API changes.9license: MIT10metadata:11 author: vercel12 version: '1.0.0'13---1415# React Composition Patterns1617Composition patterns for building flexible, maintainable React components. Avoid18boolean prop proliferation by using compound components, lifting state, and19composing internals. These patterns make codebases easier for both humans and AI20agents to work with as they scale.2122## When to Apply2324Reference these guidelines when:2526- Refactoring components with many boolean props27- Building reusable component libraries28- Designing flexible component APIs29- Reviewing component architecture30- Working with compound components or context providers3132## Rule Categories by Priority3334| Priority | Category | Impact | Prefix |35| -------- | ----------------------- | ------ | --------------- |36| 1 | Component Architecture | HIGH | `architecture-` |37| 2 | State Management | MEDIUM | `state-` |38| 3 | Implementation Patterns | MEDIUM | `patterns-` |39| 4 | React 19 APIs | MEDIUM | `react19-` |4041## Quick Reference4243### 1. Component Architecture (HIGH)4445- `architecture-avoid-boolean-props` - Don't add boolean props to customize46 behavior; use composition47- `architecture-compound-components` - Structure complex components with shared48 context4950### 2. State Management (MEDIUM)5152- `state-decouple-implementation` - Provider is the only place that knows how53 state is managed54- `state-context-interface` - Define generic interface with state, actions, meta55 for dependency injection56- `state-lift-state` - Move state into provider components for sibling access5758### 3. Implementation Patterns (MEDIUM)5960- `patterns-explicit-variants` - Create explicit variant components instead of61 boolean modes62- `patterns-children-over-render-props` - Use children for composition instead63 of renderX props6465### 4. React 19 APIs (MEDIUM)6667> **⚠️ React 19+ only.** Skip this section if using React 18 or earlier.6869- `react19-no-forwardref` - Don't use `forwardRef`; use `use()` instead of `useContext()`7071## How to Use7273Read individual rule files for detailed explanations and code examples:7475```76rules/architecture-avoid-boolean-props.md77rules/state-context-interface.md78```7980Each rule file contains:8182- Brief explanation of why it matters83- Incorrect code example with explanation84- Correct code example with explanation85- Additional context and references8687## Full Compiled Document8889For the complete guide with all rules expanded: `AGENTS.md`90
Full transparency — inspect the skill content before installing.