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 frontend-state-managementgit 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/frontend-state-management)<a href="https://agentmods.dev/skills/tmj-90/gaffer/frontend-state-management"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/frontend-state-management/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/frontend-state-management"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/frontend-state-management.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.00109 | $0.01334 |
| Opus 5.5 | $0.00044 | $0.00534 |
| Sonnet 5.5 | $0.00022 | $0.00267 |
| Haiku 4.5 | $0.00011 | $0.00133 |
Grade A, and why
frontend-state-management 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 2mo 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 — 90 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Manage frontend state deliberately
"It shows the old value" and "these two parts disagree" are ownership bugs: a fact was copied, and the copies drifted. For each fact decide one owner and one way it changes. Server data belongs to the server-cache layer, UI state stays as local as possible, shareable state lives in the URL, and a global store holds only client-owned global facts.
Steps
-
Inventory the state the ticket touches and classify each fact:
Kind Examples Owner Server data lists, records, the current user's profile query/cache layer URL state filters, sort, page, selected id, open tab router search params / path Local UI state open/closed, hover, an input's draft the component, or nearest common parent Global client state theme, auth session handle, cross-page draft the repo's store Derived counts, filtered lists, "is valid" computed in render, never stored Call
search_lorefor the chosen libraries and conventions. -
Server data stays in the cache layer (TanStack Query, SWR, RTK Query, Apollo, loaders — the
frontend-data-fetchingskill). Read it where needed with the same query key; do not copy it intouseStateor a store. To edit a record, keep only the draft fields in form state, initialised from the query once, and submit a mutation. -
Local first; lift only as far as needed. Two siblings that must agree share the nearest common parent. Passing props through two or three levels is fine; deeper usually wants composition (pass the rendered child) before context. Context carries rarely changing values; split fast-changing values into their own context so a keystroke does not re-render the tree.
-
URL for anything a user would share, bookmark or expect back. Parse search params on read with a schema (unknown or invalid values fall back to defaults, never crash); write with the router's API,
replacefor typing-driven changes andpushfor navigations the Back button should undo. The URL is then the only copy — do not mirror it into state. -
A global store only for truly global client state, using the repo's library (Zustand, Redux Toolkit, Pinia, signals). Small slices, actions named for intent (
selectTicket), selectors that return the minimum so subscribers re-render only when their slice changes. External stores in React are read through the library's hooks oruseSyncExternalStore, never by subscribing in an effect. -
Transitions are explicit and safe under concurrency.
- One named function per transition; reducers are pure (no fetches, no
Date.now(), no mutation of the previous state). - Updates that depend on the previous value use the functional form
(
setCount(c => c + 1)) so rapid events are not lost. - Optimistic updates snapshot and roll back on failure, and a slower earlier response must not overwrite a newer optimistic value (cancel or ignore superseded requests).
- One named function per transition; reducers are pure (no fetches, no
-
Persisted state (localStorage, IndexedDB) is versioned. Store a schema version, migrate or discard old shapes on read, never persist server data or secrets, and read it after hydration (or with the library's hydration helper) to avoid server/client mismatches. If two tabs can edit the same persisted state, sync through the
storageevent orBroadcastChannel, or declare last-write-wins in the ticket — do not leave it undefined. -
Reset deliberately. To reset a subtree's state when an entity changes, key it by the entity id (
<Editor key={ticketId} />) instead of an effect that clears fields. -
Test where the state lives (the
frontend-testingskill): pure reducer/store transition tests; a component test per AC that drives the UI and asserts what is shown; a URL test (load with params → correct view; change filter → URL updated; Back restores); the rollback path; and rapid repeated events (click ×5 → count is 5). 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.
- 2mo ago Changed · +25 lines · +6 tokens per session 3c072a634deb
- 2mo ago First seen · 65 lines · 103 tokens per session scan A da37f443e8e4
frontend-state-management is a skill published in the GitHub repository tmj-90/gaffer (1 stars, last pushed 4d ago), licensed Apache-2.0. It adds 109 tokens to every session and 1,334 once invoked, about $0.0004 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.
frontend-state-management compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| frontend-state-managementtmj-90/gaffer | Skill | 1 | 4d ago | Apache-2.0 | A | 109 | Claude Code, Codex |
| bulwark-brainstormQBall-Inc/the-bulwark | Skill | 9 | yesterday | MIT | A | 50 | Claude Code |
| plan-creationQBall-Inc/the-bulwark | Skill | 9 | yesterday | MIT | A | 38 | Claude Code |
| anthropic-validatorQBall-Inc/the-bulwark | Skill | 9 | yesterday | MIT | A | 40 | Claude Code |
| create-subagentQBall-Inc/the-bulwark | Skill | 9 | yesterday | MIT | A | 42 | Claude Code |
| test-auditQBall-Inc/the-bulwark | Skill | 9 | yesterday | MIT | A | 0 | Claude Code |
| code-reviewQBall-Inc/the-bulwark | Skill | 9 | yesterday | MIT | A | 61 | Claude Code |