Free 40-page Claude guide — setup, 120 prompt codes, MCP servers, AI agents. Download free →
CLSkills
Frontendintermediate

PWA Setup

Share

Convert app to Progressive Web App

Works with OpenClaude

You are a frontend developer specializing in Progressive Web Apps. The user wants to convert their web application into a PWA with offline support, installability, and service worker functionality.

What to check first

  • Verify your app is served over HTTPS (required for service workers; localhost is an exception for development)
  • Run npm list to confirm you have a build tool (webpack, Vite, Create React App, etc.)
  • Check that your public/ folder exists and is configured as your static assets directory

Steps

  1. Create a public/manifest.json file with app metadata (name, icons, theme colors, start URL)
  2. Add the manifest link to your index.html <head>: <link rel="manifest" href="/manifest.json">
  3. Create a public/service-worker.js file that handles fetch events and caches assets
  4. Register the service worker in your main JavaScript entry point with navigator.serviceWorker.register()
  5. Define a cache versioning strategy (cache-first, network-first, or stale-while-revalidate)
  6. Implement asset precaching for critical files (HTML, CSS, JS bundles)
  7. Add offline fallback UI or page (typically served when network is unavailable)
  8. Test with Chrome DevTools Application tab: verify manifest loads, service worker installs, and cache populates

Code

// public/manifest.json
{
  "name": "My Progressive Web App",
  "short_name": "MyPWA",
  "description": "A fast, installable web app",
  "start_url": "/",
  "scope": "/",
  "display": "standalone",
  "orientation": "portrait-primary",
  "background_color": "#ffffff",
  "theme_color": "#2196F3",
  "icons": [
    {
      "src": "/icon-192.png",
      "sizes": "192x192",
      "type": "image/png",
      "purpose": "any"
    },
    {
      "src": "/icon-512.png",
      "sizes": "512x512",
      "type": "image/png",
      "purpose": "maskable"
    }
  ]
}

// public/service-worker.js
const CACHE_NAME = 'my-pwa-v1';
const urlsToCache = [
  '/',
  '/index.html',
  '/styles/main.css',
  '/scripts/main.js',
  '/offline.html'
];

self.addEventListener('install', (event) => {
  event.waitUntil(
    caches.open(CACHE_NAME)
      .then((cache) => cache.addAll(urlsToCache))
      .then(() => self.skipWaiting())
  );
});

self.addEventListener('activate', (event) => {
  event.waitUntil(
    caches.keys().then((

Note: this example was truncated in the source. See the GitHub repo for the latest full version.

Common Pitfalls

  • Treating this skill as a one-shot solution — most workflows need iteration and verification
  • Skipping the verification steps — you don't know it worked until you measure
  • Applying this skill without understanding the underlying problem — read the related docs first

When NOT to Use This Skill

  • When a simpler manual approach would take less than 10 minutes
  • On critical production systems without testing in staging first
  • When you don't have permission or authorization to make these changes

How to Verify It Worked

  • Run the verification steps documented above
  • Compare the output against your expected baseline
  • Check logs for any warnings or errors — silent failures are the worst kind

Production Considerations

  • Test in staging before deploying to production
  • Have a rollback plan — every change should be reversible
  • Monitor the affected systems for at least 24 hours after the change

Quick Info

CategoryFrontend
Difficultyintermediate
Version1.0.0
AuthorClaude Skills Hub
frontendpwaoffline

Install command:

curl -o ~/.claude/skills/pwa-setup.md https://claude-skills-hub.vercel.app/skills/frontend/pwa-setup.md

Related Frontend Skills

Other Claude Code skills in the same category — free to download.

Want a Frontend skill personalized to YOUR project?

This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.