frontend-data-fetching

frontend-data-fetching is a skill for Claude Code, Codex from tmj-90/gaffer. It costs 112 tokens per session (1,518 once invoked), scanned A, original, Apache-2.0.

A method for loading and changing server data in a web interface. It covers the data layer, caching, refreshes, mutations, and the visible loading, empty, error, stale, and success states.

In plain words
What is it for?
Use it for lists, detail pages, polling, live updates, form submissions that change server data, retries, and updating or invalidating cached results.
Why use it?
It avoids scattered data-fetching code that can cause duplicate requests, stale results, race conditions, and missing UI states. It keeps server-data handling consistent with the project's existing approach.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it for lists, detail pages, polling, live updates, form submissions that change server data, retries, and updating or invalidating cached results.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tmj-90/gaffer/frontend-data-fetching
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 tmj-90/gaffer --skill frontend-data-fetching
Clone the repo
git clone --depth 1 https://github.com/tmj-90/gaffer

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-data-fetching

README.md
[![agentmods](https://agentmods.dev/badge/skills/tmj-90/gaffer/frontend-data-fetching/github.svg)](https://agentmods.dev/skills/tmj-90/gaffer/frontend-data-fetching)
Your own site
<a href="https://agentmods.dev/skills/tmj-90/gaffer/frontend-data-fetching"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/frontend-data-fetching/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-data-fetching

Your own site · 80×15
<a href="https://agentmods.dev/skills/tmj-90/gaffer/frontend-data-fetching"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/frontend-data-fetching.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 112 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,518 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.00112 $0.01518
Opus 5.5 $0.00045 $0.00607
Sonnet 5.5 $0.00022 $0.00304
Haiku 4.5 $0.00011 $0.00152

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

Security

Grade A, and why

frontend-data-fetching 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.

runner/skills/frontend-data-fetching/SKILL.md · 92 lines

How it starts

The opening of the file, as written. The whole thing — 92 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Fetch and mutate server data from the client

Client data bugs are cache and concurrency bugs: a stale list after a save, an older response overwriting a newer one, a double-submitted order, two tabs silently overwriting each other. Use the repo's data layer (it solves dedup, caching, races and cancellation once), key every query by its inputs, invalidate precisely, and treat concurrent writers as a normal case, not an edge case.

Steps

  1. Find the data layer. Call search_lore and read one existing screen: the query library (TanStack Query, SWR, RTK Query, Apollo), framework loaders/Server Components, the typed API client (the openapi-contract skill), the query-key factory, auth handling. A fetch in useEffect with hand-rolled loading flags is a defect where a layer exists.
  2. Know the defaults you inherit. TanStack Query v5: staleTime 0 (data is stale immediately, refetched on mount/focus/reconnect), gcTime 5 min, queries retry 3 times with backoff, mutations do not retry, queryFn receives an AbortSignal. SWR: revalidate on focus and reconnect, 2 s dedupe. Set staleTime deliberately from how often the data changes; do not turn off refetching to hide a bug.
  3. Key by every input. Arrays from the repo's factory, general to specific: ['tickets', 'list', { status, page, locale }], ['tickets', 'detail', id]. Any value the request uses that is missing from the key serves the wrong cached data. Pass the signal to fetch so key changes and unmounts cancel.
  4. Render the states on purpose. Pending first load (a skeleton at the final layout's size), empty (a message plus the next action), error (what failed plus Retry; never the raw response body), refreshing with data shown (a subtle indicator, not a skeleton flash), and success. With pagination or filters use placeholderData: keepPreviousData (TanStack) so the list does not blank between pages. In v5, isPending means no data yet; isFetching means a request is in flight.
  5. Mutate through the same layer. After success, invalidateQueries on the narrowest key prefix affected (list and detail), or setQueryData with the server's response. Optimistic update recipe: onMutate → cancelQueries for the key → snapshot previous data → write the optimistic value → return the snapshot; onError → restore it; onSettled → invalidate. Block duplicate submission while pending (isPending), and send an idempotency key for non-idempotent creates if the API supports one (the idempotency-and-retries skill).
  6. Handle concurrent writers. If the API returns a version or ETag, send it back (If-Match or a version field). On 409/412, keep the user's edit, show that the record changed, and offer reload-and-reapply — never retry blindly and overwrite. With two tabs open, the second tab refetches on focus; confirm your mutation does not depend on data the other tab changed.
  7. Poll and stream deliberately. refetchInterval tied to the data's change rate, paused in background tabs (the default); SSE/WebSocket messages update the query cache (setQueryData or invalidate), reconnect with backoff and jitter, and refetch after reconnect to fill the gap.
  8. Fail safely. Retry only idempotent reads and transient errors (network, 5xx, 429 honouring Retry-After); do not retry 4xx. A 401 triggers one refresh or a redirect to sign-in, not a loop. Render errors inside an error boundary with a reset.
  9. Test each AC's behaviour (the frontend-testing skill) with the network mocked at the fetch boundary (MSW or the repo's equivalent) and a fresh QueryClient with retry: false per test:
    • each state the AC names renders (pending, empty, error with retry, success);
    • the mutation updates what the user sees (assert the list, not that a function ran);
    • optimistic rollback: server returns 500 → the old value is back and an error shows;
    • race: respond to request A after request B → B's data is shown;
    • double-click submit → exactly one request;
    • stale version: server returns 409/412 → the user's input is kept and the conflict is shown.
  10. Evidence per AC with the record-evidence skill, then stop.

Read the full file on GitHub · 92 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. 16d ago Changed · +28 lines · +6 tokens per session b75e98813be7
  2. 19d ago First seen · 64 lines · 106 tokens per session scan A d3058fd21c9c

Subscribe to this mod's changes

frontend-data-fetching is a skill published in the GitHub repository tmj-90/gaffer (2 stars, last pushed 17d ago), licensed Apache-2.0. It adds 112 tokens to every session and 1,518 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.

Related

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.

QBall-Inc/the-bulwark · 50 tokens

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.

QBall-Inc/the-bulwark · 38 tokens

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.

QBall-Inc/the-bulwark · 40 tokens

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.

QBall-Inc/the-bulwark · 42 tokens

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.

QBall-Inc/the-bulwark · 0 tokens

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.

QBall-Inc/the-bulwark · 61 tokens