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.
npx skills add tmj-90/gaffer --skill react-patternsgit clone --depth 1 https://github.com/tmj-90/gafferWrote 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.
[](https://agentmods.dev/skills/tmj-90/gaffer/react-patterns)<a href="https://agentmods.dev/skills/tmj-90/gaffer/react-patterns"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/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.
<a href="https://agentmods.dev/skills/tmj-90/gaffer/react-patterns"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/react-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00116 | $0.01602 |
| Opus 5.5 | $0.00046 | $0.00641 |
| Sonnet 5.5 | $0.00023 | $0.00320 |
| Haiku 4.5 | $0.00012 | $0.00160 |
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 16d 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.
How it starts
The opening of the file, as written. The whole thing — 101 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Write React the way React wants to be written
Most React bugs break the Rules of React: components and hooks must be pure
(same inputs → same output, no side effects during render), props and state are
immutable snapshots, and hooks are called unconditionally at the top level of a
component or custom hook. Model UI as a function of state, keep effects for
synchronising with systems outside React, and compose small components. This pack sits
on top of the typescript-conventions skill; the design bar is frontend-foundations.
Steps
- Read the repo's React set-up. React version (19.x adds Actions,
use, ref-as-prop; 19.2 addsuseEffectEventand<Activity>), whether the React Compiler is enabled (babel/SWC plugin in the build config),eslint-plugin-react-hooksconfig, framework (Next.js App Router, Remix/React Router, Vite SPA), and the state/data libraries (thefrontend-state-managementandfrontend-data-fetchingskills). Callsearch_loreand copy a sibling component's shape. - Keep render pure. No fetches, subscriptions,
Math.random()/Date.now()for output, or mutation of props, state or module variables during render. Never mutate state in place (items.push); create a new value. Strict Mode double-invokes render and effects in development precisely to expose impurity — "the effect runs twice" means the effect lacks a correct cleanup, not that Strict Mode should be removed. - You probably don't need that effect. Before writing
useEffect, check:- Derived from props/state? Compute it during render (
useMemoonly if measured as expensive and the Compiler is off). - Caused by a user action? Put it in the event handler.
- Reset when an id changes? Key the component by the id.
- Fetching? Use the data layer, a loader, or a Server Component.
Effects remain for synchronisation: subscriptions, timers, imperative widgets, DOM
measurement (
useLayoutEffectonly when you must measure before paint). Every effect that starts something returns a cleanup that stops it.
- Derived from props/state? Compute it during render (
- Honest dependencies. The array lists every reactive value the effect reads; never
disable
react-hooks/exhaustive-deps. Logic that must read the latest value without re-running the effect (logging, analytics, a callback prop) goes inuseEffectEvent(React 19.2+) or a ref updated in an effect on older versions. Move pure helpers outside the component instead of wrapping them inuseCallback. - Memoisation policy. With the React Compiler on, do not add
memo/useMemo/useCallbackby hand unless profiling shows the Compiler bailed out; fix the lint diagnostics that cause bail-outs instead. With it off, memoise only what the profiler shows is costly (thefrontend-performanceskill). - Keys are identities. Use stable ids from the data; never array indexes for lists
that reorder, filter or delete, and never generated keys (
Math.random()) — both lose input state and focus. - Compose instead of configuring.
childrenand slot props over boolean variant props; custom hooks (nameduseX, calling hooks) for reusable stateful logic; context for rarely changing shared values, split by change frequency. In React 19refis a prop (noforwardRef) and<Context value>is the provider. - Forms and mutations with Actions where the repo uses them:
useActionStatefor submit-with-result,useFormStatusfor a pending button in a child,useOptimisticfor an optimistic value that reverts when the action settles. Otherwise follow the repo's form library (thefrontend-forms-and-validationskill). - Async boundaries.
<Suspense>with a real fallback around the part that waits and an error boundary at route or section level;startTransition/useDeferredValuefor non-urgent updates so typing stays responsive. Noasyncfunction passed directly touseEffect; an inner async function checks a cancelled flag orAbortSignal. - Server Components (Next.js App Router, RSC). Server by default.
"use client"marks a module boundary — push it to the interactive leaves; everything passed across it must be serialisable. Import server-only code through modules guarded withimport 'server-only'."use server"functions (Server Functions/Actions) are public HTTP endpoints: authenticate, authorise and validate their arguments inside the function every time (thesecurity-authzandsecurity-input-validationskills). Render nothing that differs between server and client (time, locale,window) without a client-only boundary, or hydration fails. - Test and evidence. Per AC, a component test through the rendered UI (the
frontend-testingskill); run type-check, lint (hooks rules included) and tests. Record per-AC evidence with therecord-evidenceskill, then stop.
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.
- 16d ago Changed · +23 lines · +13 tokens per session 481e76d0ca84
- 19d ago First seen · 78 lines · 103 tokens per session scan A 277ae82bc448
react-patterns is a skill published in the GitHub repository tmj-90/gaffer (2 stars, last pushed 17d ago), licensed Apache-2.0. It adds 116 tokens to every session and 1,602 once invoked, about $0.0005 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-28.
Other skills, from other repositories
bulwark-brainstorm
Role-based brainstorming with dual modes: --scoped (sequential Task tool, 5 roles) and --exploratory (Agent Teams peer debate, 4 roles). Use for feasibility assessment and idea validation.
plan-creation
Create structured implementation plans via a 4-role scrum team (Product Owner, Architect, Eng/Delivery Lead, QA/Critic) with optional Agent Teams peer debate mode.
anthropic-validator
Validates Claude Code assets (skills, hooks, agents, commands, MCP servers, plugins) against official Anthropic standards. Fetches latest docs dynamically and produces structured validation reports.
create-subagent
Generates single-purpose Claude Code sub-agents for use via the Task tool. Use when creating dedicated sub-agents, scaffolding agent definitions, or generating agents with diagnostics and permissions setup.
test-audit
Audit test suites for T1-T4 violations using AST analysis, mock detection, and multi-stage synthesis. Invoke when user asks to audit tests, check test quality, find mock violations, review test effectiveness, or inspect test suites for over-mocking. Triggers automatic rewrites when quality gates fail.
code-review
Comprehensive code review with distinct aspect based sections. Use when reviewing code, checking for security issues, finding type safety problems, auditing code quality, or when user asks to review code, PRs or changes. Three-phase workflow runs static tools, LLM judgment, and writes diagnostic log.