react-patterns

react-patterns is a skill for Claude Code, Codex from cosmicstack-labs/mercury-agent-skills. It costs 18 tokens per session (2,234 once invoked), scanned A, original, MIT.

A guide to designing React components, hooks, state, effects, and performance patterns. React is a JavaScript library for building user interfaces from reusable components.

In plain words
What is it for?
Use it to structure components through composition, keep state near where it is used, derive values safely, and handle effects and memoization appropriately.
Why use it?
It helps prevent overly large components, duplicated data, misplaced state, and effects that make applications harder to maintain.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to structure components through composition, keep state near where it is used, derive values safely, and handle effects and memoization appropriately.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/cosmicstack-labs/mercury-agent-skills/react-patterns
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.

Any agent
npx skills add cosmicstack-labs/mercury-agent-skills --skill react-patterns
Clone the repo
git clone --depth 1 https://github.com/cosmicstack-labs/mercury-agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for react-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/cosmicstack-labs/mercury-agent-skills/react-patterns/github.svg)](https://agentmods.dev/skills/cosmicstack-labs/mercury-agent-skills/react-patterns)
Your own site
<a href="https://agentmods.dev/skills/cosmicstack-labs/mercury-agent-skills/react-patterns"><img src="https://agentmods.dev/badge/skills/cosmicstack-labs/mercury-agent-skills/react-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for react-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/cosmicstack-labs/mercury-agent-skills/react-patterns"><img src="https://agentmods.dev/badge/skills/cosmicstack-labs/mercury-agent-skills/react-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 18 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,234 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.1 $0.00018 $0.02234
Opus 5.5 $0.00007 $0.00894
Sonnet 5.5 $0.00004 $0.00447
Haiku 4.5 $0.00002 $0.00223

Measured 3mo ago against content hash 78296fa8cc98, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

react-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 3mo 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.

categories/frontend/react-patterns/SKILL.md · 277 lines

How it starts

The opening of the file, as written. The whole thing — 277 lines — stays where its author put it; the contents beside it link to each section on GitHub.

React Patterns

Build React applications that are composable, performant, and maintainable.

Core Principles

1. Composition Over Configuration

Build small, focused components and compose them. Avoid giant components with many configuration props. Children and slots are your friends.

2. State Management Is About Proximity

Keep state as close to where it's used as possible. Lift state up only when truly shared. Context is not a state management solution.

3. Derive, Don't Duplicate

Derived state (computed from existing state) should never be stored separately. Use useMemo for expensive derivations, compute inline for cheap ones.

4. Effects Are Escape Hatches

useEffect is for synchronizing with external systems (API, DOM, subscriptions). Don't use it for derived state or event handlers.


React Patterns Maturity Model

Level Components State Effects Performance
1: Basic Class components, mix of concerns Local state only Raw useEffects Not considered
2: Foundational Functional components, some hooks Lifting state, some context Cleanup in effects React.memo basics
3: Proficient Compound components, custom hooks useReducer, Zustand/Context Custom hooks encapsulate effects useMemo, useCallback
4: Advanced Render props, slots, polymorphic Server state (TanStack Query) Controlled side effects Code splitting, virtualization
5: Expert Headless UI, state machines Zustand + server state + URL xState or custom event bus Concurrent features, streaming SSR

Target: Level 3+ for production apps. Level 4 for complex applications.


Actionable Guidance

Component Patterns

1. Compound Components
// Expose related components that share implicit state
<Select value={selected} onChange={setSelected}>
  <Select.Option value="1">Option 1</Select.Option>
  <Select.Option value="2">Option 2</Select.Option>
  <Select.Option value="3">Option 3</Select.Option>
</Select>

Read the full file on GitHub · 277 lines

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. 3mo ago First seen · 277 lines · 18 tokens per session scan A 78296fa8cc98

Subscribe to this mod's changes

react-patterns is a skill published in the GitHub repository cosmicstack-labs/mercury-agent-skills (496 stars, last pushed 3mo ago), licensed MIT. It adds 18 tokens to every session and 2,234 once invoked, about $0.0001 per session on Opus 5.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-09-03.

Related

react-patterns compared with skills from other repositories

react-patterns next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
react-patternscosmicstack-labs/mercury-agent-skillsSkill4963mo agoMITA18Claude Code, Codex
nextjs-on-cloudflarecloudflare/skillsSkill3.6ktodayApache-2.0A96Claude Code
afrexai-react-productionLeoYeAI/openclaw-master-skillsSkill2.2k11d agoMITA32Claude Code, Codex
remotion-best-practicesguanyang/open-agent-hubSkill1.0ktodayMITA116Claude Code
remotion-elementsguanyang/open-agent-hubSkill1.0ktodayMITA76Claude Code, Codex
airflow-pluginsastronomer/agentsSkill465yesterdayApache-2.0A147Claude Code
json-uiactionbook/actionbookSkill1.6k1mo agoApache-2.0A118Claude Code