Skip to main content
skill CX Codex

pwa-development · mindrally — Claude Code skill: what it does, how to install

Guidelines for Progressive Web App development covering service workers, web manifests, caching strategies, and offline readiness.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add Mindrally/skills --skill pwa-development -a claude-code
Open on GitHub

What pwa-development does

This skill equips your coding agent with implementation standards for Progressive Web Apps. It includes code patterns for registering service workers, handling install and activate lifecycle events, and managing network requests with an offline.html fallback.

The rules detail specific caching mechanisms for different scenarios. It applies Cache First for static bundles and Network First for dynamic endpoints. A Stale While Revalidate strategy is included as well, alongside templates for Background Sync and browser connectivity listeners.

Push notification registration requires a valid PUBLIC_VAPID_KEY to sign client subscriptions. Testing offline behavior and manifest validity relies on Lighthouse audits.

What it helps with

  • configure a web app manifest with standalone display settings
  • write a service worker that clears outdated cache stores
  • implement Cache First and Network First caching patterns
  • set up background data sync and connectivity listeners

Example prompts for the agent

  • Create a service worker that caches static assets on install and serves an offline fallback
  • Add a network-first caching handler for API requests with cache fallbacks
  • Implement a push notification subscription flow with a public VAPID key

How to install pwa-development

1Skills CLI (Vercel)

npx skills add Mindrally/skills --skill pwa-development -a claude-code

2Manually: put the files in place

~/.claude/skills/pwa-development/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/pwa-development/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about pwa-development

How to install pwa-development in Claude Code?

Run npx skills add Mindrally/skills --skill pwa-development -a claude-code. The rule file will be placed in ~/.claude/skills/pwa-development/SKILL.md.

What does the pwa-development skill do?

It provides your AI agent with reference patterns for building PWA features, including manifests, service worker lifecycles, and cache logic.

Which caching strategies are covered in the guidelines?

The skill provides templates for Cache First, Network First, and Stale While Revalidate.

Source text

SKILL.md · Apache-2.0
---
name: pwa-development
description: Progressive Web App development guidelines covering service workers, caching strategies, offline functionality, and installability
metadata:
  maintainer: Mindrally
  source: https://github.com/Mindrally/skills
---

# Progressive Web App Development Guidelines

You are an expert in building Progressive Web Applications with offline-first capabilities.

## Core Principles

- Design for offline-first experience
- Implement proper caching strategies
- Ensure fast loading and smooth performance
- Follow web app manifest best practices
- Provide native-like experience

## Web App Manifest

```json
{
  "name": "My Progressive Web App",
  "short_name": "MyPWA",
  "description": "A description of your app",
  "start_url": "/",
  "display": "standalone",
  "background_color": "#ffffff",
  "theme_color": "#000000",
  "icons": [
    {
      "src": "/icons/icon-192.png",
      "sizes": "192x192",
      "type": "image/png"
    },
    {
      "src": "/icons/icon-512.png",
      "sizes": "512x512",
      "type": "image/png"
    }
  ]
}
```

## Service Worker Registration

```javascript
// Register service worker
if ('serviceWorker' in navigator) {
  window.addEventListener('load', async () => {
    try {
      const registration = await navigator.serviceWorker.register('/sw.js');
      console.log('SW registered:', registration.scope);
    } catch (error) {
      console.error('SW registration failed:', error);
    }
  });
}
```

## Service Worker Implementation

```javascript
// sw.js
const CACHE_NAME = 'v1';
const STATIC_ASSETS = [
  '/',
  '/index.html',
  '/styles.css',
  '/app.js',
  '/offline.html'
];

// Install event - cache static assets
self.addEventListener('install', (event) => {
  event.waitUntil(
    caches.open(CACHE_NAME).then((cache) => {
      return cache.addAll(STATIC_ASSETS);
    })
  );
  self.skipWaiting();
});

// Activate event - cleanup old caches
self.addEventListener('activate', (event) => {
  event.waitUntil(
    caches.keys().then((cacheNames) => {
      return Promise.all(
        cacheNames
          .filter((name) => name !== CACHE_NAME)
          .map((name) => caches.delete(name))
      );
    })
  );
  self.clients.claim();
});

// Fetch event - serve from cache or network
self.addEventListener('fetch', (event) => {
  event.respondWith(
    caches.match(event.request).then((response) => {
      return response || fetch(event.request);
    }).catch(() => {
      return caches.match('/offline.html');
    })
  );
});
```

