CtrlK
BlogDocsLog inGet started
Tessl Logo

testland/service-worker-lifecycle-tests

Build-an-X workflow that emits per-SW state-transition tests covering the six `ServiceWorkerState` values per [w3c-github-io/ServiceWorker][sw-spec] (`parsed → installing → installed → activating → activated → redundant`), the `install` / `activate` / `fetch` event handlers per [MDN Service Worker API][mdn-sw], `event.waitUntil()` lifetime extension, `ServiceWorkerGlobalScope.skipWaiting()` and `Clients.claim()` upgrade-path semantics, the `statechange` event on `ServiceWorker` objects, `ServiceWorkerRegistration.update()`, and `navigator.serviceWorker.controller` checks. Output: a Playwright spec file with one test per transition plus a clean upgrade-path test (v1 active → v2 installed/waiting → v2 activated, with claim()). The general Playwright SW harness, `service-worker-mock` unit tests, and cache-strategy assertions live in references/. Use when authoring the baseline lifecycle spec, when a deploy leaves users stuck on the old service worker, or when a site's caching / offline behavior is uncovered.

64

Quality

81%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Passed

No findings from the security scan

Overview
Quality
Evals
Security
Files

Quality

Content

67%Weight 40%Scale 1-5

Reviews the quality of instructions and guidance provided to agents. Good implementation is clear, handles edge cases, and produces reliable results.

A strong, highly actionable builder skill with executable test code for every lifecycle cell, a clear step sequence, and well-organized one-level-deep references. Its weaknesses are recurring explanations of service-worker concepts Claude already knows (hurting token efficiency), assumed test infrastructure (slow-install fixture, version-flipping server), and a missing final validation step for the emitted spec.

Suggestions

Trim the per-step 'Per [mdn-sw], X does Y' explanations of well-known service-worker semantics (hard-reload bypass, updatefound firing conditions, controller nullability) — keep the citations but drop the re-explanations, letting the test code carry the semantics.

Add an explicit final validation step (e.g. 'Run npx playwright test tests/sw-lifecycle.spec.ts and confirm every matrix row in tests/sw-lifecycle-coverage.yaml has a passing test before delivering') with a fix-and-rerun loop for flaky statechange assertions.

Show the tests/fixtures/sw-slow-install.js fixture content inline (it is only one sentence of code) and either add references/install-flow-reference.md to the bundle or drop the path citation for the add-to-homescreen-flow-tests composition.

DimensionReasoningScore

Conciseness

The body repeatedly explains service-worker semantics Claude already knows — 'a hard-reload (Ctrl+Shift+R) bypasses the SW', 'the registration object fires updatefound when a new SW is in the installing state', 'skipWaiting() activates sooner and Clients.claim() claims existing pages' — padding otherwise useful spec citations. The code cells earn their place, but the prose around them and the duplicated References/composition listings could be tightened. Fits the 3 anchor ('mostly efficient but includes some unnecessary explanation'), not 4 ('minor instances') because the known-concept explanations recur across nearly every step.

3 / 5

Actionability

Every step ships executable Playwright/TypeScript test code, a bash inventory command, a YAML coverage matrix, and an anti-patterns table with concrete fixes. Minor gaps keep it from 5: the sw-slow-install.js fixture is described but not shown, and the v1/v2 test server that 'flips the SW response based on a query param header' is assumed infrastructure never specified.

4 / 5

Workflow Clarity

Steps 1–9 are clearly sequenced with per-step purpose, and there are conditional checkpoints (e.g. 'If the SW under test does not call skipWaiting(), this test must assert v2 stays in installed/waiting… flip the expectation') plus a CI gate on matrix rows. However, there is no explicit run-the-spec / verify-all-cells-pass validation step or failure-handling loop after emitting the artifact, which the 5 anchor requires.

4 / 5

Progressive Disclosure

Good split: the harness, mock tests, cache-strategy assertions, and the full upgrade-path spec are moved to references/ and clearly signaled with inline links; the three referenced files exist and reference each other only one level deep. Minor gaps: references/install-flow-reference.md is cited in the Composes section but absent from the bundle, and ~200 lines of inline test code in Steps 2–8 could partly live in references alongside the upgrade-path spec.

4 / 5

Total

15

/

20

Passed

Description

88%Weight 40%Scale 1-5

Based on the skill's description, can an agent find and select it at the right time? Clear, specific descriptions lead to better discovery.

A dense, highly specific description that explicitly states what it builds and when to use it, with concrete user-facing trigger scenarios. Its only weaknesses are a missing set of common trigger synonyms (PWA, 'won't update') and one trigger clause that overlaps sibling cache/offline skills. Third-person voice is maintained throughout.

DimensionReasoningScore

Specificity

Enumerates many concrete capabilities — 'per-SW state-transition tests covering the six ServiceWorkerState values', 'event.waitUntil() lifetime extension', 'ServiceWorkerGlobalScope.skipWaiting() and Clients.claim() upgrade-path semantics', 'ServiceWorkerRegistration.update()', 'navigator.serviceWorker.controller checks' — plus a concrete output artifact ('a Playwright spec file with one test per transition plus a clean upgrade-path test'). Coverage is comprehensive with no generic filler actions.

5 / 5

Completeness

Explicitly answers both questions: the 'what' is the full test-emission capability list with a named output artifact, and the 'when' is an explicit 'Use when authoring the baseline lifecycle spec, when a deploy leaves users stuck on the old service worker, or when a site's caching / offline behavior is uncovered' clause with concrete trigger phrases. Matches the 5 anchor exactly.

5 / 5

Trigger Term Quality

Contains natural phrases users would actually say — 'when a deploy leaves users stuck on the old service worker', 'caching / offline behavior is uncovered', 'service worker', 'skip-waiting', 'clients-claim' — but misses common variations like 'PWA', 'service worker won't update', or 'stale after deploy'. Not a 5 because synonym/extension coverage is incomplete; not a 3 because the trigger phrasing goes well beyond bare API jargon.

4 / 5

Distinctiveness Conflict Risk

The core niche (SW state-machine lifecycle testing) is clear and distinct, but the trigger 'when a site's caching / offline behavior is uncovered' overlaps the cache-strategy / offline-fallback sibling skills the description itself names, creating minor wrong-skill risk. Mostly distinct with minor overlap — the 4 anchor; not 5 because of that trigger overlap, not 3 because the lifecycle/state-transition framing is unambiguous.

4 / 5

Total

18

/

20

Passed

Validation

93%

Checks the skill against the spec for correct structure and formatting. All validation checks must pass before discovery and implementation can be scored.

Validation — 15 / 16 Passed

Validation for skill structure

CriteriaDescriptionResult

referenced_paths_exist

Referenced path issues: 1 missing

Warning

Total

15

/

16

Passed

Reviewed

Table of Contents