vercel-labs avatar

Vercel Composition Patterns

Vercel's take on keeping React components maintainable as they grow. The main insight is practical: stop adding boolean props to handle variants, use composition and compound components instead. Covers lifting state into providers, building flexible APIs with context, and structuring component libraries that don't turn into prop soup. Also includes React 19 specific guidance like dropping forwardRef. The rules are prioritized by impact, so you can focus on architecture patterns first before diving into implementation details. If you're refactoring a component that's accumulated six boolean flags or building a design system, this gives you patterns that scale better for both humans and AI agents working in the codebase.

GitHub stars
27.8K
last updated
Jun 10, 2026

Install

$ npx -y skills add vercel-labs/agent-skills --skill vercel-composition-patterns --agent claude-code

Installs into .claude/skills of the current project.

Files

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

PriorityCategoryImpactPrefix
1Component ArchitectureHIGHarchitecture-
2State ManagementMEDIUMstate-
3Implementation PatternsMEDIUMpatterns-
4React 19 APIsMEDIUMreact19-

Quick Reference

1. Component Architecture (HIGH)

Sponsors

Details

Repository
github.com/vercel-labs/agent-skills
Categories
AI & Agent Building, Cloud & Infrastructure
First seen
Jun 11, 2026

More from vercel-labs/agent-skills

All 14
1vercel-labs avatarvercel-react-best-practicesvercel-labs/agent-skillsReact and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js c0skills.sh installs
2vercel-labs avatarvercel-react-native-skillsvercel-labs/agent-skillsVercel's official collection of agent skills0skills.sh installs
3vercel-labs avatarvercel-react-view-transitionsvercel-labs/agent-skillsGuide for implementing smooth, native-feeling animations using React's View Transition API (`<ViewTransition>` component, `addTransitionType`, and CSS view tran0skills.sh installs
4Wania-Kazmi avatardatabase-patternsWania-Kazmi/claude-code-autonomous-agent-workflow|0skills.sh installs
5yoloshii avatarsimple-fetchyoloshii/mcp-code-execution-enhancedBasic MCP skill demonstrating CLI-based execution pattern for fetching URL content0skills.sh installs
6google avatargoogle-agents-cli-scaffoldgoogle/agents-cliThis skill should be used when the user wants to "create an agent project", "start a new ADK project", "build me a new agent", "add CI/CD to my project", "add d558.7Kskills.sh installs