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 stareezy-1/frontend-architecture-skill --skill frontend-optimistic-mutationsgit clone --depth 1 https://github.com/stareezy-1/frontend-architecture-skillWrote 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/stareezy-1/frontend-architecture-skill/frontend-optimistic-mutations)<a href="https://agentmods.dev/skills/stareezy-1/frontend-architecture-skill/frontend-optimistic-mutations"><img src="https://agentmods.dev/badge/skills/stareezy-1/frontend-architecture-skill/frontend-optimistic-mutations/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/stareezy-1/frontend-architecture-skill/frontend-optimistic-mutations"><img src="https://agentmods.dev/badge/skills/stareezy-1/frontend-architecture-skill/frontend-optimistic-mutations.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.00186 | $0.03233 |
| Opus 5.5 | $0.00074 | $0.01293 |
| Sonnet 5.5 | $0.00037 | $0.00647 |
| Haiku 4.5 | $0.00019 | $0.00323 |
Grade A, and why
frontend-optimistic-mutations 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.
How it starts
The opening of the file, as written. The whole thing — 265 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Frontend Optimistic Mutations (the write path)
Portable skill — readable by Claude Code, OpenCode, Codex, Cursor, Windsurf, and others. This skill describes the discipline of the write path — optimistic updates, rollback, idempotency, cache coherence — not a UI library or a styling system. It builds directly on the frontend-data-contracts skill (writes go through the typed client) and the frontend-architecture skill (mutations live in
modules/{feature}/hooks/, keyed by a factory).
The goal: a write feels instant (the UI reflects it before the server confirms), is safe (a failure restores the exact prior state, and a retry never double-charges), and leaves the cache coherent (the detail view and every list page agree). All three at once — that's the craft.
0. The five core ideas
- The optimistic lifecycle is fixed. cancel → snapshot → patch → (error: roll back) → (settle: invalidate). Every optimistic mutation follows the same five beats.
- Roll back verbatim. On failure, restore the exact snapshot taken before the patch — not a "best guess" re-derivation. Keep the snapshot in mutation context.
- Idempotency is generated once, not per attempt. The key is created at form init (or first intent), so a network retry replays the original server response instead of performing the action twice.
- Caches move in lock-step. A status change patches the detail cache and every list page that contains the entity, so badges never disagree across surfaces.
- Server state never enters the client store. Optimistic state lives in the query cache, not Zustand/Redux. The cache is the single source of truth for server data (per frontend-architecture §4).
1. When to be optimistic (and when not)
| Situation | Strategy |
|---|---|
| High-confidence, low-conflict write (toggle status, like, mark-paid, reorder) | Optimistic — patch immediately, roll back on error. |
| Create that returns a server-generated id/number/total | Pending state, then setQueryData from the server response. A temporary optimistic row is optional; reconcile on success. |
| Destructive or hard-to-reverse write (delete with cascade, send money) | Confirm first, then optimistic or pending — never silent-optimistic. |
| Write whose result the user can't see yet (background job) | Pending + toast, invalidate when done. No optimistic patch. |
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.
- 3mo ago First seen · 265 lines · 186 tokens per session scan A eb127e50bdb9
frontend-optimistic-mutations is a skill published in the GitHub repository stareezy-1/frontend-architecture-skill (10 stars, last pushed 5mo ago), licensed MIT. It adds 186 tokens to every session and 3,233 once invoked, about $0.0007 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-08-31.
frontend-optimistic-mutations compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| frontend-optimistic-mutationsstareezy-1/frontend-architecture-skill | Skill | 10 | 5mo ago | MIT | A | 186 | Claude Code, Codex |
| vercel-react-best-practicescalesthio/OpenMontage | Skill | 84k | 16d ago | AGPL-3.0 | A | 67 | Claude Code, Codex |
| vercel-composition-patternscalesthio/OpenMontage | Skill | 84k | 16d ago | AGPL-3.0 | A | 58 | Claude Code, Codex |
| brainstorm-featureHoangNguyen0403/agent-skills-standard | Skill | 598 | yesterday | MIT | A | 46 | Codex |
| frontendcode-yeongyu/oh-my-openagent | Skill | 71k | today | none | A | 79 | Claude Code, Codex |
| implement-featureHoangNguyen0403/agent-skills-standard | Skill | 598 | yesterday | MIT | A | 25 | Codex |
| implementation-readinessHoangNguyen0403/agent-skills-standard | Skill | 598 | yesterday | MIT | A | 27 | Codex |