Composition Patterns
Teaches React composition patterns — compound components, context providers and explicit variants — so components avoid boolean-prop sprawl and stay reusable.
Install:
npx skills add vercel-labs/agent-skills --skill composition-patterns
Source: https://github.com/vercel-labs/agent-skills/tree/main/skills/composition-patterns
Repository: https://github.com/vercel-labs/agent-skills
Updated 27 November 2026.
What it does
- Replaces boolean-prop APIs with composed components
- Covers compound components and shared context state
- Shows explicit variants instead of conditional prop combinations
- Keeps component APIs small and predictable
- Maintained in the Vercel agent-skills repository
Use it for
- Refactor a component buried in boolean props
- Design a reusable card, menu or accordion API
- Review new components for composition problems early
What it does
Composition Patterns addresses the most common way React components rot: one boolean prop at a time. A card gains isCompact, then hasBorder, then hideFooter, until nobody can predict what a given combination renders. This Vercel skill teaches the agent the alternative — composition: compound components that share state through context, explicit variant components instead of prop matrices, and children as the primary API. Components designed this way stay small, read clearly at the call site, and extend by adding pieces rather than by adding flags.
How to install and use
Install with the command in the frontmatter. The skill applies when the agent designs or refactors component APIs. It is especially useful at two moments: when you are about to build a component that several screens will share, and when an existing component’s prop list has started to sprawl and a refactor is on the table.
Example use
Ask: ‘This dialog component has nine boolean props and three rendering modes tangled together — refactor it.’ Expect a compound structure instead: a root component holding state in context, with header, body and action subcomponents you compose at the call site, and the old modes expressed as short, readable JSX arrangements rather than prop combinations.
Good to know
Composition has a learning curve for teams used to prop-driven components, and for a one-off component used in exactly one place, a few props are honestly fine. Apply the patterns where reuse and variation are real — shared UI primitives — and do not let an agent rewrite stable, simple components purely for architectural elegance.
Composition discipline pairs with the performance side of React work in React Best Practices, and with the visual layer in Frontend Design. The same ‘small rules, applied every time’ logic is what makes the CLAUDE.md that actually works worth setting up.
Requirements
You need an agent that supports the Agent Skills standard — Claude Code is the target tool listed for this skill — plus the install command shown at the top of this page: npx skills add vercel-labs/agent-skills --skill composition-patterns. The skill itself is a folder of instruction files (a SKILL.md, and in some cases bundled scripts or reference files) that the agent loads when a task matches its description. Nothing in the skill replaces the underlying tool it guides: where the skill covers an API, a document format or a platform, you still need your own access and accounts for that platform.
Safety notes
Installs as local instruction files — a SKILL.md plus any bundled scripts or assets — that your agent reads and follows locally. Review the SKILL.md and any scripts in the skill folder before first use; no third-party security scan was run and no scan result is claimed.
In practice: read the SKILL.md before the first run, skim any bundled scripts for network calls or file writes outside the project, and run the skill first on a copy of a real file rather than the original. A skill’s instructions are followed by your agent with your permissions, so the review standard is the same one you would apply to a script a stranger handed you. What was verified for this entry: Verified via the GitHub API on 2026-11-27: the skill exists in vercel-labs/agent-skills’s skills directory. Description rewritten in our own words; popularity/install counts deliberately not reproduced.
Before you rely on it
Run the example task from the section above on a small, real job and compare the output with doing the same job unaided. Keep the skill if it removes steps or errors you actually make; remove it if it only adds ceremony. Skills cost a description line of context on every session until they trigger, so a directory of unused skills is not free — it is a small, permanent tax on every conversation.
Safety notes
Verified via the GitHub API on 2026-11-27: the skill exists in vercel-labs/agent-skills's skills directory. Description rewritten in our own words; popularity/install counts deliberately not reproduced.
Installs as local instruction files — a SKILL.md plus any bundled scripts or assets — that your agent reads and follows locally. Review the SKILL.md and any scripts in the skill folder before first use; no third-party security scan was run and no scan result is claimed.