Service worker cache strategy review

From Raishin/vanguard-frontier-agentic · View interactive version

Service worker cache strategy review is an AI agent skill from the GitHub repository Raishin/vanguard-frontier-agentic. Reviews service-worker route-matching and caching-strategy choices (precache vs. cache-first vs. network-first vs. stale-while-revalidate) against request type and security sensitivity, rejecting uniform blanket strategies and flagging authenticated/PII responses cached in the Cache API.

How to use this skill

Skill file

Service Worker Cache Strategy Review

Purpose

A service worker is a persistent, cross-session, JS-controlled cache layer that sits in front of every network request the browser makes for a scope. Unlike HTTP caching, it is not opt-in per response — once a route is matched, the developer's strategy code decides freshness and disclosure, not Cache-Control. The common failure mode is copy-pasting one strategy (usually CacheFirst, straight from a tutorial) across navigation, API, and asset routes without differentiating by freshness need or security sensitivity. This skill performs the per-route-class review that catches both the stale-content incidents that uniform cache-first causes on navigation/API routes, and the security incidents that happen when authenticated or PII-bearing responses land in a persistent Cache API store that Workbox strategies do not automatically protect.

When to use

Use this skill when the user asks to:

When not to use

Context7 Documentation Protocol

Workbox strategy internals and Vite-PWA config surface change between major versions — never assert runtime semantics (what bypasses HTTP headers, what revalidates, what the default expiration behavior is) from memory.

  1. Call ToolSearch with query "context7" (or "select:mcp__Context7__resolve-library-id,mcp__Context7__query-docs") to load the Context7 tools if not already loaded in this session.
  2. Resolve /googlechrome/workbox for the strategy implementation in question (PrecacheStrategy, CacheFirst, NetworkFirst, StaleWhileRevalidate, NetworkOnly, ExpirationPlugin, cleanupOutdatedCaches).
  3. Resolve /websites/vite-pwa-org_netlify_app (or the closest match) when the project uses Vite PWA's generateSW/injectManifest config surface, runtimeCaching, skipWaiting/clientsClaim, or custom injectManifest service-worker source.
  4. Query for the exact behavior before ruling — e.g. "does PrecacheStrategy revalidate against Cache-Control", "NetworkFirst networkTimeoutSeconds fallback behavior", "ExpirationPlugin maxAgeSeconds vs maxEntries eviction order" — per review, not once from a prior session.
  5. A confirmed, version-specific fact from Context7 (e.g. precacheAndRoute serves via PrecacheStrategy, which reads from the Cache API and returns immediately on a hit, completely bypassing HTTP Cache-Control since no network round-trip occurs) is materially different from the general folk claim "precache is cache-first" — cite the specific mechanism, not the folk version.
  6. If Context7 is unavailable or has no relevant match, fall back to official_docs / references/workbox-strategy-semantics.md, and mark the claim documentation-based (Context7 unavailable) rather than presenting it as freshly verified.
  7. Never invent a Workbox option, plugin, or config key that no queried source confirms.

Lean operating rules

References

Load these only when needed:

Response minimum

Return, at minimum:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.