vercel-composition-patterns

A set of React design patterns for building reusable components and component libraries. React is a JavaScript library for creating user interfaces, and composition means combining smaller parts instead of adding many behavior switches to one component.

In plain words
What is it for?
Use it when refactoring React components, designing reusable APIs, or working with compound components, render props, context providers, and React 19 APIs.
Why use it?
It helps avoid components becoming difficult to understand because they have too many boolean props, while keeping shared state and flexible APIs organized.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/franrom/pupila/composition-patterns
Any agent
npx skills add FranRom/pupila --skill composition-patterns
Clone the repo
git clone --depth 1 https://github.com/FranRom/pupila

Made for: Claude Code, Codex.

Per session 58 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 560 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00058 $0.00560
Opus 5 $0.00029 $0.00280
Sonnet 5 $0.00012 $0.00112
Haiku 4.5 $0.00006 $0.00056

Measured 3d ago against content hash 0459e0482e35, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

vercel-composition-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/composition-patterns/SKILL.md · 81 lines

What it actually says

React Composition Patterns

Composition patterns. Flexible, maintainable components. Skip boolean prop bloat. Use compound components, lifted state, composed internals. Scales for humans + AI agents.

When to Apply

Use 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-
4 React 19 APIs MEDIUM react19-

Quick Reference

1. Component Architecture (HIGH)

  • architecture-avoid-boolean-props — no boolean props for behavior; compose
  • architecture-compound-components — complex components share context

2. State Management (MEDIUM)

  • state-decouple-implementation — provider owns state mgmt
  • state-context-interface — generic interface: state, actions, meta (DI)
  • state-lift-state — state in provider, siblings access

3. Implementation Patterns (MEDIUM)

  • patterns-explicit-variants — explicit variant components, no boolean modes
  • patterns-children-over-render-props — children, not renderX props

4. React 19 APIs (MEDIUM)

⚠️ React 19+ only. Skip if React 18 or earlier.

  • react19-no-forwardref — no forwardRef; use() replaces useContext()

How to Use

Read rule files for explanations + examples:

rules/architecture-avoid-boolean-props.md
rules/state-context-interface.md

Each rule file has:

  • Why it matters
  • Incorrect example + why
  • Correct example + why
  • Extra context, refs

Full Compiled Document

Full guide, all rules expanded: AGENTS.md

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 81 lines · 58 tokens per session scan A 0459e0482e35

Subscribe to this mod's changes

vercel-composition-patterns is a skill published in the GitHub repository FranRom/pupila (35 stars, last pushed 2mo ago), licensed MIT. It adds 58 tokens to every session and 560 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

react-artifact

Author app-like designs in React/JSX and bundle them in-sandbox into the same single self-contained HTML artifact Design Studio delivers. Use when the design needs real state, complex interactivity, or component reuse beyond what vanilla JS comfortably handles.

juspay/xyne-spaces · 53 tokens

react-frontend

React architecture patterns, TypeScript, Next.js, hooks, and testing. Use when working with React component structure, state management, Next.js routing, Vitest, React Testing Library, or reviewing React code. For visual design and aesthetic direction, use frontend-design instead.

iliaal/ai-skills · 58 tokens

react-frontend

React, TypeScript, and Next.js patterns for frontend development. Use when building React components, managing state, fetching data, optimizing performance, or working with Next.js App Router. Covers React 18-19, hooks, Server Components, and type-safe patterns.

iliaal/whetstone · 57 tokens

testing-react

Writes React/TypeScript tests using Vitest and React Testing Library. Use when "write react tests", "vitest", "component test", "hook test", "RTL", "testing library", "snapshot test", or testing React components, hooks, and utilities.

iliaal/whetstone · 57 tokens

create-react-modlet

Create React components or hooks following the modlet pattern in this project. Use when creating any new component or hook in panel/src/components/. Modlets are self-contained folders with index.ts, implementation, tests, and optional types.

bitovi/convey · 50 tokens

frontend

Use when building React components, optimizing performance, analyzing bundle sizes, scaffolding projects, implementing accessibility, reviewing frontend code quality, performing visual overhauls, or designing UI/UX systems.

Joncik91/ucai · 40 tokens