web-pwa-service-workers
Installation
SKILL.md
Service Worker Patterns
Quick Guide: A service worker is a programmable network proxy with its own lifecycle: install precaches, activate cleans up, fetch intercepts. Match the caching strategy to the content — cache-first for hashed assets, network-first for HTML, stale-while-revalidate for non-critical API reads. Two details cause most bugs: a response body can be read once, so
cache.put(request, response.clone()), and a new worker waits until every tab using the old one closes, so updates need explicit detection and a user-triggeredskipWaiting.
Detailed Resources:
- examples/core.md — registration, the full lifecycle template, the four strategy implementations, message types
- examples/caching.md — background refresh, expiry timestamps, per-endpoint routing, navigation preload, quota cleanup
- examples/updates.md — version messaging, aggressive/deferred/idle updates, progressive rollout, cache migration
- reference.md — strategy-by-content-type table, lifecycle and Cache API lookup, update-strategy selection, review checklist