/anglesite:pwafrom anglesite
Makes a site installable as a Progressive Web App with offline support via a vanilla JS service worker. Walks through manifest setup, caching strategy, and install prompt.
Ships in anglesite. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Make the site installable as a Progressive Web App. Visitors can add it to their home screen for instant, app-like access — no app store listing, no review process, no 30% platform fee. A service worker caches key pages so essential content (hours, menu, contact info) stays available even without internet.
Follows Open Web Advocacy principles: the web is an app platform, and web apps deserve feature parity with native. Uses only vanilla JavaScript — no Workbox, no third-party service worker libraries.
Read EXPLAIN_STEPS from .site-config. If true or not set, explain before every tool call that will trigger a permission prompt. If false, proceed without pre-announcing.
Read .site-config for PWA_ENABLED. If it's already true, tell the owner: "Your site already has PWA support. Would you like to change which pages are cached offline, update the install prompt, or troubleshoot?" Then adjust as needed.
Verify the site builds cleanly: run npm run build. If the build fails, fix it before proceeding.
Ask the owner:
"Which pages should visitors be able to view even without internet? Common choices for [business type] include:
- Essentials only — home page and contact info
- Key pages — home, about, menu/services, contact, hours
- Everything — all pages cached as visitors browse
I'd recommend option 2 for most sites."
Map their answer to a precache list. For option 3, do not precache everything — instead use runtime caching (cache pages as the visitor navigates).
Also ask:
"Would you like a subtle 'Add to Home Screen' prompt so visitors know they can install the site? It appears once, and if dismissed, won't show again for 30 days."
Read public/manifest.webmanifest. Rewrite it with full PWA fields:
{
"name": "<full site name from .site-config SITE_NAME>",
"short_name": "<≤12 chars, abbreviate if needed>",
"description": "<one-sentence site description>",
"start_url": "/",
"id": "/",
"display": "standalone",
"orientation": "any",
"scope": "/",
"background_color": "<existing background_color>",
"theme_color": "<existing theme_color>",
"categories": ["<business-appropriate categories>"],
"icons": [
{ "src": "/icons/icon-192.png", "sizes": "192x192", "type": "image/png" },
{ "src": "/icons/icon-512.png", "sizes": "512x512", "type": "image/png" },
{ "src": "/icons/icon-maskable-192.png", "sizes": "192x192", "type": "image/png", "purpose": "maskable" },
{ "src": "/icons/icon-maskable-512.png", "sizes": "512x512", "type": "image/png", "purpose": "maskable" },
{ "src": "/apple-touch-icon.png", "sizes": "180x180", "type": "image/png" }
],
"shortcuts": []
}
Manifest field guidance:
display: Always "standalone". This is what makes the app feel native — no browser chrome.id: Set to "/" so the browser treats it as a stable identity even if start_url changes later.categories: Use W3C standardized categories. Common for small businesses: "business", "food", "health", "shopping", "entertainment", "education".shortcuts: Populate with 2–4 key pages. Example for a restaurant: [{"name": "Menu", "url": "/menu", "description": "View our menu"}, {"name": "Contact", "url": "/contact", "description": "Get in touch"}]. Each shortcut needs name and url; description and icons are optional.orientation: Use "any" unless the site is specifically designed for one orientation.Preserve existing theme_color and background_color values.
Check public/ for existing icon files. Look for:
apple-touch-icon.png (180×180) — usable but not idealIf a 512×512+ source icon exists:
Create a Node script to generate the required sizes. Sharp is available as an Astro transitive dependency:
// scripts/generate-pwa-icons.mjs
import sharp from "sharp";
import { mkdir } from "node:fs/promises";
const SOURCE = process.argv[2]; // e.g., "public/logo-512.png"
const OUT = "public/icons";
await mkdir(OUT, { recursive: true });
const sizes = [192, 512];
for (const size of sizes) {
await sharp(SOURCE).resize(size, size, { fit: "contain", background: { r: 255, g: 255, b: 255, alpha: 0 } }).png().toFile(`${OUT}/icon-${size}.png`);
// Maskable icons need 10% safe zone padding — shrink content to 80% and center on background
const padding = Math.round(size * 0.1);
const inner = size - padding * 2;
const bg = await sharp({ create: { width: size, height: size, channels: 4, background: { r: 255, g: 255, b: 255, alpha: 1 } } }).png().toBuffer();
const content = await sharp(SOURCE).resize(inner, inner, { fit: "contain", background: { r: 255, g: 255, b: 255, alpha: 0 } }).png().toBuffer();
await sharp(bg).composite([{ input: content, left: padding, top: padding }]).png().toFile(`${OUT}/icon-maskable-${size}.png`);
}
console.log("PWA icons generated in public/icons/");
Run: node scripts/generate-pwa-icons.mjs public/<source-icon>. Delete the script after it runs — it's a one-time operation.
If only apple-touch-icon.png (180×180) exists:
Tell the owner: "Your current icon is 180×180. For the best install experience (sharp home screen icon, splash screen), a 512×512 PNG or SVG logo works best. Want to provide one, or should I proceed with what we have?"
If proceeding with 180×180, create the public/icons/ directory and use the apple-touch-icon for all sizes (upscaling is acceptable for maskable icons which are displayed at small sizes). Update manifest icon entries to reference the available files.
If no icon exists at all:
Ask the owner for a logo or icon file. Do not generate a placeholder — a missing icon is better than a generic one for a real business.
Copy ${CLAUDE_PLUGIN_ROOT}/skills/pwa/templates/offline.astro to src/pages/offline.astro (Read it, then Write it).
Add links to the offline page's <nav> for whichever pages the owner chose to cache in Step 1 (e.g., /menu, /contact, /about).
Copy ${CLAUDE_PLUGIN_ROOT}/skills/pwa/templates/sw.js to public/sw.js (Read it, then Write it), then apply the customizations below.
Customization notes:
PRECACHE_URLS. Only precache pages the owner specifically chose — large precache lists slow down the first visit.CACHE_VERSION when the owner deploys significant content changes. The service worker update flow handles this automatically (old caches are purged on activation)./keystatic/) or API endpoints./pagefind/ — it can be large and updates every build.The site's Content-Security-Policy blocks inline scripts and inline event handlers (script-src has no 'unsafe-inline'), so the registration code must live in its own first-party file — never in a <script is:inline> body or an onclick attribute.
Copy ${CLAUDE_PLUGIN_ROOT}/skills/pwa/templates/sw-register.js to public/sw-register.js. It registers the service worker, reveals the update banner when a new version activates, and wires the Refresh button.
Read src/layouts/BaseLayout.astro. Just before </body>, add the update notification and then the script tag (is:inline with a src tells Astro to leave the tag alone; defer runs it after the banner exists):
<div id="sw-update" hidden role="alert" style="position:fixed;bottom:0;left:0;right:0;padding:var(--space-sm) var(--space-md);background:var(--color-primary);color:#fff;text-align:center;z-index:1000;">
Site updated. <button id="sw-update-refresh" type="button" style="color:#fff;text-decoration:underline;background:none;border:none;cursor:pointer;font:inherit;">Refresh</button>
</div>
<script is:inline defer src="/sw-register.js"></script>
This tells returning visitors when new content is available without forcing a reload.
If the owner opted in during Step 1, copy ${CLAUDE_PLUGIN_ROOT}/skills/pwa/templates/InstallPrompt.astro to src/components/InstallPrompt.astro.
Then copy ${CLAUDE_PLUGIN_ROOT}/skills/pwa/templates/install-prompt.js to public/install-prompt.js — the component loads it with src= (a separate file for the same CSP reason as Step 6). It shows the banner on beforeinstallprompt and remembers a dismissal for 30 days.
Import and render it in src/layouts/BaseLayout.astro, just before the closing </body>:
import InstallPrompt from "../components/InstallPrompt.astro";
<InstallPrompt appName={siteName} />
Read .site-config for SITE_NAME and pass it as appName.
Read public/_headers. Add a cache-control rule for the service worker so browsers always check for updates:
/sw.js
Cache-Control: no-cache
Service-Worker-Allowed: /
If the _headers file does not exist, create it with just these rules.
If the file already has rules, append these at the end. Do not modify existing rules.
Append to .site-config:
PWA_ENABLED=true
PWA_OFFLINE_STRATEGY=<essentials|key-pages|browse>
Use essentials, key-pages, or browse to reflect the choice from Step 1 (options 1, 2, or 3 respectively).
Run npm run build.
After a successful build, verify:
dist/sw.js existsdist/offline/index.html existsdist/manifest.webmanifest contains "display": "standalone"dist/icons/ (if generated in Step 3)dist/sw-register.js exists (and dist/install-prompt.js if the install prompt was added), and the layout references them with src= — no registration or prompt code inline in the HTMLTell the owner:
"Your site is now a Progressive Web App! Here's what changed:
- Installable — visitors on Chrome, Edge, or Safari can add it to their home screen
- Offline support — [list cached pages] stay available without internet
- [if install prompt] Install prompt — a subtle banner invites first-time visitors to install
To test: open the site in Chrome DevTools → Application tab → Manifest and Service Workers sections. On mobile, try 'Add to Home Screen' from the browser menu.
Push notifications are not yet included — for notifying customers about updates,
/anglesite:newslettersets up email subscriptions, which reach all devices reliably."
If /anglesite:pwa runs on a site that already has PWA support:
.site-config for PWA_ENABLED and PWA_OFFLINE_STRATEGYPRECACHE_URLS in public/sw.js and PWA_OFFLINE_STRATEGY in .site-configInstallPrompt.astro (when removing, delete public/install-prompt.js too)CACHE_VERSION in public/sw.js to force a full refreshWhat SKILL.md sets; muted values are Claude Code's defaults
Use when the owner wants visitors to install the site like an app on their phone or use it offline.
Three short reads, in order
npx claudepluginhub anglesite/anglesite-skills --plugin anglesite56 skills in this plugin
/bookingEmbed appointment scheduling (Cal.com or Calendly) into the siteOther plugins' skills for the same job