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

- **Topic**: Chrome Extensions
- **Canonical URL**: https://builderthread.dev/skill/for/chrome-extension
- **Parent Hub**: https://builderthread.dev/skill.md
- **Last Verified**: 2026-11-21

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.

---

## Core Chrome Extensions Best Practices Checklist

### 1. 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 })`

### 2. 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; })`

### 3. 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"]`

### 4. 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`

### 5. 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`

### 6. 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`

---

## Verified Skills for Chrome Extensions (2)

| Skill | Publisher | License | Stars | GitHub Source | Install Command |
|---|---|---|---|---|---|
| [chrome-extensions](https://builderthread.dev/skill/GoogleChrome/modern-web-guidance/chrome-extensions.md) | Google Chrome | Apache-2.0 | 24,407 | [GitHub](https://github.com/GoogleChrome/modern-web-guidance) | `npx skills add GoogleChrome/modern-web-guidance --skill chrome-extensions` |
| [building-browser-extensions](https://builderthread.dev/skill/wdm0006/python-skills/building-browser-extensions.md) | Will McGinnis | MIT | 117 | [GitHub](https://github.com/wdm0006/python-skills/tree/main/skills/javascript/browser-extensions) | `npx skills add wdm0006/python-skills --skill building-browser-extensions` |

---

## Frequently Asked Questions

### 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.

---

## Related Skill Guides

- [TypeScript](https://builderthread.dev/skill/for/typescript.md) ([Web](https://builderthread.dev/skill/for/typescript)): TypeScript Best Practices (2026): Strict Types & Agent Skills
- [Security](https://builderthread.dev/skill/for/security.md) ([Web](https://builderthread.dev/skill/for/security)): Best Agent Skills for Application Security & Audits
- [UI & Design](https://builderthread.dev/skill/for/design.md) ([Web](https://builderthread.dev/skill/for/design)): Best Agent Skills for Frontend UI, shadcn/ui & Design Systems
- [Testing](https://builderthread.dev/skill/for/testing.md) ([Web](https://builderthread.dev/skill/for/testing)): Best Agent Skills for Automated Testing & Playwright CLI

---

## Ship With a Private Starter Repo, Living PRD & MCP Tasks

Builderthread creates a private WXT Manifest V3 repo with typed messaging, synced settings, an options page, living PRD, and MCP tasks.

- Supported languages: Rust, TypeScript, React Native (Expo), Python
- Starter stacks: Next.js SaaS, Hono API, FastAPI AI, Expo mobile, Tauri Rust desktop, WXT Chrome extension
- Start now: https://builderthread.dev/auth/signup
