add-pwa
Skill50 starsChanged 22 days agoApache-2.0View on GitHub
Turns a Next.js app into an installable PWA (Progressive Web App) on mobile and desktop. Adds the manifest, a service worker (Serwist) with a minimal offline cache, icons generated from the project favicon, the iOS meta tags, and a small window inviting the user to install the app (native Android prompt, "Add to Home Screen" instructions on iOS). Prerequisite for /add-push-notification. Can be called by /bootstrap or standalone.
- Reads credentials
- Installs packages
1 other project uses a version of this.
Adopted by
Most recently taken up by
- flavien-ia/hypervibe-harnessword for word, first seen Oct 23, 2026
Other versions1 project uses a version of this.
Word for word · 1
- flavien-ia/hypervibe-harness★ 50100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository89 other files it gives its agents.
- accessibilitySkill
- add-2faSkill
- add-agent-dashboardSkill
- add-aiSkill
- add-analyticsSkill
- add-authSkill
- add-automationSkill
- add-backup-dbSkill
- add-collabSkill
- add-cronSkill
- add-dark-modeSkill
- add-dbSkill
- add-domainSkill
- add-emailSkill
- add-github-authSkill
- add-google-authSkill
- add-i18nSkill
- _add-keyringSkill
- add-mapSkill
- add-notification-centerSkill
- add-push-notificationSkill
- add-roleSkill
- add-routineSkill
- add-storageSkill
- add-stripeSkill
- add-testSkill
- bootstrapSkill
- _check-depsSkill
- cleanSkill
- _collect-secretSkill
- _convert-to-turborepoSkill
- _create-agentSkill
- _create-cloudflare-workerSkill
- _create-contact-pageSkill
- _create-render-workerSkill
- _create-routineSkill
- _create-workflowSkill
- delete-projectSkill
- _detect-project-rootSkill
- _dns-brevoSkill
- _dns-cloudflareSkill
- _dns-gandiSkill
- _dns-godaddy-manualSkill
- _dns-hostingerSkill
- _dns-infomaniak-manualSkill
- _dns-ionos-manualSkill
- _dns-lwsSkill
- _dns-namecheapSkill
- _dns-ovhSkill
- _dns-porkbunSkill
- _dns-resendSkill
- _dns-squarespace-manualSkill
- eco-auditSkill
- _ensure-aiSkill
- _ensure-vaultSkill
- _generate-secretSkill
- geoSkill
- _get-secretSkill
- gscSkill
- _hash-passwordSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Use plain, non-technical business language.
- Distinctive: line 15
When generating user-facing content for the scaffolded project (UI labels, emails, copy), write it in the user's language too.
- Very specific: line 36
Favicon source: check that <WEB_DIR>/src/app/icon.svg exists (generated by /bootstrap).
- Very specific: line 82
Add the SW's generated artifacts to .gitignore:
- Very specific: line 140
Never: run pnpm build or the dev server to "see" the PWA.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Add PWA: installable app (Serwist)
You turn the current project's Next.js app into a PWA: installable on the home screen, launchable in full screen, with a service worker that serves a fallback offline cache. You also add a small window that invites the user to install the app and explains how to do it on mobile.
Communication
- Detect the user's language from the conversation (the user's own messages, anywhere in the session - not just this invocation: a bare slash command like
/bootstrapcarries no language signal by itself). If nothing in the conversation gives a signal, fall back to the OS locale (node -e "console.log(Intl.DateTimeFormat().resolvedOptions().locale)") before defaulting to English. ALWAYS reply in that language for every user-facing message: questions, progress, confirmations, summaries, errors - including any example text quoted in this skill, which is illustrative and must be translated, never sent verbatim. - Use plain, non-technical business language. Never expose internal script names (*.mjs) or jargon; describe actions in human terms.
- When generating user-facing content for the scaffolded project (UI labels, emails, copy), write it in the user's language too.
- Show progress as a short natural-language checklist (in-progress and done states).
Step 0: Re-run? (idempotence)
Detect whether the PWA is already in place: the hypervibe:pwa marker at the top of <WEB_DIR>/src/app/manifest.ts.
test -f "<WEB_DIR>/src/app/manifest.ts" && grep -q "hypervibe:pwa" "<WEB_DIR>/src/app/manifest.ts" && echo present || echo absent- absent → initial installation, continue to Step 1.
- present → show a menu: (1) regenerate the icons, (2) change the manifest name / colors, (3) reinstall the service worker, (4) reinstall the install window, (5) redo everything. Only handle what is requested, then jump to the summary.
Step 1: Prerequisites
- Detect project root: invoke
_detect-project-root→WEB_DIR,IS_MONOREPO,PROJECT_NAME,IS_NEXTJS. Abort if not Next.js (the PWA relies on Next's App Router). - Favicon source: check that
<WEB_DIR>/src/app/icon.svgexists (generated by/bootstrap). If it is missing, create it first (rounded square with the project initial, palette fromglobals.css) or ask for a square logo, since the PWA icons derive from it.
The path to the templates and scripts: ${CLAUDE_SKILL_DIR}/../../templates/pwa/ and ${CLAUDE_SKILL_DIR}/../../scripts/.
Step 2: Install Serwist
pnpm add @serwist/next serwist
pnpm add -D sharp(sharp is only used to generate the icons in Step 4, it is a dev dependency.)
⚠️ With pnpm 10, installing sharp may show Ignored build scripts: sharp: this is harmless (the precompiled binaries come through optional dependencies, the build script is just a fallback). Do not run pnpm approve-builds, do not try to "fix" it: verified in real conditions, sharp works as is.
Step 3: Manifest
- Copy
templates/pwa/manifest.tsto<WEB_DIR>/src/app/manifest.ts(Next then serves/manifest.webmanifestand automatically injects<link rel="manifest">). - Replace the placeholders based on the project context:
__APP_NAME__/__SHORT_NAME__: from the project'sCLAUDE.mdorpackage.json. Keep the short name short (12 chars max, display constraint under the icon).__APP_DESCRIPTION__: one sentence.__THEME_COLOR__/__BG_COLOR__: read the background and accent color fromglobals.css(palette variables). Thetheme_colorcolors the status bar once installed.__LANG__: the project's default locale (frusually; readi18n/routing.tsif i18n).
- Do NOT remove the
// hypervibe:pwacomment (it is the marker that/add-push-notificationdetects).
Step 4: Service worker (Serwist) + icons
4a. Service worker
- Copy
templates/pwa/sw-base.tsto<WEB_DIR>/src/app/sw.ts(minimal offline cache: NetworkFirst, fresh content as soon as there is network, offline fallback otherwise). Keep the// hypervibe:push-handlersmarker (insertion point for/add-push-notification). - Wrap the Next config with Serwist. Read
<WEB_DIR>/next.config.*and add at the top:
and exportimport withSerwistInit from "@serwist/next"; const withSerwist = withSerwistInit({ swSrc: "src/app/sw.ts", swDest: "public/sw.js", disable: process.env.NODE_ENV === "development", // évite les soucis de cache en dev });withSerwist(config)instead ofconfig(adapt to the existing form of the file, CJS or ESM). - Add the SW's generated artifacts to
.gitignore:public/sw.js public/swe-worker-*.js - Exclude the generated SW from the tsconfig (CRITICAL, verified in real conditions): the T3 tsconfig has
checkJs: true, so without this exclusion thenext buildfails while typechecking the minifiedpublic/sw.js("implicitly has type 'any'"). Intsconfig.json, add toexclude:
(merge with the existing entries, do not replace them)."exclude": ["node_modules", "generated", "public/sw.js", "public/swe-worker-*.js"]
4b. Icons
Generate the manifest PNGs from the SVG favicon, with the theme's background color. Mandatory: run with the cwd at the project root (cd "<WEB_DIR>"), because the script resolves sharp from the current project:
cd "<WEB_DIR>" && node "${CLAUDE_SKILL_DIR}/../../scripts/generate-pwa-icons.mjs" \
--svg "<WEB_DIR>/src/app/icon.svg" --out "<WEB_DIR>/public/icons" --bg "<THEME_COLOR_HEX>"--bg expects a hex (#RRGGBB): if the globals.css palette is in oklch()/hsl(), convert the color to hex before the call. Produces icon-192.png, icon-512.png, icon-maskable-512.png (solid background + safe zone) and apple-touch-icon.png.
Step 5: iOS meta + install window
- Copy
templates/pwa/ios-share-icon.tsxandtemplates/pwa/install-prompt.tsxto<WEB_DIR>/src/components/. - In
install-prompt.tsx: replace__APP_NAME__and__LOGO_LETTER__(project initial), and adapt the color classes (bg-foreground/bg-background/border-border) to the actual palette if the tokens differ (readglobals.css). - Mount
<InstallPrompt />in the root layout (<WEB_DIR>/src/app/layout.tsx, or[locale]/layout.tsxif i18n), just before</body>. - iOS meta in the root layout's
metadata/viewport(Next 15):
(Merge with an existingexport const metadata: Metadata = { // ...existant... appleWebApp: { capable: true, statusBarStyle: "default", title: "<SHORT_NAME>" }, icons: { apple: "/icons/apple-touch-icon.png" }, }; export const viewport: Viewport = { themeColor: "<THEME_COLOR_HEX>" };metadata/viewportrather than duplicating it.)
The window only shows on mobile/tablet, not if the app is already installed, and reappears 3 days after a "Later".
Step 6: CLAUDE.md
Invoke _update-claude-md with:
stack:- **PWA** : Serwist (service worker, manifest, installable) ; icônes dans \public/icons/``conventions:- PWA : le service worker est \src/app/sw.ts` (compilé en `public/sw.js` au build, désactivé en dev). Pour ajouter des notifications push, lancer `/add-push-notification` (qui étend ce service worker).`
Step 7: Verification + summary
cd "<WEB_DIR>" && pnpm tsc --noEmit && pnpm lintNever run pnpm build or the dev server to "see" the PWA. The service worker is only active in build/prod (disabled in dev); installability is verified after deployment.
Summary for the user:
- The app is now installable (home screen, full screen).
- A window invites installation on mobile (native button on Android, "Add to Home Screen" instructions on iOS).
- Minimal offline cache in place.
- To test after deployment: open the site on mobile, check the invitation and installation.
- Possible next step:
/add-push-notificationto send push notifications (needs this PWA).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