## Caching Strategies

### Cache First (Static Assets)
```javascript
async function cacheFirst(request) {
  const cached = await caches.match(request);
  return cached || fetch(request);
}
```

### Network First (Dynamic Content)
```javascript
async function networkFirst(request) {
  try {
    const response = await fetch(request);
    const cache = await caches.open(CACHE_NAME);
    cache.put(request, response.clone());
    return response;
  } catch {
    return caches.match(request);
  }
}
```

### Stale While Revalidate
```javascript
async function staleWhileRevalidate(request) {
  const cache = await caches.open(CACHE_NAME);
  const cached = await cache.match(request);

  const fetchPromise = fetch(request).then((response) => {
    cache.put(request, response.clone());
    return response;
  });

  return cached || fetchPromise;
}
```

## Background Sync

```javascript
// Register sync in main app
async function registerSync() {
  const registration = await navigator.serviceWorker.ready;
  await registration.sync.register('sync-data');
}

// Handle sync in service worker
self.addEventListener('sync', (event) => {
  if (event.tag === 'sync-data') {
    event.waitUntil(syncData());
  }
});

async function syncData() {
  const data = await getQueuedData();
  await fetch('/api/sync', {
    method: 'POST',
    body: JSON.stringify(data)
  });
}
```

## Push Notifications

```javascript
// Request permission
async function requestNotificationPermission() {
  const permission = await Notification.requestPermission();
  if (permission === 'granted') {
    const registration = await navigator.serviceWorker.ready;
    const subscription = await registration.pushManager.subscribe({
      userVisibleOnly: true,
      applicationServerKey: PUBLIC_VAPID_KEY
    });
    // Send subscription to server
  }
}

// Handle push in service worker
self.addEventListener('push', (event) => {
  const data = event.data.json();
  event.waitUntil(
    self.registration.showNotification(data.title, {
      body: data.body,
      icon: '/icons/icon-192.png'
    })
  );
});
```

## Offline Detection

```javascript
// Check online status
window.addEventListener('online', () => {
  console.log('Back online');
  syncPendingData();
});

window.addEventListener('offline', () => {
  console.log('Offline mode');
  showOfflineIndicator();
});
```

## Performance Optimization

- Implement app shell architecture
- Use lazy loading for routes and components
- Optimize images with responsive formats
- Minimize JavaScript bundle size
- Use code splitting

## Testing

- Test offline functionality
- Verify caching behavior
- Test on various network conditions
- Validate manifest and icons
- Use Lighthouse for PWA audits

## Best Practices

- Serve over HTTPS
- Provide meaningful offline experience
- Handle service worker updates gracefully
- Implement proper error handling
- Add loading states and skeletons

© Mindrally · Apache-2.0 · Mindrally/skills

Similar skills

Everything for Frontend and UI →

pwa-development by other authors comes first.

pwa-development alinaqi A skill for building Progressive Web Apps: manifest, service worker, caching strategies and offline mode. Useful when the app has to install on a phone and open without a network. CX Codex +1 4,100installs pwa-development jwynia A skill for React and Svelte projects that walks the agent through service workers, offline support and installable apps. Useful when offline behaviour is planned, not patched in later. CX Codex +1 437installs frontend-design official anthropics This skill guides intentional visual design for new interfaces and redesigns. Use it when a generic generated UI is not enough. 1,025,790installs design-taste-frontend Leonxlnx This skill directs the design of public pages and work screens, then checks the result in a browser through screenshots. Use it when an interface feels generic or unfinished. CX Codex +1 678,700installs prototype Matt Pocock Creates throwaway prototypes for checking state logic or exploring UI before committing the decision to the main codebase. 986,201installs hyperframes heygen-com Instructs coding agents on creating, validating, and rendering HTML-based videos using the HyperFrames framework and CLI. CX Codex +1 1,200,000installs hyperframes-cli heygen-com Controls HyperFrames video workflows from the CLI: audits layouts and contrast, edits timeline clips, captures snapshots, and renders locally or in cloud runtimes. CX Codex +1 1,300,000installs webapp-testing official anthropics This skill tests local web apps with Playwright, helping agents debug UI behavior, capture screenshots, and inspect browser logs. 186,758installs

From the same set236

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor