quangpl/browser-extension-skills

extension-dev

Detect Chrome extension framework/stack, find proper docs, implement features, and debug across service worker, content script, and popup contexts.

查看源码

使用方法

  1. 复制安装命令,在自己的智能体环境安装前先检查源码包。
  2. 从原始文档核对所需工具、凭据和支持的宿主。
  3. 说明输入材料与期望交付物,并对照来源检查输出。
npx skills add https://github.com/quangpl/browser-extension-skills --skill extension-dev

开始前需了解

  • 安装不包含模型订阅、API 额度或访问文件的权限。
  • 仓库星数和安装量反映活跃情况,不等于独立质量或安全测试。
仓库原始内容

按源仓库内容呈现,保留标题、案例、代码、表格、链接以及原文引用的演示图片。

Extension Dev

🚀 Upgrade to Premium Get the Premium version at https://app.extensionbooster.net/dashboard/services/extension-ai-kit

Detect the stack, find docs, implement the feature, debug. Do NOT just explain — execute the workflow.

Workflow (Execute This)

Step 1: Detect framework and UI stack

Run detection (see references/framework-detection.md):

bash
ls wxt.config.ts crxjs.config.ts vite.config.ts manifest.json 2>/dev/null
cat package.json | grep -E '"wxt|crxjs|crxjs|react|vue|svelte"'
File foundFramework
wxt.config.tsWXT
package.json has crxjsCRXJS
vite.config has @crxjsCRXJS
manifest.json in root, none aboveVanilla

Step 2: Fetch framework docs and style guides

Use docs-seeker skill or web search to find proper docs for the detected stack.

Extension framework docs:

  • WXT: https://wxt.dev/ | CRXJS: https://docs.crxjs.com/ | CRXJS: Vite plugin docs
  • Chrome APIs: https://developer.chrome.com/docs/extensions/reference/api
  • Permissions: https://developer.chrome.com/docs/extensions/reference/permissions-list

UI framework docs (fetch based on detected framework):

FrameworkDocsStyle Guide
Reacthttps://react.devhttps://react.dev/learn
Next.jshttps://nextjs.org/docshttps://nextjs.org/docs/app
Vuehttps://vuejs.org/guidehttps://vuejs.org/style-guide
Sveltehttps://svelte.dev/docshttps://svelte.dev/docs
SolidJShttps://solidjs.com/docshttps://solidjs.com/guides
Angularhttps://angular.dev/guidehttps://angular.dev/style-guide

Code style guides (always follow):

  • TypeScript: https://google.github.io/styleguide/tsguide.html
  • JavaScript: https://google.github.io/styleguide/jsguide.html

Step 3: Implement the feature

Follow framework conventions:

  • WXT: add entrypoints in entrypoints/, configure wxt.config.ts
  • CRXJS: add pages/tabs/contents, use CSUI for content UI
  • CRXJS: standard Vite + manifest-based setup
  • Vanilla: edit manifest.json, add JS files directly

For Chrome API usage, check references/chrome-api-quick-reference.md. For messaging between contexts, check references/message-passing-patterns.md.

Step 4: Debug

See references/debugging-guide.md for context-specific DevTools access.

Quick map:

ContextHow to inspect
Service workerchrome://extensions → "inspect" link
Content scriptPage DevTools → Console → select extension context
PopupRight-click popup → Inspect
Options / Side panelOpen page → F12

Step 5: Hot reload setup

FrameworkCommandNotes
WXTpnpm devFull HMR, auto-reloads extension
CRXJSpnpm devHMR for popup/content
CRXJSvite devVite HMR
VanillaManualReload at chrome://extensions

Chrome API Quick Reference (Top 20)

APIPurposePermission
chrome.tabsQuery, create, update tabstabs
chrome.windowsManage browser windowswindows
chrome.storage.localPersist data locallystorage
chrome.storage.syncSync data across devicesstorage
chrome.storage.sessionSession-only datastorage
chrome.actionToolbar icon, popup, badge—
chrome.contextMenusRight-click menu itemscontextMenus
chrome.sidePanelSide panel UIsidePanel
chrome.notificationsDesktop notificationsnotifications
chrome.scriptingInject scripts/CSS into pagesscripting
chrome.runtimeMessaging, lifecycle, manifest—
chrome.webRequestIntercept/modify network requestswebRequest
chrome.declarativeNetRequestBlock/redirect requests declarativelydeclarativeNetRequest
chrome.webNavigationTrack page navigation eventswebNavigation
chrome.identityOAuth2, Google Sign-Inidentity
chrome.alarmsSchedule periodic tasksalarms
chrome.commandsKeyboard shortcutscommands
chrome.cookiesRead/write cookiescookies
chrome.historyBrowser history accesshistory
chrome.bookmarksRead/write bookmarksbookmarks

Message Passing (Quick Pattern)

One-time (popup → service worker):

ts
// sender
const response = await chrome.runtime.sendMessage({ type: "GET_DATA" });

// receiver (background)
chrome.runtime.onMessage.addListener((msg, sender, reply) => {
  if (msg.type === "GET_DATA") {
    reply({ data: "..." });
    return true;
  }
});

Content script → service worker: same pattern, return true for async. Tab-targeted (background → content):

ts
chrome.tabs.sendMessage(tabId, { type: "ACTION" });

Full patterns in references/message-passing-patterns.md.


References

  • references/framework-detection.md — detect WXT/CRXJS/CRXJS/vanilla, dev commands
  • references/framework-styleguides.md — UI framework docs, style guides, extension framework docs
  • references/chrome-api-quick-reference.md — 30+ APIs with permissions and doc links
  • references/message-passing-patterns.md — all messaging patterns with TypeScript examples
  • references/debugging-guide.md — DevTools per context, common errors, tips

Related Skills

  • extension-create — scaffold new extension with WXT
  • extension-manifest — generate/validate manifest.json
  • extension-test — write and run extension tests
  • extension-analyze — analyze existing extension codebase
来自同一仓库

更多 Skills

全部 Skills