frontend-optimistic-mutations

frontend-optimistic-mutations is a skill for Claude Code, Codex from stareezy-1/frontend-architecture-skill. It costs 186 tokens per session (3,233 once invoked), scanned A, original, MIT.

A consistent method for making server-backed changes appear immediately in React or React Native apps. It temporarily updates cached data, restores the previous state if the request fails, and refreshes the data afterward.

In plain words
What is it for?
Use it for safe optimistic updates such as editing, creating, or deleting data through a query or cache layer.
Why use it?
It removes visible waiting after user actions while keeping the interface correct when a server request fails or is retried.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions CLAUDE.md; mentions Claude Code; mentions AGENTS.md.

Good fit Use it for safe optimistic updates such as editing, creating, or deleting data through a query or cache layer.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/stareezy-1/frontend-architecture-skill/frontend-optimistic-mutations
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 stareezy-1/frontend-architecture-skill --skill frontend-optimistic-mutations
Clone the repo
git clone --depth 1 https://github.com/stareezy-1/frontend-architecture-skill

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 frontend-optimistic-mutations

README.md
[![agentmods](https://agentmods.dev/badge/skills/stareezy-1/frontend-architecture-skill/frontend-optimistic-mutations/github.svg)](https://agentmods.dev/skills/stareezy-1/frontend-architecture-skill/frontend-optimistic-mutations)
Your own site
<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.

agentmods 80×15 button for frontend-optimistic-mutations

Your own site · 80×15
<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>
Per session 186 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,233 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.
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.00186 $0.03233
Opus 5.5 $0.00074 $0.01293
Sonnet 5.5 $0.00037 $0.00647
Haiku 4.5 $0.00019 $0.00323

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

Security

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.

skills/frontend-optimistic-mutations/SKILL.md · 265 lines

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

  1. The optimistic lifecycle is fixed. cancel → snapshot → patch → (error: roll back) → (settle: invalidate). Every optimistic mutation follows the same five beats.
  2. 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.
  3. 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.
  4. 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.
  5. 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.

Read the full file on GitHub · 265 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 · 265 lines · 186 tokens per session scan A eb127e50bdb9

Subscribe to this mod's changes

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.

Related

frontend-optimistic-mutations compared with skills from other repositories

frontend-optimistic-mutations next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
frontend-optimistic-mutationsstareezy-1/frontend-architecture-skillSkill105mo agoMITA186Claude Code, Codex
vercel-react-best-practicescalesthio/OpenMontageSkill84k16d agoAGPL-3.0A67Claude Code, Codex
vercel-composition-patternscalesthio/OpenMontageSkill84k16d agoAGPL-3.0A58Claude Code, Codex
brainstorm-featureHoangNguyen0403/agent-skills-standardSkill598yesterdayMITA46Codex
frontendcode-yeongyu/oh-my-openagentSkill71ktodaynoneA79Claude Code, Codex
implement-featureHoangNguyen0403/agent-skills-standardSkill598yesterdayMITA25Codex
implementation-readinessHoangNguyen0403/agent-skills-standardSkill598yesterdayMITA27Codex