void-service-worker-strategy

Configure service worker caching strategies per route class using Serwist or vite-plugin-pwa.

Updated May 29, 2026
One-click install
npx skills add https://github.com/voidcorp-core/void-harness --skill void-service-worker-strategy-voidcorp-core
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: void-service-worker-strategy
Source: https://github.com/voidcorp-core/void-harness/tree/main/packages/cli/core-assets/packs/pack-pwa/skills/void-service-worker-strategy
Command: npx skills add https://github.com/voidcorp-core/void-harness --skill void-service-worker-strategy-voidcorp-core

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Choosing the wrong caching strategy per resource type causes stale pages after deploys, missing offline support, or unbounded cache growth. This Skill provides the canonical strategy-per-route-class table, cache versioning rules, and update activation patterns so a PWA's service worker behaves correctly. ## Core Features & Use Cases - Strategy selection per route class: Maps HTML pages, hashed JS/CSS bundles, fonts, images, and API responses to NetworkFirst, CacheFirst, StaleWhileRevalidate, or NetworkOnly with concrete options like networkTimeoutSeconds and maxEntries. - Cache versioning and cleanup: Shows how to embed a build hash in every cacheName and delete orphaned caches on activation to prevent quota exhaustion and broken pages after deploys. - Update activation UX: Covers silent activation, reload-to-update prompts via workbox-window, and aggressive skipWaiting/clientsClaim, with guidance on which fits checkout-sensitive flows. - Use Case: When adding a service worker to a Next.js 16 app with Serwist, use this Skill to scaffold the runtimeCaching config, version the caches, and pick an update prompt pattern. ## Quick Start Ask the agent to configure a service worker for your PWA with the correct caching strategy per route class and versioned cache names.

Frequently Asked Questions about void-service-worker-strategy

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I choose a service worker caching strategy per route?

Match the strategy to each resource's freshness versus availability trade-off. Use NetworkFirst with a 3-second timeout for HTML, CacheFirst for hashed JS/CSS and fonts, StaleWhileRevalidate for tolerable-stale API responses, and NetworkOnly for APIs requiring fresh data.

Serwist vs vite-plugin-pwa for service workers, which should I use?

Use Serwist for Next.js 16 since it supports the App Router as a modern Workbox successor, and vite-plugin-pwa for Vite projects since it wraps Workbox. Both expose the same strategy classes; only the config shape differs.

Why is my PWA showing stale content after a deploy?

Stale content usually comes from CacheFirst on HTML or cache names without a version. Include a build hash in every cacheName and clean up old caches on activation so the new worker stops reading outdated entries.

Can service workers cache POST or PUT requests?

No, service workers only cache GET requests; mutations like POST, PUT, and DELETE are not cacheable. Handle offline writes with a capture-queue mechanism alongside the service worker instead.

Why is my service worker not registering in the browser?

Service workers only register on HTTPS or localhost, so plain HTTP deployments fail silently. Check DevTools under Application, Service Workers, and use Unregister plus a hard reload to reset broken state.