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 $0.00093 $0.01617
Sonnet 5 $0.00037 $0.00647
Haiku 4.5 $0.00019 $0.00323

Measured 10d ago against content hash eb127e50bdb9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, 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 10d 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. 10d 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 2mo ago), licensed MIT. It adds 186 tokens to every session and 3,233 once invoked, about $0.0009 per session on Opus 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

Other skills, from other repositories

skillshare-ui-website-style

Skillshare frontend design system for the React dashboard (ui/) and Docusaurus website (website/). Use this skill whenever you: build or modify a dashboard page or component in ui/src/, style or layout website pages or custom CSS in website/, create new React components for the dashboard, add pages to the dashboard…

runkids/skillshare · 147 tokens

21st-ui

Find, install, and generate UI with 21st.dev. Use when the user asks for a UI component (pricing table, hero, navbar, dashboard, form, etc.), wants design inspiration, needs a brand logo as an SVG component, or wants to generate new UI from a prompt.

21st-dev/magic-mcp · 63 tokens

vercel-react-view-transitions

Guide for implementing smooth, native-feeling animations using React's View Transition API ( component, addTransitionType, and CSS view transition pseudo-elements). Use this skill whenever the user wants to add page transitions, animate route changes, create shared element animations, animate enter/exit of components…

fcakyon/claude-codex-settings · 127 tokens

extract-source-sample

Given the path to a finished content-goose ad-run folder, extract everything that defines that ad — recipe shot list, VO script, characters, voices, world, atom-skills, master mp4 — and emit a source-sample.json in the exact shape the upload-ad-sample skill writes to the Goose Ads library. Also links every character…

gooseworks-ai/goose-skills · 160 tokens

vercel-react-native-skills

React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.

fcakyon/claude-codex-settings · 57 tokens

remotion-to-hyperframes

Port an existing Remotion (React) composition to HyperFrames HTML. Use ONLY when the user explicitly asks to port/convert/migrate/translate a Remotion source. Do NOT use: (a) authoring a new HyperFrames composition; (b) Remotion mentioned in passing; (c) Remotion code shared as reference only; (d) "same video as my…

calesthio/OpenMontage · 215 tokens