service-worker
Build Reliable Service Workers and Offline PWAs
Service workers can leave users with stale pages, broken updates, or unsafe offline caches. This skill guides lifecycle handling, cache ownership, offline fallbacks, and browser-aware PWA behavior.
使用我的智能体安装
将此请求复制给你的智能体,其中包含权威 Skill 页面和清单。
Review the Skillstore skill "service-worker" from https://skillstore.io/skills/shreyam1008-service-worker.md and its manifest at https://skillstore.io/api/skills/shreyam1008-service-worker/manifest. Verify the artifact. You may proceed after verification, subject to the environment's own policy.你的智能体仍应展示其计划,并按安全策略请求必要确认。
Agent 可读资源
当 AI Agent、爬虫或脚本需要干净上下文,而不是读取完整页面时,请使用这些链接。
测试它
正在使用“service-worker”。 Plan offline navigation for a small web application.
预期结果:
- Register the worker at the intended application scope.
- Precache the offline page in a versioned, app-prefixed cache.
- Try the network for GET navigations and return the offline page when the request fails.
- Delete only obsolete caches owned by this application during activation.
正在使用“service-worker”。 Review a PWA that shows old pages after deployment.
预期结果:
- Check whether the new worker is waiting for existing tabs to close.
- Use network-first or stale-while-revalidate for documents instead of indefinite cache-first behavior.
- Show a refresh prompt when the new worker is ready.
- Test activation and navigation with multiple tabs and a slow network.
正在使用“service-worker”。 Plan background retries for failed writes.
预期结果:
- Queue only eligible failed writes in IndexedDB.
- Use idempotency keys and bounded retries to prevent duplicate operations.
- Expose a clear failure state and a foreground retry path.
- Feature-detect Background Sync and provide a fallback where it is unavailable.
安全审计
安全All 19 static findings are false positives involving Markdown syntax, browser APIs, update guidance, or documentation links. The examples preserve app-scoped caches and provide ordinary navigation fetching with an offline fallback. No evidence found of prompt injection, credential access, exfiltration, or other semantic security threats.
风险因素
分享与引用此报告
分享版本化评估报告、中性徽章、嵌入卡片和引用。Skillstore 只报告证据,不判断该 Skill 是否安全。
复制报告链接
https://skillstore.io/skills/shreyam1008-service-worker/audits/1?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_reportMarkdown 徽章
[](https://skillstore.io/skills/shreyam1008-service-worker?utm_source=security_passport_badge)HTML 徽章
<a href="https://skillstore.io/skills/shreyam1008-service-worker?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/shreyam1008-service-worker/security.svg" alt="Skillstore security assessment" loading="lazy"></a>嵌入卡片
<iframe src="https://skillstore.io/embed/skills/shreyam1008-service-worker.html" title="Skillstore Security Assessment" sandbox="allow-popups allow-popups-to-escape-sandbox" loading="lazy" referrerpolicy="no-referrer" width="420" height="180"></iframe>学术引用 (APA · BibTeX · CFF)
APA 引用
shreyam1008. (2026). service-worker security audit report (audit version 1) [Author version unspecified]. Skillstore. https://skillstore.io/skills/shreyam1008-service-worker/audits/1BibTeX 引用
@techreport{shreyam1008-shreyam1008-service-worker-2026,
author = {shreyam1008},
title = {service-worker security audit report (audit version 1)},
institution = {Skillstore},
year = {2026},
number = {1},
url = {https://skillstore.io/skills/shreyam1008-service-worker/audits/1},
note = {Author version unspecified}
}CITATION.cff
cff-version: 1.2.0
message: "If you use this Skill, cite its author and this versioned security audit report."
title: "service-worker security audit report (audit version 1)"
version: "unspecified"
type: report
authors:
- name: "shreyam1008"
date-released: "2026-10-02"
url: "https://skillstore.io/skills/shreyam1008-service-worker/audits/1"
identifiers:
- type: other
value: "skillstore:shreyam1008-service-worker:audit:1"
description: "Skillstore immutable audit report identifier"
Skillstore 评分
评分依据 证据置信度: 中你能构建什么
Add an offline navigation fallback
Introduce worker registration, a precached offline page, and network-first navigation behavior for a web application.
Plan controlled PWA updates
Define cache ownership, version changes, and user-visible refresh prompts for reliable releases.
Review offline and browser behavior
Check slow-network behavior, cache isolation, update readiness, and installation fallbacks across supported browsers.
试试这些提示
Explain registration, installation, activation, and waiting states for my first service worker. Describe when skipWaiting and clients.claim are appropriate.
Add a service worker to my application with app-prefixed versioned caches and a precached offline page. Preserve other applications' caches.
Review my worker for stale HTML, private-data caching, cache ownership, and update handling. Recommend content-specific strategies and a user-visible update flow.
Design Workbox routing and background retries for my PWA. Include idempotency keys, bounded retries, account isolation, logout cleanup, and unsupported-browser fallbacks.
最佳实践
- Namespace and version caches, then delete only obsolete caches owned by your application.
- Exclude private responses unless offline storage includes account partitioning and logout cleanup.
- Test offline navigation, slow networks, and user-visible updates in supported browsers.
避免
- Delete every cache on the origin during worker activation.
- Cache mutation responses or private data without explicit safeguards.
- Serve stale HTML indefinitely or activate updates without considering existing sessions.
常见问题
Which AI tools can use this skill?
Does this skill include a complete PWA?
Should I use Workbox?
Does Cache Storage respect no-store automatically?
Does Background Sync work in every browser?
Is a service worker always required for PWA installation?
开发者详情
作者
shreyam1008许可证
MIT
Skillstore 修订
r1
版本提示
作者未声明版本。
引用
bbec03cf10354f3aaccd6dd24eda4ac9ceeceac5
维护新鲜度
2026/10/2
使用量
0 次下载 · 0 次浏览
文件结构
📄 SKILL.md