service-worker
Installation
SKILL.md
Register a service worker for caching and offline support
Service workers act as a programmable network proxy between the browser and the network. They eliminate repeated server round-trips for static assets, cut load times on repeat visits by 50–90 %, and allow the app to function at all on flaky or offline networks — which is critical for users on mobile or low-bandwidth connections.
Quick Reference
- Register a service worker in your main JavaScript entry point
- Use an install event to pre-cache critical static assets
- Choose a caching strategy (cache-first, network-first, stale-while-revalidate) per resource type
- Implement an activate event to clean up old caches on update
Check
Check whether a service worker is registered and whether it caches static assets, API responses, or provides an offline fallback.
Fix
Add a service worker registration call and implement appropriate caching strategies for static assets and navigation requests.