Chrome ExtensionsSAFE
Keep your coding agent up to date with the latest web best practices
Overview
Keep your coding agent up to date with the latest web best practices
abb04d6d5b03OBSERVED · 2026-10-20What it tells the agent
The instruction file, verbatim from the audited commit — this is the text the model reads, and the surface the audit's instruction layer examines. Quoted here so you can judge it without cloning anything.
---
name: chrome-extensions
description: >
Build and publish Chrome Extensions using Manifest V3 best practices. Use this skill
whenever the user asks to create, modify, debug, or understand Chrome browser extensions,
add-ons, or anything involving the Chrome Extensions API. Trigger on mentions of: 'Chrome
extension', 'browser extension', 'manifest.json', 'content script', 'service worker' (in
browser context), 'popup' (in browser extension context), 'side panel', 'chrome.* API',
'declarativeNetRequest', 'omnibox', 'context menu' (in extension context), 'userScripts',
'user script', 'script manager', or any request to build functionality that integrates with
the Chrome browser UI. Also trigger for publishing to the Chrome Web Store: 'publish
extension', preparing an extension for publishing, responding to a review rejection, writing
permission justifications, or drafting a privacy policy.
---
# Chrome Extensions
Build production-quality Chrome extensions using Manifest V3 and publish them to the Chrome Web Store.
## Part 1 — Building Extensions
### Mandatory Rules
These address the most common causes of broken extensions. Violating any produces a non-functional build.
#### 1. Icons: only reference files you create — or omit icons entirely
```
❌ BROKEN — referencing files that don't exist or reusing one file for all sizes:
"icons": { "16": "icon.png", "48": "icon.png", "128": "icon.png" }
✅ CORRECT — each size is a separate file at the correct pixel dimensions:
"icons": { "16": "icons/icon-16.png", "48": "icons/icon-48.png", "128": "icons/icon-128.png" }
(where icon-16.png is 16×16px, icon-48.png is 48×48px, icon-128.png is 128×128px)
✅ ALSO CORRECT — omit icons from manifest if you cannot generate real PNG files:
(just remove the "icons" and "default_icon" fields — Chrome uses a default icon)
```
**If you include icon references, you MUST create the actual image files.** Generate them with a script (see `references/extensions/icons.md`) or leave them out. Never reference non-existent files.
#### 2. Side panel: you MUST provide a way to open it
Defining `"side_panel": {"default_path": "..."}` does NOT make it openable. Add a trigger:
```js
// In service-worker.js — open side panel on extension icon click
// IMPORTANT: chrome.action.onClicked ONLY fires when there is NO default_popup
chrome.action.onClicked.addListener(async (tab) => {
await chrome.sidePanel.open({ windowId: tab.windowId });
});
```
If the extension has both a popup AND side panel, add a button in the popup that calls `chrome.sidePanel.open()`. Alternatively, use `chrome.sidePanel.setPanelBehavior({ openPanelOnActionClick: true })` — but the property is `openPanelOnActionClick`, NOT `openPanelOnActionIconClick`; the "Icon" variant causes a synchronous TypeError that silently aborts the service worker. Do NOT also define `default_popup` when using `setPanelBehavior`. See `references/extensions/side-panel.md`.
#### 3. Code execution: sandboxed iframes ONLY
Extension CSP blocks `eval()`, `new Function()`, inline `<script>` in all extension pages.
```js
// ❌ BROKEN — direct iframe DOM access throws SecurityError
iframe.contentDocument.write(html);
// ❌ BROKEN — eval in extension page
eval(userCode); // CSP blocks this
// ✅ OPTION A: Sandbox in manifest + postMessage
// manifest.json: { "sandbox": { "pages": ["sandbox.html"] } }
iframe.contentWindow.postMessage({ html, css, js }, '*');
// sandbox.html receives and runs:
window.addEventListener('message', (e) => { eval(e.data.js); /* allowed in sandbox */ });
// ✅ OPTION B: Blob URL (creates separate origin, bypasses extension CSP)
iframe.src = URL.createObjectURL(new Blob([doc], { type: 'text/html' }));
// ✅ OPTION C: srcdoc
iframe.srcdoc = `<style>${css}</style>${html}<script>${js}<\/script>`;
```
See `references/extensions/csp-sandbox.md` for full details.
#### 4. `tab.url` requires the `tabs` permission
Without it, `tab.url` silently returns `undefined` — no error thrown. See
`references/extensions/permissions.md`.
#### 5. Always use async/await — never `.then()` chains
```js
// ❌ BAD
chrome.tabs.query({active: true, currentWindow: true}).then(tabs => {
chrome.scripting.executeScript({target: {tabId: tabs[0].id}, files: ['content.js']}).then(() => {});
});
// ✅ GOOD
const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
await chrome.scripting.executeScript({ target: { tabId: tab.id }, files: ['content.js'] });
```
For `runtime.onMessage` listeners that do async work:
```js
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
(async () => {
const data = await chrome.storage.local.get('key');
sendResponse({ data });
})();
return true; // keeps channel open
});
```
#### 6. Content scripts: don't block the main thread
When modifying many DOM elements, batch with `requestAnimationFrame` and yield between batches:
```js
async function highlightAll(elements) {
const BATCH = 20;
for (let i = 0; i < elements.length; i += BATCH) {
await new Promise(r => requestAnimationFrame(() => {
elements.slice(i, i + BATCH).forEach(el => el.style.backgroundColor = 'yellow');
r();
}));
if (globalThis.scheduler?.yield) await scheduler.yield();
}
}
```
See `references/extensions/content-scripts.md`.
#### 7. Service workers are ephemeral — never store state in variables
```js
// ❌ BROKEN — state lost when SW terminates (~30s of inactivity)
let count = 0;
chrome.tabs.onUpdated.addListener(() => { count++; });
// ✅ CORRECT — persist in chrome.storage, read on every event
chrome.tabs.onUpdated.addListener(async (tabId, changeInfo) => {
if (changeInfo.status !== 'complete') return;
const { count = 0 } = await chrome.storage.local.get('count');
await chrome.storage.local.set({ count: count + 1 });
await chrome.action.setBadgeText({ text: String(count + 1) });
});
```
Use `chrome.alarms` instead of `setTimeout`/`setInterval`. See `referencesTrust audit
SAFEgrade B · trust 89/100 Nothing in the source contradicts what it says it does. Grade A is reserved for packages that have also passed the behavioural sandbox.
| Layer | What it checks | Result |
|---|---|---|
| L0 | Provenance & inventory | PASS |
| L1 | Static analysis of the code | NA |
| L2 | Instruction surface (what it tells the agent) | PASS |
| L3 | Class-specific surface | PASS |
| L4 | Behavioural (sandbox) | SKIPPED |
What the source does
- Filesystem
- none-observed
- Network
- none-observed
- Shell
- none-observed
- Dependencies
- pinned
- Secrets in source
- none-found
Findings (1)
- Side panel HTML files have full access to chrome.* APIs
Gates applied: no_behavioural_pass.
abb04d6d5b03full audit observations/trust-audit/skill/googlechrome__chrome-extensions.json · Report an issue / request a re-scanAudit history
Every audit this skill has had.
| Date | Source | Verdict | Grade | Score | Change |
|---|---|---|---|---|---|
| 2026-10-20 | abb04d6d5b03 | SAFE | B | 89 | first audit |
Questions
What does the chrome-extensions — googlechrome/modern-web-guidance skill do?
Keep your coding agent up to date with the latest web best practices
Is chrome-extensions — googlechrome/modern-web-guidance safe to install?
The audit found nothing in the source that contradicts what it says it does, and graded it B (89/100). Grade A is held back for packages that have also passed a sandboxed behavioural run, which is why a clean skill reads B.
What can chrome-extensions — googlechrome/modern-web-guidance access on my machine?
The audit observed no filesystem, network or shell use at all in its source.
What do I need installed to use chrome-extensions — googlechrome/modern-web-guidance?
Its own instructions reference tabs. Dependencies are pinned to exact versions.
How current is this page?
The grade is for one exact copy of the source (abb04d6d5b03), read on 2026-10-20. The repository is watched, and a new audit runs when it changes — this is the first audit.
Add this badge to your README
Shows this page's audit result and links back to it. It updates when the audit does.
[](https://modelsatlas.com/skills/googlechrome/chrome-extensions/)
Not your listing, or something out of date? Claim or update your listing.