Chrome Extension Manifest V3 Best Practices (2026) & Agent Skills

Manifest V3 service workers sleep between events, drop in-memory globals, and enforce strict content security policies. Use this checklist and the official Google Chrome Manifest V3 SKILL.md repo to keep coding agents off obsolete MV2 patterns.

Updated: 2026-11-21 · Works with Claude Code, Cursor, Codex, and Windsurf

Quick Reference Checklist

Core Chrome Extensions Best Practices

01

Never keep durable state in background service worker globals

Manifest V3 service workers terminate after idle timeouts. Persist state in chrome.storage.session or chrome.storage.local and await writes before returning.

Avoid:let activeTabs = new Map(); // wiped when SW sleeps
Prefer:await chrome.storage.session.set({ activeTabs })
02

Register all event listeners synchronously at top level

Attach chrome.runtime.onMessage, chrome.alarms, and action listeners during initial script evaluation so Chrome wakes the worker for incoming events.

Avoid:init().then(() => chrome.runtime.onMessage.addListener(handler))
Prefer:chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => { ... return true; })
03

Request minimal permissions and optional_host_permissions

Use activeTab instead of broad <all_urls> permissions whenever possible to speed up Chrome Web Store review and earn user trust.

Avoid:"host_permissions": ["<all_urls>"] for a single-click tool
Prefer:"permissions": ["activeTab", "storage"]
04

Isolate content-script UI inside a Shadow DOM root

Mount injected widgets inside a Shadow DOM so host page CSS never breaks your extension styles and your CSS never breaks the user's tab.

Avoid:document.body.appendChild(unscopedDiv)
Prefer:const root = host.attachShadow({ mode: "open" }); // or WXT createShadowRootUi
05

Avoid lost updates on chrome.storage read-modify-write

Serialize updates or store independent keys instead of racing read-then-write mutations across popup, options, and content scripts.

Avoid:const s = await chrome.storage.local.get("all"); s.all.x = 1; await chrome.storage.local.set(s);
Prefer:Store per-feature keys or queue mutations through one background handler
06

Never inject remote executable code or inline scripts

Bundle all JavaScript inside the extension package to satisfy Manifest V3 CSP rules and pass Chrome Web Store automated security checks.

Avoid:<script src="https://cdn.example.com/lib.js"></script>
Prefer:Bundle dependencies at build time with WXT or Vite

Open-Source Chrome Extensions Agent Skills (2)

Showing 2 of 2 verified skillsStandard: SKILL.md specification
Skill & PublisherStarsInstall
by Google Chrome•chrome-extension

Official Apache-2.0 skill from GoogleChrome/modern-web-guidance teaching coding agents Manifest V3 service worker lifecycles, least-privilege permissions, messaging, and Web Store safety.

★ 24,407
by Will McGinnis•chrome-extension

Audited MIT-licensed guide covering subtle Manifest V3 failure modes: awaiting side effects before worker teardown, preventing chrome.storage read-modify-write lost updates, and safe option validation.

★ 117

Building with Chrome Extensions and an AI coding agent?

Builderthread pairs verified skills with a private GitHub starter repo, living PRD, and MCP task board for Claude Code, Cursor, and Codex.

Frequently Asked Questions

Questions about Chrome Extensions Best Practices & Skills

Does Google Chrome publish an official Manifest V3 agent skill?

Yes. GoogleChrome/modern-web-guidance (Apache-2.0, 24,400+ stars) includes an official chrome-extensions SKILL.md covering Manifest V3 architecture, service workers, and Web Store compliance.

What breaks most AI-generated Chrome extensions?

Coding agents frequently generate obsolete Manifest V2 background pages, forget to return true from async onMessage listeners, or store state in memory globals that vanish when the MV3 service worker suspends.

Manifest V3 starter

Ship your Chrome and Firefox extension faster

Get a private WXT Manifest V3 repo with typed messaging, synced settings, an options page, a living PRD, and ordered MCP tasks your agent checks off one by one.

Six private starter repos, one MCP workflow
Next.js SaaS
Hono API
FastAPI AI
Expo mobile
Tauri Rust
Chrome extension
100% code ownership in your GitHubLiving PRD + MCP task boardStarts at $29 one-time
Start my extension repoTry free architecture preview

Free preview needs no signup or card