kensaurus/skills/enhance-pwa
Claude Code and agent skill by kensaurus/skills
- community
Checking that the SKILL.md file is still in the repository.
Add or upgrade PWA features: manifest, service worker, offline mode, install prompt, push, background sync. Use when "make it a PWA", "offline support", or "install prompt". Native → mobile-capacitor-platform.
Install
npx vskill@latest install kensaurus/skills/enhance-pwaSKILL.md
The same SKILL.md was published earlier as kensaurus/skills/enhance-pwa.
enhance-pwa — Make It Installable and Offline-Ready
Degree of freedom: MIXED. Strategy and prompt timing [HIGH freedom]; caching rules, Capacitor bypass, and the installability check [LOW freedom — run exactly].
A PWA closes the gap between "website" and "app". Users can install it to their home screen, it loads instantly from cache, and it keeps working when the network drops. This skill adds those capabilities to any existing web app without breaking what already works.
This skill vs neighbors
| Skill | Owns | |
|---|---|---|
| enhance-pwa (this) | PWA features: manifest, service worker, offline, install prompt, push, sync | |
mobile-capacitor-platform | Capacitor native layer: system bars, keyboard, back, plugins, push, OTA | |
workflow-launch-ready | Launch-preparation sweep before a new app or major release goes live |
How to reason
- Audit — manifest, SW, framework plugin already present
- Choose — caching strategy per asset type; Workbox over raw SW
- Ship — installable manifest + offline fallback + autoUpdate
- Prove — DevTools shows no installability errors; offline revisit works; Capacitor bridge not intercepted
Worked example
Audit: Next.js app; no manifest link; no SW; also ships Capacitor.Choose: Serwist (Workbox fork) via@serwist/turbopack; NetworkFirst APIs; CacheFirst images; skipcapacitor://.Ship:manifest.webmanifest+ 192/512 icons +/offline.html; install prompt after first success.Prove: offline revisit of/works; DevTools Manifest pane shows no installability errors; native bridge still functions.
Self-critique before reporting
- No stale deploys —
autoUpdate, not silent stale cache - No secrets in cache — auth tokens and sensitive APIs are NetworkOnly
- Offline path — fallback page or cached shell, not a browser error
- Right owner — native Capacitor shell →
mobile-capacitor-platform; confirm bridge viamobile-emulator-test
Phase 0: Audit what already exists [HIGH freedom]
Also check the basics in the page (Lighthouse 12+ has no PWA category):
Phase 1: Research framework-specific PWA tooling [HIGH freedom]
Follow /research: Context7 for the PWA plugin that matches the framework (vite-plugin-pwa, @serwist/turbopack or @serwist/next, @vite-pwa/nuxt), Firecrawl for current service-worker and offline guidance. Search the plugin name as written and anchor to the framework version actually installed — recognizing a package is not knowing its current API.
Phase 2: Web App Manifest [HIGH freedom]
The manifest is what makes the app installable. Create or improve public/manifest.webmanifest:
Reference the manifest in <head>:
Icon requirements:
- 192×192 and 512×512 minimum; add 180×180 for Apple Touch Icon
- PNG with transparent background OR maskable (safe zone = inner 80%)
- Generate from a single source SVG using
sharporpwa-asset-generator
Phase 3: Service Worker — caching strategy [HIGH freedom]
Use Workbox (via the framework plugin) rather than writing raw service worker code. Choose the right caching strategy per asset type:
| Asset type | Strategy | Why | |
|---|---|---|---|
| App shell (HTML/JS/CSS) | CacheFirst + revision hash | Fast loads, updated on deploy | |
| API data (list/detail) | NetworkFirst with 5s timeout | Fresh data, offline fallback | |
| Images | CacheFirst, 30-day expiry | Rarely changes | |
| Fonts | CacheFirst, 1-year expiry | Never changes | |
| Analytics/telemetry | NetworkOnly | No value in caching |
Vite (vite-plugin-pwa)
Next.js (Serwist, or an existing next-pwa)
Next.js has no built-in service worker. It ships the app/manifest.ts file convention, and 16.3 added an experimental experimental.useOffline flag that detects connectivity and retries requests but does not cache pages. For Workbox-style caching the Next.js PWA guide points to Serwist, a Workbox fork: @serwist/turbopack for Turbopack builds (the next build default since Next.js 16) or @serwist/next for webpack builds. Take the setup for the installed Next.js version from the Serwist docs.
@ducanh2912/next-pwa is webpack-only (last release 10.2.9, September 2024) and its README recommends migrating to @serwist/next. Keep it only where a repo already uses it, and on Next.js 16+ build with next build --webpack:
Capacitor compatibility
If the app also ships as a Capacitor native app, the service worker must not intercept Capacitor's bridge requests. Add to the service worker:
Phase 4: Offline page and graceful degradation [HIGH freedom]
When the network is unavailable and a cached response does not exist, show a helpful offline page rather than a browser error:
Register it as the fallback. Workbox's navigateFallback answers every non-precached navigation with one HTML file, online or not, so it is the SPA shell (vite-plugin-pwa defaults it to index.html), not an offline page. For server-rendered pages, precache offline.html and attach it to the navigation route:
With Serwist (Next.js), precache the page through additionalPrecacheEntries and list it in the Serwist constructor's fallbacks.entries with a request.destination === 'document' matcher.
Phase 5: Install prompt (optional but high-value) [HIGH freedom]
Do not use the browser's default install prompt — it appears at the wrong time. Instead, intercept beforeinstallprompt and show it when the user has demonstrated value (e.g. after completing a core action):
Show a custom banner with clear benefits ("Install for offline access and faster loads"), not just "Add to Home Screen". beforeinstallprompt fires only in Chromium browsers; Safari (including iOS) and Firefox never fire it, so on iOS show Share → Add to Home Screen instructions instead.
Phase 6: Push notifications (if backend supports it) [HIGH freedom]
Only implement push if the app has a genuine reason to send notifications (not just to ask for permission on first load — users will deny that).
For the backend, use web-push (Node.js) or your platform's push service.
Phase 7: Verify installability and offline [LOW freedom — do not skip]
Lighthouse removed its PWA category in v12.0 (April 2024), so there is no PWA score to target. Check in Chrome DevTools → Application instead: the Manifest pane's Installability section must list no errors, and in Service workers tick Offline and reload start_url.
Key checks:
- [ ] Manifest present and installable
- [ ] Service worker registered
- [ ] Works offline (offline page or cached response)
- [ ] HTTPS (localhost counts)
- [ ]
viewportmeta tag present - [ ] Icons correct size and format
- [ ]
start_urlloads while offline
Guardrails
- Service worker caching can break deployments if old caches persist.
Use registerType: 'autoUpdate' (the new service worker takes control at once; open tabs reload only when the app registers through virtual:pwa-register, e.g. registerSW({ immediate: true })) or 'prompt' (the user is asked to reload) — never a silent background update that keeps serving stale precached code.
- Never cache auth tokens or sensitive API responses in the service worker.
- Test offline mode manually via DevTools → Network → Offline before shipping.
- Capacitor apps: confirm the Capacitor bridge still works after adding the
service worker by running mobile-emulator-test.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/enhance-pwa/SKILL.md
Popularity
- Repository stars
- 10
- Repository forks
- 1
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/kensaurus/skills/enhance-pwa)