agentleFS
p10ns11yp10ns11y/skills/chrome-extension-mv3/SKILL.md

chrome-extension-mv3

Skill2 starsChanged 41 days agoMITView on GitHub

Manifest V3 Chrome extension development — service worker lifecycle, message passing (popup ↔ service worker ↔ content script), content script injection, and host_permissions fetch patterns. Use when editing manifest.json, background/service worker, popup, content scripts, chrome.runtime.sendMessage, or extension permissions.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 0 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read the project's overlay or TECH_DETAILS*.md / AGENTS.md for exact filenames.

    line 22
  2. Very specific:

    Service worker state: no globals — use chrome.storage / IndexedDB.

    line 28
  3. Very specific:

    Manifest assets: only reference icons/paths that exist.

    line 30
  4. Very specific:

    Search guides: npx -y modern-web-guidance@latest search "…" — do not copy the full guide tree into your repo.

    line 51
  5. Very specific:

    If the repo ships a file map, message action table, or domain-specific fetch rules, load it from …

    line 55

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Chrome extension (Manifest V3)

Vanilla MV3 patterns for extensions without a bundler/framework in the active path. Pair with project overlays for app-specific file maps and message action names (examples/overlays/).

Architecture (typical three-layer)

LayerRuns inTypical filesResponsibilities
Popup / UIExtension pagepopup.html, popup.jsUser input, display, orchestrates messages to SW
Service workerBackground (ephemeral)background.js, event.js, sw.jsNetwork fetch needing host_permissions, relay, durable cache
Content scriptIsolated world on web pagescontent.jsDOM/selection access, page context, no extension APIs for cross-origin fetch

Read the project's overlay or TECH_DETAILS*.md / AGENTS.md for exact filenames.

Rules for changes

  1. Async sendResponse: async work in message handlers → IIFE + return true, or return a Promise (Chrome 99+ only). See references/message-passing.md.
  2. Cross-origin fetch: pages and popups cannot bypass host restrictions — fetch from the service worker when host_permissions are declared; never duplicate fetch in popup if SW already owns that origin.
  3. Service worker state: no globals — use chrome.storage / IndexedDB; listeners registered at top level. See references/service-worker.md.
  4. Selection: cache selection in the content script; popup open often clears live window.getSelection().
  5. Manifest assets: only reference icons/paths that exist; MV3 requires service_worker not background.scripts.
  6. Content scripts: isolated world — use messaging for SW coordination. See references/content-scripts.md.

Message passing checklist

- [ ] Action/type names match across popup, SW, and content script
- [ ] Async handlers: return true (IIFE) or return Promise — not both
- [ ] tabs.sendMessage: handle "receiving end does not exist" (script not injected yet)
- [ ] Only one listener should sendResponse per message type

MV3 references (this skill)

  • message-passing.md — popup ↔ service worker ↔ content script
  • service-worker.md — lifecycle, storage, alarms
  • content-scripts.md — injection, DOM, messaging

Upstream (do not vendor)

Project overlay

If the repo ships a file map, message action table, or domain-specific fetch rules, load it from .agents/skills/chrome-extension-mv3/references/ or examples/overlays/sorkalam-mv3-extension.md (Sorkalam dictionary extension).

Example provenance: sorkalam-extension.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.