vercel-composition-patterns
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 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
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
More from boostbrothers/agent-skills
vercel-react-best-practices
React, React Native, and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/React Native/Next.js code to ensure optimal performance patterns. Includes framework-specific solutions (Next.js, Vite, CRA) and library alternatives (SWR vs React Query, Jotai). Triggers on tasks involving React components, Next.js pages, React Native apps, data fetching, bundle optimization, or performance improvements.
13web-design-guidelines
Web design and accessibility guidelines for modern web applications. Use when creating, reviewing, or refactoring UI components to ensure best practices for styling, animations, accessibility, and color contrast.
12vercel-react-native-skills
React Native and Expo best practices for building performant mobile apps. Use
8expo-crypto-dpop
RFC 9449 DPoP authentication crypto module for EC P-256 key generation, DPoP proof JWT creation, and secure token binding. Use when working with DPoP, dpop proof, RFC 9449, token binding, OAuth, or expo-crypto-dpop.
1prd-workflow
PRD generation and acceptance test workflow for product development. Use when creating PRDs from JIRA/Confluence/Figma data, generating UI/UX acceptance test checklists, or uploading test documents to Confluence.
1react-native-naver-map
Naver Map SDK React Native wrapper for rendering maps with overlays, markers, clustering, camera control, and location tracking. Use when working with 네이버 지도, naver map, map overlay, marker clustering, path overlay, or NaverMapView.
1