swr-docs

swr-docs is a skill for Claude Code, Codex from pledgeandgrow/pledge-skills. It costs 29 tokens per session (906 once invoked), scanned A, original, MIT.

Reference material for SWR, a React library that loads data from web services and keeps it cached and up to date. React is a JavaScript library for building user interfaces.

In plain words
What is it for?
Use it when fetching API data in React applications, updating records, preloading results, or subscribing to live data.
Why use it?
It helps prevent repeated data-loading code and handles common concerns such as caching, refreshing, pagination, and errors.

Skill for Claude CodeCodex

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

Good fit Use it when fetching API data in React applications, updating records, preloading results, or subscribing to live data.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/pledgeandgrow/pledge-skills/swr"><img src="https://agentmods.dev/badge/skills/pledgeandgrow/pledge-skills/swr.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 29 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 906 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.
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.00029 $0.00906
Opus 5 $0.00015 $0.00453
Sonnet 5 $0.00006 $0.00181
Haiku 4.5 $0.00003 $0.00091

Measured 8d ago against content hash d6495b66e66a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

swr-docs 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 8d 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 fetcher = (url: string) => fetch(url).then(r => r.json())
skills/swr/SKILL.md · 79 lines

How it starts

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

SWR — Complete Skill Reference

Quick Reference

Topic File
Getting Started (installation, quick start, reusable hooks) getting-started.md
Core Concepts (useSWR, keys, fetchers, conditional fetching) core-concepts.md
Options (all useSWR options, SWRConfig, global configuration) options.md
Mutation (useSWRMutation, optimistic updates, rollback, populateCache) mutation.md
Pagination (useSWRInfinite, index/cursor pagination, parallel fetching) pagination.md
Prefetching (preload, fallback data, RSC prefetch, HTML preload) prefetching.md
Revalidation (focus, interval, reconnect, immutable, mount) revalidation.md
Cache (cache providers, mutate, global mutate, cache modifiers) cache.md
Middleware (custom middleware, logger, laggy, serialize) middleware.md
Suspense (suspense mode, error boundaries, SSR, conditional) suspense.md
Subscription (useSWRSubscription, WebSocket, Firestore, dedup) subscription.md
Error Handling (status codes, retry, global error report) error-handling.md
TypeScript (type inference, generics, Fetcher, middleware types) typescript.md
Next.js Integration (App Router, RSC, SSG/SSR, fallback) nextjs.md
Advanced (understanding SWR, cache providers, performance, React Native) advanced.md
API Reference (all hooks, functions, types) api-reference.md

Core Concepts

  • useSWR Hook: The fundamental API — pass a key and fetcher, get data/error/isLoading
  • Cache Keys: String, array, object, or function keys — automatically serialized
  • Fetcher Agnostic: Works with fetch, Axios, GraphQL, or any Promise-returning function
  • Automatic Revalidation: On focus, reconnect, interval — all configurable
  • Request Deduplication: Identical requests within dedupingInterval are merged
  • Mutation: Update cached data via bound/global mutate or useSWRMutation
  • Pagination: useSWRInfinite for index-based or cursor-based pagination
  • Prefetching: preload API, fallback data, or HTML <link rel="preload">
  • Middleware: Wrap SWR hooks with custom logic (logging, laggy, serialization)
  • Suspense: Full React Suspense support with error boundaries
  • Subscription: Real-time data via useSWRSubscription (WebSocket, Firestore)
  • SSR/SSG: Pre-fill data via fallback, prefetch in Server Components
  • TypeScript: Full type inference and explicit generic support

Read the full file on GitHub · 79 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. 8d ago First seen · 79 lines · 29 tokens per session scan A d6495b66e66a

Subscribe to this mod's changes

swr-docs is a skill published in the GitHub repository pledgeandgrow/pledge-skills (10 stars, last pushed 1mo ago), licensed MIT. It adds 29 tokens to every session and 906 once invoked, about $0.0001 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-03.