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.
Install
npx skills add https://github.com/vercel-labs/agent-skills --skill vercel-composition-patterns- title
- Use Compound Components
- impact
- HIGH
- impactDescription
- enables flexible composition without prop drilling
- tags
- composition, compound-components, architecture
Use Compound Components
Structure complex components as compound components with a shared context. Each subcomponent accesses shared state via context, not props. Consumers compose the pieces they need.
Incorrect (monolithic component with render props):
Correct (compound components with shared context):
Usage:
Consumers explicitly compose exactly what they need. No hidden conditionals. And the state, actions and meta are dependency-injected by a parent provider, allowing multiple usages of the same component structure.