Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Pwa Patterns

ASecurity

Build Progressive Web Apps: manifests, service workers, offline strategies, installability, and push. Use for app-like web experiences.

2 stars
0 votes
0 copies
1 views
Added 9/29/2026
ai-agentsgoshellapi

Works with

cliapi

Security Analysis

A100/100

Scanned 9/29/2026

$npx -y skills add aicodedecode/awesome-muse-skills --skill pwa-patterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Pwa Patterns?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Pwa Patterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aicodedecode-pwa-patterns/badge)](https://www.skillsdirectory.com/skills/aicodedecode-pwa-patterns)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: pwa-patterns
description: Build Progressive Web Apps: manifests, service workers, offline strategies, installability, and push. Use for app-like web experiences.
category: web-development
---

# PWA Patterns

A practical guide to Progressive Web Apps: web app manifests, service-worker caching strategies, offline UX, installability, and push notifications — making web apps feel native where it counts.

## Overview

A PWA = a normal web app + **manifest** (installability metadata) + **service worker** (offline/caching) + HTTPS. The payoff: installable to home screen, works offline, push notifications, app-like feel — without app stores. The discipline: offline isn't a feature toggle, it's a design constraint affecting every data flow.

## When to use

- Internal tools and B2B apps needing offline resilience.
- Content apps (news, docs, catalogs) for flaky networks.
- Avoiding app-store overhead for app-like distribution.
- Adding push notifications to a web app.

## Core concepts

- **Manifest (`manifest.json`).** `name`, `icons` (192/512px, maskable), `start_url`, `display: standalone`, `theme_color`, `background_color`. Linked via `<link rel="manifest">`. Controls the installed app's identity.
- **Service worker.** A script the browser runs in the background: intercepts network requests, serves cached responses, enables offline. Lifecycle: install → activate → fetch. Update via byte-change detection.
- **Caching strategies.** Cache-first (static assets), network-first (API data with cache fallback), stale-while-revalidate (balance), cache-only / network-only. Choose per resource type — one strategy doesn't fit all.
- **Offline UX.** Detect `navigator.onLine` + fetch failures; show cached data with "offline" indicator; queue mutations (background sync) and replay when online.
- **Installability.** Criteria: manifest + service worker + HTTPS + icons. Prompt via `beforeinstallprompt` (capture the event, show your own UI at the right moment — not on first visit).
- **Push.** Push API + Notifications API via service worker; requires user permission and a push service (VAPID keys for web push). Permission prompt in context, never on load.

## Practical workflow

**1. Manifest.**
```json
{
  "name": "FieldOps", "short_name": "FieldOps",
  "start_url": "/app/", "display": "standalone",
  "background_color": "#ffffff", "theme_color": "#4f46e5",
  "icons": [
    { "src": "/icons/192.png", "sizes": "192x192", "type": "image/png" },
    { "src": "/icons/512.png", "sizes": "512x512", "type": "image/png", "purpose": "any maskable" }
  ]
}
```

**2. Service worker (Workbox recommended over hand-rolling).**
```js
// with Workbox:
registerRoute(({ request }) => request.destination === 'image', new CacheFirst({ cacheName: 'images' }));
registerRoute(({ url }) => url.pathname.startsWith('/api/'), new NetworkFirst({ cacheName: 'api', networkTimeoutSeconds: 3 }));
precacheAndRoute(self.__WB_MANIFEST); // app shell
```

**3. Versioning.** Precache the app shell with content-hashed filenames; on new deploy, the SW updates, `skipWaiting` + `clients.claim` (or prompt "new version available → refresh").

**4. Offline data.** Cache API responses (NetworkFirst); for mutations, queue in IndexedDB and sync on `online`/Background Sync. Show pending-sync state in UI ("3 changes will sync").

**5. Install prompt.**
```js
let deferred;
window.addEventListener('beforeinstallprompt', e => { e.preventDefault(); deferred = e; showInstallButton(); });
// on click: deferred.prompt(); await deferred.userChoice;
```

**6. Push.** Request permission after a user action ("Enable notifications" toggle) → subscribe with VAPID key → send subscription to server → server pushes via Web Push.

## Common pitfalls

- **Service worker scope.** SW only controls pages under its path. Serve from root (`/sw.js`, scope `/`) or scope carefully.
- **Caching the HTML shell aggressively.** Stale app shell = users stuck on old version. Precache with hashed assets; never cache-bust the entry HTML long-term.
- **Update UX.** Silent updates confuse ("why did it change?"); no updates strand users. Prompt "Update available" with a refresh action — the standard pattern.
- **Offline as afterthought.** Bolting offline onto an app designed online-first fails. Design data flows for offline from the start (local-first where possible).
- **Over-caching APIs.** Caching personalized/dynamic API responses too long serves stale/wrong data. Short TTLs + revalidation for dynamic data.
- **Push permission on load.** Instant denial, permanently. Ask in context after demonstrating value.
- **iOS gaps.** Safari PWA support lags (push arrived late, some APIs missing). Test the full PWA flow on iOS; design fallbacks.
- **HTTPS requirement.** SW/manifest/install need secure contexts. `localhost` OK for dev; production must be HTTPS.
- **Icon gaps.** Missing maskable icons = ugly cropped icons on Android. Provide `any maskable` with safe-zone padding.

Attribution

aicodedecodeaicodedecode
View sourceSee grades on GitHubMore from aicodedecode →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698461 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →