chrome-ext-service-worker

chrome-ext-service-worker is a skill for Claude Code from RadOrigin-LLC/RAD-Claude-Skills. It costs 111 tokens per session (932 once invoked), scanned A, original, Apache-2.0.

A guide to Chrome extension service workers, the background programs that respond to browser events. In Manifest V3, these programs can stop when idle and start again later.

In plain words
What is it for?
Use it when implementing background scripts, handling alarms and events, restoring state, or diagnosing service-worker restarts.
Why use it?
It helps prevent bugs caused by lost in-memory data, late event registration, timers, or assumptions that the background program stays running.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the rad-chrome-extension plugin — 9 skills, 1 agent shipped together

Good fit Use it when implementing background scripts, handling alarms and events, restoring state, or diagnosing service-worker restarts.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/radorigin-llc/rad-claude-skills/chrome-ext-service-worker
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add RadOrigin-LLC/RAD-Claude-Skills --skill chrome-ext-service-worker
Clone the repo
git clone --depth 1 https://github.com/RadOrigin-LLC/RAD-Claude-Skills

Made for: Claude Code.

Or install rad-chrome-extension, the plugin that ships this one along with the rest of its 9 skills, 1 agent.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for chrome-ext-service-worker

README.md
[![agentmods](https://agentmods.dev/badge/skills/radorigin-llc/rad-claude-skills/chrome-ext-service-worker/github.svg)](https://agentmods.dev/skills/radorigin-llc/rad-claude-skills/chrome-ext-service-worker)
Your own site
<a href="https://agentmods.dev/skills/radorigin-llc/rad-claude-skills/chrome-ext-service-worker"><img src="https://agentmods.dev/badge/skills/radorigin-llc/rad-claude-skills/chrome-ext-service-worker/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for chrome-ext-service-worker

Your own site · 80×15
<a href="https://agentmods.dev/skills/radorigin-llc/rad-claude-skills/chrome-ext-service-worker"><img src="https://agentmods.dev/badge/skills/radorigin-llc/rad-claude-skills/chrome-ext-service-worker.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 111 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 932 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00111 $0.00932
Opus 5 $0.00056 $0.00466
Sonnet 5 $0.00022 $0.00186
Haiku 4.5 $0.00011 $0.00093

Measured 11d ago against content hash 7121df06316b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

chrome-ext-service-worker scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

archive/plugins/rad-chrome-extension/skills/chrome-ext-service-worker/SKILL.md · 128 lines

How it starts

The opening of the file, as written. The whole thing — 128 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Chrome Extension Service Workers

MV3 replaced persistent background pages with ephemeral, event-driven service workers. They wake to process events and terminate after ~30 seconds of inactivity. All in-memory state is lost on termination. Code must be structured around this fundamental constraint.

The Ephemeral Lifecycle

[Event occurs] → [Worker starts] → [Script executes top-to-bottom]
→ [Registered listeners fire] → [~30s idle] → [Worker terminates]
→ [All global variables lost]

Every handler must assume zero prior state. Rehydrate from storage at the start of every event.

Hard Rules

1. Register Listeners Synchronously at Top Level

The browser scans for listeners on the first turn of the event loop. Listeners inside promises, callbacks, setTimeout, or async functions will NOT be registered in time.

// CORRECT — synchronous, top-level
export default defineBackground(() => {
  chrome.runtime.onMessage.addListener(handleMessage);
  chrome.alarms.onAlarm.addListener(handleAlarm);
  chrome.runtime.onInstalled.addListener(handleInstall);
});

// WRONG — async, buried inside callback
export default defineBackground(async () => {
  await someSetup();
  // TOO LATE — worker may have already handled the event
  chrome.runtime.onMessage.addListener(handleMessage);
});

2. Never Use setTimeout/setInterval

Standard timers are canceled on termination. Replace with chrome.alarms:

// WRONG — unreliable
setTimeout(() => checkForUpdates(), 60000);

// CORRECT — survives worker restarts
chrome.alarms.create('check-updates', { periodInMinutes: 1 });
chrome.alarms.onAlarm.addListener((alarm) => {
  if (alarm.name === 'check-updates') checkForUpdates();
});

3. Never Store State in Global Variables

// WRONG — lost on restart
let userPrefs = {};

// CORRECT — persist to storage
async function getPrefs() {
  const { prefs } = await chrome.storage.local.get('prefs');
  return prefs ?? DEFAULT_PREFS;
}

Read the full file on GitHub · 128 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 128 lines · 111 tokens per session scan A 7121df06316b

Subscribe to this mod's changes

chrome-ext-service-worker is a skill published in the GitHub repository RadOrigin-LLC/RAD-Claude-Skills (5 stars, last pushed 25d ago), licensed Apache-2.0. It adds 111 tokens to every session and 932 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

web-quality-audit

Run an evidence-led web quality audit covering performance, accessibility, SEO, best practices, and agentic browsing. Use when asked to "audit my site", "review web quality", "run lighthouse audit", "check page quality", or "optimize my website".

addyosmani/web-quality-skills · 58 tokens

ui-test

Runs UI tests described in plain English by driving real Chrome via the Claude-in-Chrome extension. Covers end-to-end flows (clicks, forms, assertions), visual checks (screenshot + optional baseline diff), accessibility (axe-core), performance (Web Vitals + light Lighthouse-style metrics), and an interactive --debug…

mostafa-drz/claude-skills · 190 tokens

audit-ui-e2e

Runs a beginner-mind end-to-end UI audit of any running app — local dev server, staging, production, or a specific URL. Drives Chrome through every interactive element on the target surface, collects structured findings (severity, category, where, symptom, impact, repro, triage), and hands the result off to…

mostafa-drz/claude-skills · 152 tokens

capture-screens

Automatically navigates a web app using Playwright MCP and captures context-aware named screenshots at each product feature state. Names each file semantically based on context (e.g., checkout-payment-form-filled.png). Outputs a manifest.json mapping filenames to descriptions and a summary report. Use when documenting…

mostafa-drz/claude-skills · 101 tokens

bug-reporting

Load this skill whenever you are filing, reviewing, or generating accessibility bug reports — whether from automated tool output, manual testing, user reports, or testing with disabled people. The purpose of this skill is to make accessibility findings easier to report accurately, connect them to real people and…

mgifford/accessibility-skills · 122 tokens

audio-video

Load this skill whenever the project contains audio or video content, media players, podcasts, video embeds, or any / elements. Under no circumstances publish audio or video without captions, transcripts, and audio descriptions where required. Absolutely always apply WCAG 1.2 criteria for time-based media.

mgifford/accessibility-skills · 65 tokens