/hypervibe:add-pwafrom hypervibe
Adds PWA support to a Next.js app: manifest, Serwist service worker with offline cache, icons from favicon, iOS meta tags, and install prompt.
Ships in hypervibe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
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.
/bootstrap carries 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.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
_detect-project-root → WEB_DIR, IS_MONOREPO, PROJECT_NAME, IS_NEXTJS. Abort if not Next.js (the PWA relies on Next's App Router).<WEB_DIR>/src/app/icon.svg exists (generated by /bootstrap). If it is missing, create it first (rounded square with the project initial, palette from globals.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/.
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.
templates/pwa/manifest.ts to <WEB_DIR>/src/app/manifest.ts (Next then serves /manifest.webmanifest and automatically injects <link rel="manifest">).__APP_NAME__ / __SHORT_NAME__: from the project's CLAUDE.md or package.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 from globals.css (palette variables). The theme_color colors the status bar once installed.__LANG__: the project's default locale (fr usually; read i18n/routing.ts if i18n).// hypervibe:pwa comment (it is the marker that /add-push-notification detects).templates/pwa/sw-base.ts to <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-handlers marker (insertion point for /add-push-notification).<WEB_DIR>/next.config.* and add at the top:
import 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
});
and export withSerwist(config) instead of config (adapt to the existing form of the file, CJS or ESM)..gitignore:
public/sw.js
public/swe-worker-*.js
checkJs: true, so without this exclusion the next build fails while typechecking the minified public/sw.js ("implicitly has type 'any'"). In tsconfig.json, add to exclude:
"exclude": ["node_modules", "generated", "public/sw.js", "public/swe-worker-*.js"]
(merge with the existing entries, do not replace them).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.
templates/pwa/ios-share-icon.tsx and templates/pwa/install-prompt.tsx to <WEB_DIR>/src/components/.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 (read globals.css).<InstallPrompt /> in the root layout (<WEB_DIR>/src/app/layout.tsx, or [locale]/layout.tsx if i18n), just before </body>.metadata / viewport (Next 15):
export 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>" };
(Merge with an existing metadata/viewport rather than duplicating it.)The window only shows on mobile/tablet, not if the app is already installed, and reappears 3 days after a "Later".
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).`cd "<WEB_DIR>" && pnpm tsc --noEmit && pnpm lint
Never 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:
/add-push-notification to send push notifications (needs this PWA).What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub flavien-ia/hypervibe-craft --plugin hypervibe90 skills in this plugin
/accessibilityAccessibility audit of a Next.js app: reads the code (images, buttons, links, form fields, keyboard, focus, zoom, motion), measures the live pages with PageSpeed Insights, explains each problem plainly, then applies the fixes the user approves./add-2faAdd two-factor authentication (2FA TOTP) to an existing T3 project's login. Orchestrator - asks which authenticator app the user wants, detects whether the project uses admin auth (single fixed login) or user accounts, and delegates to the right setup. Admin mode - 2FA is mandatory for the single admin, secret + backup codes stored in the Bitwarden vault. User mode - 2FA is optional per user, each user enables it from their account page, secrets + backup codes stored per-user in the database. Requires the project to already have hypervibe auth (`/add-auth`)./add-agent-dashboardAdd a monitoring screen for AI agents in the project admin: cost, run history, turn-by-turn traces, and a button to launch a run by hand. Installed when an agent is created, safe to re-run./add-aiAdd AI to an existing Next.js project: chat assistant, content processing, or generation. Estimates the cost from live prices and provisions a spending-capped key before writing any code. Model-independent through OpenRouter./add-analyticsAdd Google Analytics (GA4) to an existing Next.js project. Includes RGPD cookie consent banner./add-authAdd NextAuth (Auth.js) authentication to an existing T3 project. One structured question decides the mode - admin (fixed login in env vars) or users (DB-backed email+password with signup, signin, account page, delete account, and optional forgot-password if email is configured). OAuth providers (Google, GitHub) are offered as optional add-ons AFTER the user-credentials baseline, never as a replacement. This skill is an orchestrator - it delegates the actual implementation to `_setup-auth-admin` or `_setup-auth-users` depending on the chosen mode.Other plugins' skills for the same job