web-data-fetching-swr

web-data-fetching-swr is a skill for Claude Code, Codex from agents-inc/skills. It costs 41 tokens per session (3,164 once invoked), scanned A, original, MIT.

A guide to fetching server data in React with SWR, a library that can show cached data while checking for newer data in the background. It covers reads, writes, conditional requests, retries, and infinite scrolling.

In plain words
What is it for?
Use it to build cached data queries, background refreshes, conditional fetching, write actions, and paginated or infinite-scroll lists in React applications.
Why use it?
It helps avoid stale screens, repeated requests, and incorrect loading states. It also sets clear rules for stable request keys and for keeping write operations separate from reads.

Skill for Claude CodeCodex

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

Good fit Use it to build cached data queries, background refreshes, conditional fetching, write actions, and paginated or infinite-scroll lists in React applications.

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

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/agents-inc/skills/web-data-fetching-swr"><img src="https://agentmods.dev/badge/skills/agents-inc/skills/web-data-fetching-swr.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,164 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 4 findings, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Excessive Agency · line 16
    Skill allows unbounded resource consumption (API calls, storage, compute). Without rate limits or quotas, a compromised or misbehaving agent can cause denial-of-service or cost overruns.
    Fix: Set explicit rate limits, timeouts, and resource quotas for API calls, file operations, and compute. Implement circuit breakers for runaway loops.
  • medium Excessive Agency · line 341
    Skill allows unbounded resource consumption (API calls, storage, compute). Without rate limits or quotas, a compromised or misbehaving agent can cause denial-of-service or cost overruns.
    Fix: Set explicit rate limits, timeouts, and resource quotas for API calls, file operations, and compute. Implement circuit breakers for runaway loops.
  • medium Excessive Agency · line 375
    Skill allows unbounded resource consumption (API calls, storage, compute). Without rate limits or quotas, a compromised or misbehaving agent can cause denial-of-service or cost overruns.
    Fix: Set explicit rate limits, timeouts, and resource quotas for API calls, file operations, and compute. Implement circuit breakers for runaway loops.
  • medium Excessive Agency · line 385
    Skill allows unbounded resource consumption (API calls, storage, compute). Without rate limits or quotas, a compromised or misbehaving agent can cause denial-of-service or cost overruns.
    Fix: Set explicit rate limits, timeouts, and resource quotas for API calls, file operations, and compute. Implement circuit breakers for runaway loops.
How audits are shown
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.00041 $0.03164
Opus 5 $0.00020 $0.01582
Sonnet 5 $0.00008 $0.00633
Haiku 4.5 $0.00004 $0.00316

Measured 2d ago against content hash 008488714cfc, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

web-data-fetching-swr scanned grade A with 1 finding 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 2d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

const response = await fetch(url);
src/skills/web-data-fetching-swr/SKILL.md · 353 lines

How it starts

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

SWR Patterns

Quick Guide: SWR renders the cached value immediately and revalidates behind it, so the cache key is the whole identity of a request and an unstable key is the single most expensive mistake here. isLoading covers the first fetch only and isValidating covers every fetch, which is why using the second as a spinner hides the data SWR exists to show. Reads are useSWR, writes are useSWRMutation, and a null key is how a request is skipped without breaking the rules of hooks.

Detailed Resources:


Which path applies

  • Reading a resourceuseSWR, which fetches on mount and keeps the value fresh. Patterns 1–3.
  • WritinguseSWRMutation, which does nothing until trigger() is called. Pattern 4.
  • A list that growsuseSWRInfinite, whose getKey(pageIndex, previousPage) both builds each page's key and signals the end by returning null. Pattern 7.
  • Suspense instead of loading branchessuspense: true makes the component suspend and data non-null; see examples/suspense.md. Everything else here still applies.

<critical_requirements>

Before writing SWR code

Read the full file on GitHub · 353 lines

Files

What ships with it

9 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 2d ago Changed · -35 lines · +12 tokens per session 008488714cfc
  2. 5d ago First seen · 388 lines · 29 tokens per session scan A fb203c716074

Subscribe to this mod's changes

web-data-fetching-swr is a skill published in the GitHub repository agents-inc/skills (24 stars, last pushed 2d ago), licensed MIT. It adds 41 tokens to every session and 3,164 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-05.

Related

Other skills, from other repositories

moai-design-tools

Design tool integration specialist covering Figma MCP, Pencil renderer, and Pencil-to-code export. Use when fetching design context from Figma, rendering Pencil designs, or exporting to React/Tailwind code.

modu-ai/moai-adk · 45 tokens

moai-domain-uiux

UI/UX design systems specialist covering accessibility, icons, theming, design tokens, and user experience patterns. Use when working on design systems, WCAG compliance, ARIA patterns, or dark mode theming.

modu-ai/moai-adk · 49 tokens

react-modern

Use this skill when writing or reviewing React 19+ code in WrongStack. Triggers: user mentions "React", "component", "useState", "useEffect", "Server Component", "Client Component", "Suspense", "useTransition", "use hook".

WrongStack/WrongStack · 57 tokens

keyboard-accessibility

Load this skill for any project with interactive UI, such as buttons, links, forms, modals, dropdowns, menus, tabs, sliders, toolbars, carousels, or custom widgets, in React or vanilla JavaScript. Never ship an interactive element that cannot be fully operated by keyboard alone. Always ensure a visible focus…

planetabhi/riseofmachine · 97 tokens

nextjs-16

Build Next.js 16 apps with Turbopack, Cache Components, proxy.ts, Server Actions, React 19.2 View Transitions, and App Router patterns. Covers streaming SSR, ISR, error boundaries, and advanced routing.

medy-gribkov/arcana · 53 tokens

frontend-code-review

Review React/TypeScript frontend code against code quality, performance, and business logic rules. Provides structured findings with file paths, line numbers, and suggested fixes.

medy-gribkov/arcana · 36 tokens