V

vercel-composition-patterns

by vercel-labs

Install and use vercel-composition-patterns to apply scalable React composition patterns, including compound components, lifted state, explicit variants, and React 19-friendly APIs.

Stars0
Favorites0
Comments0
CategoryFrontend Development
Install Command
npx skills add https://github.com/vercel-labs/agent-skills --skill composition-patterns
Overview

Overview

What vercel-composition-patterns is

vercel-composition-patterns is a frontend development skill from vercel-labs/agent-skills focused on React component architecture that scales. It documents practical composition patterns for teams refactoring complex UI, building reusable component libraries, or standardizing how flexible components should be structured.

The repository guidance centers on a clear theme: prefer composition over configuration. Instead of growing a component through more booleans, render props, and branching logic, this skill recommends compound components, shared context, lifted state, and explicit component variants.

What problems this skill helps solve

This skill is useful when React components start becoming hard to reason about, especially in codebases where one component tries to support many modes through flags such as isEditing, isThread, or similar conditional props. The included rules aim to reduce:

  • boolean prop proliferation
  • prop drilling across nested UI
  • monolithic component APIs that are difficult to extend
  • tightly coupled state and presentation logic
  • outdated patterns when adopting React 19 APIs

The repository evidence supports guidance around compound components, context-based composition, children-first patterns, explicit variants, and React 19 updates such as avoiding forwardRef and using use() in the documented patterns.

Who should install it

vercel-composition-patterns is a good fit for:

  • React teams maintaining shared UI systems or component libraries
  • frontend developers refactoring large, stateful components
  • Vercel users or AI-assisted coding workflows that want opinionated React architecture guidance
  • engineers reviewing PRs for component API quality and maintainability

It is especially relevant if your team wants conventions that are easy for both humans and AI agents to follow consistently.

What is included in the repository

The skill includes high-level guidance in SKILL.md, machine-oriented implementation guidance in AGENTS.md, metadata in metadata.json, and a rule set in rules/.

The rule files are organized into four documented areas:

  • Component Architecture
  • State Management
  • Implementation Patterns
  • React 19 APIs

Notable repository files include:

  • SKILL.md
  • README.md
  • AGENTS.md
  • metadata.json
  • rules/architecture-avoid-boolean-props.md
  • rules/architecture-compound-components.md
  • rules/state-lift-state.md
  • rules/state-context-interface.md
  • rules/state-decouple-implementation.md
  • rules/patterns-children-over-render-props.md
  • rules/patterns-explicit-variants.md
  • rules/react19-no-forwardref.md

When vercel-composition-patterns is a strong fit

Install this skill when you are:

  • redesigning a reusable React API
  • breaking apart a large component with too many modes
  • introducing compound components with shared context
  • moving state into provider components
  • aligning new work with React 19-era patterns

When it may not be the best fit

This skill may be less useful if your project is not React-based, your components are intentionally simple and local, or you need a broad UI framework rather than architecture guidance. It is a pattern library for decision-making, not a packaged component runtime.

How to Use

Install the skill

Add composition-patterns from the vercel-labs/agent-skills repository with:

npx skills add https://github.com/vercel-labs/agent-skills --skill composition-patterns

This is the most direct way to install vercel-composition-patterns for local skill usage.

Review the key files first

After installation, start with the files that explain scope and intent before diving into individual rules:

  • SKILL.md for the summary, use cases, and category priorities
  • README.md for repository structure and rule families
  • AGENTS.md for the compiled guidance used in AI-assisted workflows
  • metadata.json for version, organization, abstract, and references

Then move into the rules/ directory to apply the guidance to real components.

Use the rules in a practical order

A sensible adoption path is:

  1. Read rules/architecture-avoid-boolean-props.md to identify overloaded component APIs.
  2. Read rules/architecture-compound-components.md to redesign the component as composable building blocks.
  3. Use rules/state-lift-state.md, rules/state-context-interface.md, and rules/state-decouple-implementation.md to separate state concerns from UI concerns.
  4. Apply rules/patterns-explicit-variants.md and rules/patterns-children-over-render-props.md to improve API clarity.
  5. Review rules/react19-no-forwardref.md if your codebase is adopting React 19 patterns.

What usage looks like in practice

In practical frontend work, vercel-composition-patterns is best used as a refactoring and review guide rather than something you copy verbatim. For example, if you have one Composer component with multiple flags controlling layout and behavior, this skill pushes you toward:

  • separate variants instead of a single flag-heavy API
  • provider-based shared state
  • subcomponents that consume context directly
  • children-based composition instead of many render callback props

That makes component boundaries easier to extend and easier to understand during code review.

How to evaluate it before wider rollout

For installation decisions, test this skill on one problem component first. Good candidates include a modal, composer, form shell, menu, or editor wrapper that already has many branching props. If the refactor reduces conditional logic and makes variants clearer, the skill is likely a good match for broader frontend standards.

References surfaced by the repository

The repository metadata points to React documentation that supports the documented approach:

  • https://react.dev
  • https://react.dev/learn/passing-data-deeply-with-context
  • https://react.dev/reference/react/use

FAQ

Does vercel-composition-patterns include ready-made React components?

No. vercel-composition-patterns is a guidance skill, not a component library. It provides architecture rules, patterns, and examples for structuring your own React components.

Is vercel-composition-patterns only for large design systems?

No. It is especially valuable for shared component libraries, but it also helps on application code when a single component has become overloaded with booleans, render props, and tightly coupled state.

What are the main patterns covered?

The repository evidence shows coverage for avoiding boolean props, using compound components, lifting state into providers, defining clear context interfaces, decoupling implementation from UI, preferring children over render props, creating explicit variants, and handling React 19 API changes.

Is this skill specific to React?

Yes. The repository content is explicitly centered on React composition patterns and includes references to React documentation and React 19-specific guidance.

How do I know if I should install composition-patterns?

Install vercel-composition-patterns if your frontend codebase has components that are difficult to extend cleanly, rely on many mode flags, or need a more maintainable composition model. If your UI is small and straightforward, the skill may be more guidance than you currently need.

Where should I start after installation?

Start with SKILL.md, then read README.md, and then work through the highest-impact architecture rules in rules/. That order gives you the fastest path from overview to practical React usage.

Ratings & Reviews

No ratings yet
Share your review
Sign in to leave a rating and comment for this skill.
G
0/10000
Latest reviews
Saving...