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.

Voir la source

Mode d’emploi

  1. Copiez la commande et examinez le paquet avant de l’installer dans votre environnement agent.
  2. Consultez le document original pour les outils, identifiants et environnements requis.
  3. Décrivez les entrées et le livrable souhaité ; comparez la sortie aux sources.
npx skills add https://github.com/quangpl/browser-extension-skills --skill extension-dev

Avant de commencer

  • L’installation n’inclut ni abonnement au modèle, ni quota API, ni accès aux fichiers.
  • Étoiles et installations reflètent l’activité, pas un test indépendant de qualité ou de sécurité.
Document Skill original

Rendu depuis le dépôt source en conservant titres, exemples, code, tableaux, liens et images.

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
du même dépôt

Autres Skills

Tous les Skills