Expert guidelines for Chrome extension development with Manifest V3, covering security, performance, and best practices
This skill provides expert-level guidance for Chrome extension development, covering JavaScript/TypeScript, browser extension APIs, and modern web development practices.
manifest.json, background service worker, content scripts, and popup files.chrome.* API.chrome.runtime.sendMessage, and respect CSP.chrome.storage.local or chrome.storage.sync to persist user settings and extension state.chrome://extensions, use Chrome DevTools to inspect the service worker and content scripts, and run unit tests.{
"manifest_version": 3,
"name": "My Extension",
"version": "1.0.0",
"description": "A sample Chrome extension using Manifest V3",
"permissions": ["storage", "activeTab"],
"action": {
"default_popup": "popup/popup.html",
"default_icon": {
"16": "icons/icon16.png",
"48": "icons/icon48.png",
"128": "icons/icon128.png"
}
},
"background": {
"service_worker": "background/service-worker.js",
"type": "module"
},
"content_scripts": [
{
"matches": ["https://*.example.com/*"],
"js": ["content/content-script.js"],
"css": ["content/styles.css"]
}
]
}
// background/service-worker.ts
// Listen for extension install or update
chrome.runtime.onInstalled.addListener((details) => {
if (details.reason === 'install') {
chrome.storage.local.set({ initialized: true, count: 0 });
console.log('Extension installed');
}
});
// Handle messages from content scripts or popup
chrome.runtime.onMessage.addListener(
(message: { type: string; payload?: unknown }, sender, sendResponse) => {
if (message.type === 'GET_COUNT') {
chrome.storage.local.get('count', (result) => {
sendResponse({ count: result.count ?? 0 });
});
return true; // keep message channel open for async response
}
if (message.type === 'INCREMENT') {
chrome.storage.local.get('count', (result) => {
const newCount = (result.count ?? 0) + 1;
chrome.storage.local.set({ count: newCount }, () => {
sendResponse({ count: newCount });
});
});
return true;
}
}
);
// Schedule periodic tasks with chrome.alarms
chrome.alarms.create('sync-data', { periodInMinutes: 30 });
chrome.alarms.onAlarm.addListener((alarm) => {
if (alarm.name === 'sync-data') {
console.log('Running scheduled sync');
}
});
npx skills add Mindrally/chrome-extension-development下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer