Skip to content
Back to skills

Service Workers Pwa Knowledge Patch

ASecurity

Service Workers and Progressive Web Apps

  • 25 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added September 5, 2026
developmentrustgo

Works with

  • cli

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill service-workers-pwa-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Service Workers Pwa Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Service Workers Pwa Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-service-workers-pwa-knowledge-patch/badge)](https://www.skillsdirectory.com/skills/nevaberry-service-workers-pwa-knowledge-patch)

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

Download with Pro
SKILL.md
---
name: service-workers-pwa-knowledge-patch
description: Service Workers and Progressive Web Apps
version: null
license: MIT
metadata:
  author: Nevaberry
---


# Service Workers and Progressive Web Apps

Load this skill when implementing or reviewing service-worker registration,
static routing, fetch handling, client messaging, Workbox deployment,
web app manifests, app navigation, or installed-application detection.
Use the topic references for complete conditions and examples.

> [!CAUTION]
> Prerelease manifest and service-worker guidance may change before stable
> release. Each draft-derived item carries its source's prerelease marker.

## Reference index

| Reference | Topics |
| --- | --- |
| [Installed Application Detection](references/installation-detection.md) | Query limits; Android and Windows verification; in-scope and out-of-scope PWA detection. |
| [Manifest and Navigation](references/manifest-and-navigation.md) | Installation; identity; localization; updates; icons and colors; shortcuts; link capture; scope and display behavior. |
| [Static Service-Worker Routing](references/static-routing.md) | Availability; rule inputs; Boolean conditions; validation and quotas; cache fallback; network races; speculation and preload. |
| [Workbox Lifecycle and Deployment](references/workbox-lifecycle.md) | Service-worker registration, activation, clients, messages, and cache handles; Workbox builds, updates, message targeting, and route caching. |

## Compatibility and failure points

### Module service-worker initialization

> **Prerelease (`service-workers-spec`):** This guidance may change before stable release.

Registration or update rejects with `TypeError` if the entry module or a
statically imported dependency uses top-level `await`. Move asynchronous
initialization into the events that need it and pass its promise to
`waitUntil()` or `respondWith()` as appropriate.

### Trusted Types at registration

> **Prerelease (`service-workers-spec`):** This guidance may change before stable release.

When the page enforces Trusted Types for script sinks, pass a
`TrustedScriptURL` from an allowed policy as the first argument to
`navigator.serviceWorker.register()`.

### Route registration failures

> **Prerelease (`service-workers-crd-2026-06`):** This guidance may change before stable release.

Invalid route conditions reject with `TypeError`, but the automatic install
lifetime extension fulfills even when registration rejects. Use
`event.waitUntil(event.addRoutes(rule))` if that failure should fail install.
Registration also rejects at the 1,024th condition object across all rules
or past 10 nesting levels, counting root and nested condition objects.

### Activation after failed cleanup

> **Prerelease (`service-workers-spec`):** This guidance may change before stable release.

During `activate`, promises passed to `waitUntil()` settle before activation
continues, but the worker can reach `activated` even if one rejects. It must
handle subsequent events if an activation-time migration or cleanup fails
or is interrupted.

### Pending navigation client lookups

> **Prerelease (`service-workers-spec`):** This guidance may change before stable release.

`clients.get(event.resultingClientId)` can wait for the new document to be
ready to run or resolve to `undefined` if the client is discarded. Keep this
lookup out of the promise passed to `respondWith()`: the new document can
need the response before becoming ready.

### Response handling completion

> **Prerelease (`20260804`):** This guidance may change before stable release.

`event.handled` fulfills when the worker hands over a response or lets the
request fall through, before response streaming completes. It rejects with
a `NetworkError` DOM exception if handling fails. Use it for follow-up work
in `waitUntil()`; awaiting it inside `respondWith()`'s promise creates a cycle.

### Cache handles after deletion

> **Prerelease (`service-workers-spec`):** This guidance may change before stable release.

After `await caches.delete(name)`, existing `Cache` references still work.
`caches.open(name)` opens a fresh cache if the name has not been recreated.
Reopen by name after a reset before writing entries visible under that name.

### Installed-app query limits

`navigator.getInstalledRelatedApps()` considers only the first three
`related_applications` entries in the checking page's manifest. Browsers
ignore `min_version` and `fingerprints`; a verified app can still be returned
with an older version or a different signing certificate.

## Static routing and navigation requests

### Feature detection and rule inputs

`InstallEvent.addRoutes()` has limited browser support. Check for the method
in the install listener and use the worker's `fetch` listener for required
handling on browsers without static routing. Pass one rule or a single array
of rules; `urlPattern` also accepts a `URLPattern` constructor input object
or an existing instance with `hasRegExpGroups === false`.

### Conditions and matching order

> **Prerelease (`service-workers-crd-2026-06`):** This guidance may change before stable release.

`urlPattern`, `requestMethod`, `requestMode`, `requestDestination`, and
`runningStatus` combine with AND. Use `or` or `not` as the sole recognized
member at its level, and give every condition object a recognized member.
Calls append rules; the first matching rule supplies the source.

### Cache misses go to the network

> **Prerelease (`service-workers-crd-2026-06`):** This guidance may change before stable release.

`source: { cacheName: "images-v1" }` queries that cache with default matching
options; the unnamed `"cache"` source checks the first cache in storage order.
A missing cache or miss sends the request to the network, bypassing the fetch
handler and later routes.

### Fetch listeners and races

> **Prerelease (`service-workers-crd-2026-06`):** This guidance may change before stable release.

Register a `fetch` listener during initial script evaluation before using
`"fetch-event"` or `"race-network-and-fetch-handler"`; otherwise `addRoutes()`
rejects with `TypeError`. Set `requestMethod: "GET"` on race routes: the race
runs only for GET, only a 2xx network response can win outright on the network
branch, and `event.preloadResponse` resolves to `undefined` on that route.

### Speculative navigation requests

> **Prerelease (`20260804`):** This guidance may change before stable release.

With navigation preload disabled and no static route matched, the browser
may start a network request for a GET navigation before the fetch handler
runs, even if the handler serves a cached response. `event.preloadResponse`
resolves to `undefined` for this request. An explicit `"fetch-event"` route
skips this speculation.

## App installation, manifests, and navigation

### Installed PWA link capture

From Chrome 139 on Windows, macOS, and Linux, an eligible link opens in the
installed PWA whose manifest `scope` covers its destination; ChromeOS support
is pending. Without a matching installed PWA, or if the user opts out, it
opens in a browser tab. Captured links follow the app's launch configuration.
A navigation is generally eligible when it creates a new frame without
opening an auxiliary browsing context.

### PWA detection scope and platform

A same-origin page within the PWA's manifest scope can detect it on desktop
Chrome and Edge 140+ and Android Chrome 84+. Its `webapp` entry points to the
PWA's own manifest; the declared or browser-computed web app ID is required
on desktop and optional on Android. Outside-scope detection, including across
origins, is available on Chrome 84+ for Android with the verification setup
in [Installed Application Detection](references/installation-detection.md).

### Manifest replacement identity

> **Prerelease (`20260813`):** This guidance may change before stable release.

Once a document has a processed manifest, processing stops for a replacement
whose resolved `id` differs. Use the same explicit `id` when swapping the
manifest link for a language-specific variant.

### Localized names and icons

> **Prerelease (`web-app-manifest-wd-2026-05`):** This guidance may change before stable release.

Top-level `name_localized`, `short_name_localized`, and `icons_localized` use
language-tag maps. Shortcuts support those maps plus `description_localized`
and still require a base `name`. The user agent should choose the best match
for the user's languages and fall back to the base member when none matches.

### Dark-scheme colors

> **Prerelease (`web-app-manifest-wd-2026-05`):** This guidance may change before stable release.

For an operating-system dark theme, the user agent should apply each valid
`color_scheme_dark` override for `theme_color` or `background_color`,
subject to user preferences such as accessibility settings. Each omitted
or invalid override leaves the corresponding top-level color in effect.

### Shortcut launch behavior

> **Prerelease (`web-app-manifest-spec`):** This guidance may change before stable release.

An operating-system shortcut passes its `url` to the app launch algorithm.
By default this opens a fresh app context at that URL. An extension such as
the experimental `launch_handler` can change how shortcuts launch.

## Workbox registration, updates, and messages

### Registration timing

`wb.register()` waits for the window's `load` event by default, letting the
page finish loading before install-time precaching starts. Attach listeners
before registration; pass `{ immediate: true }` to start sooner.

### Waiting-worker activation

In Workbox v6+, `wb.messageSkipWaiting()` sends `{ type: "SKIP_WAITING" }` to
the worker currently waiting on the registration, even if `getSW()` selected
another worker. It has no effect before registration or without a waiting
worker. A custom worker needs to handle the message and call `self.skipWaiting()`.
If a worker is already waiting when the page registers, the `waiting` event
has `wasWaitingBeforeRegister: true`, so a reload can surface the same pending
update again.

### Message targets and replies

`wb.messageSW(data)` uses `getSW()`: at registration it prefers a waiting
worker with the matching script URL over a matching active worker, otherwise
waiting for a matching worker to start installing. Use standalone
`messageSW(sw, data)` for a specific worker. Reply through
`event.ports[0].postMessage(...)` so the returned promise resolves.

### Cache URLs already loaded by the page

Send `CACHE_URLS` with `payload.urlsToCache` to apply the router's caching
strategies to previously loaded URLs. The default `workbox-routing` router
handles matching routes; a separate `Router` needs `router.addCacheListener()`.

Files in this skill

  • SKILL.md9.4 KB
  • coverage.json955 B
  • references/installation-detection.md4 KB
  • references/manifest-and-navigation.md4.1 KB
  • references/static-routing.md3.5 KB
  • references/workbox-lifecycle.md2.4 KB

Attribution

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

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.