kmaruthi2002/universal-llm-skills/browser-extension-development

Claude Code and agent skill by kmaruthi2002/universal-llm-skills

Trust tier 3
  • community
  • ext:[{"type":"plugin","description":"Custom plugin integration"}]
Source check pending

Checking that the SKILL.md file is still in the repository.

Design, build, test and publish browser extensions (Chrome, Edge, Firefox, Safari and other WebExtensions-based browsers): manifest and permissions, background service workers, content scripts, popups, side panels and options pages, message passing, storage, cross-browser differences, store review and extension security. Use when someone asks to make a browser extension, add-on or plugin, a Chrome/Firefox extension, a content script that modifies pages, a toolbar popup, migrate to Manifest V3, fix an extension that stopped working, or get an extension through store review.

Install

npx vskill@latest install kmaruthi2002/universal-llm-skills/browser-extension-development

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

The same SKILL.md was published earlier as kmaruthi2002/universal-llm-skills/browser-extension-development.

Browser Extension Development

A browser extension is a small distributed system that lives inside someone else's application. It has several isolated execution contexts that cannot share memory, a background process the browser may kill at any moment, code injected into pages it does not control, and a permission model that users and store reviewers scrutinise. Most extension bugs come from forgetting one of those facts. This skill is about building extensions that work reliably across those boundaries, ask for as little power as possible, and pass review.

Scope

Covers: WebExtensions-style extensions (the shared model used by Chromium browsers, Firefox and, with adaptations, Safari), Manifest V3 as the current baseline, architecture, messaging, storage, permissions, cross-browser packaging, testing, store submission and security.

Does not cover: the UI design of the popup itself (see interaction-design, ui-design-fundamentals), general frontend framework practice (frontend-development), automating a browser from outside (browser-automation), or extracting data from sites at scale (web-scraping — and note that an extension scraping on the user's behalf still inherits that skill's legal and ethical concerns).

Core principles

  1. Each context is a separate program. The background worker, each content script instance, the popup, the options page and any extension pages run in different JavaScript realms. They communicate only by messages and shared storage. Design the extension as cooperating processes with an explicit protocol, not as one app with globals. Why: a global set in the popup is gone when the popup closes; a variable in the service worker is gone when it is suspended.
  1. The background is ephemeral. In Manifest V3 the background is a service worker (an event page in some Firefox configurations) that the browser terminates after a short idle period and restarts on the next event. Any in-memory state can vanish between two events. Persist state you need in storage, register listeners synchronously at the top level, and treat each event handler as if it were a fresh start. Why: listeners registered asynchronously (after an await) may not be attached when the browser wakes the worker to deliver an event, so the event is silently dropped.
  1. Least privilege is a feature, not a chore. Every permission broadens what an attacker gets if your extension or its dependencies are compromised, increases install-time warnings (which cut install rates), and lengthens review. Prefer activeTab and optional permissions requested at the moment of need over blanket host access. Why: users and reviewers read "Read and change all your data on all websites" as a red flag, correctly.
  1. Pages are hostile territory. Content scripts run alongside arbitrary page code. The page can read and alter the DOM you inject into, spoof events, and send you crafted messages via window.postMessage. Never trust data from the page, never pass privileged capabilities into it, and validate every message's sender.
  1. The store is part of the runtime. Store policies (single purpose, data disclosure, remote code bans, permission justification) constrain architecture. Discover them before designing, not after rejection. Why: "load logic from my server" is a reasonable web pattern and a review failure for extensions.
  1. The browser APIs are the platform; frameworks are optional. Many good extensions are a few hundred lines of plain scripts. Reach for a bundler or UI framework when the popup or options UI is genuinely complex or the team already uses one — not by default.

Architecture: the parts and what each is for

PartLivesCan doCannot doUse it for
Manifestmanifest.jsonDeclares everything: permissions, entry points, icons, matches, CSPRun codeThe contract with the browser and the store
Background service workerOne per extension, ephemeralMost chrome.*/browser.* APIs, network, alarms, context menus, cross-tab coordinationTouch the DOM; hold state across suspension; use windowCentral coordinator, event handling, API calls, privileged work
Content scriptsInjected into matching pages, one instance per frameRead/modify page DOM, a limited subset of extension APIs (messaging, storage, i18n)Access page JS variables directly (isolated world); call most privileged APIsReading or changing pages
PopupOpens from toolbar action; destroyed when closedFull extension APIs, DOM of its own pagePersist anything in memory after closingQuick interactions, status, toggles
Side panel / sidebarPersistent panel (browser-dependent)Like an extension page, survives navigationExist on every browser in the same formLong-lived tools alongside browsing
Options pageExtension pageFull extension APIs—Settings that change rarely
Offscreen document (Chromium)Hidden extension page created on demandDOM APIs (audio, clipboard, DOM parsing) the worker lacksBe permanent; be used for arbitrary reasonsWork that needs a DOM but not a visible page
Injected page-world scriptPage's own JS realmSee and patch page variablesUse extension APIs; be trustedOnly when you must interact with page JS — minimise it

Isolated vs main world. Content scripts run in an isolated world: they share the DOM with the page but not the JavaScript globals. If you need to read a page variable or hook a page function, you must inject into the main world (via scripting.executeScript with a world option where supported, or a <script> element), and that code has no extension privileges and is visible to the page. Bridge the two with DOM events or postMessage, and validate on the isolated side.

Process

1. Pin down the job and the minimum capability

Before writing a manifest, write one sentence: "When the user does X on Y pages, the extension does Z." Then derive the minimum capability:

  • Which pages? All sites, a known list of domains, or only the page the user is on when they click? "Only when clicked" means activeTab and no host permissions.
  • Triggered how? Toolbar click, context menu, keyboard command, page load, a schedule? Page-load triggers require declared content scripts or host permissions; user-gesture triggers can often use activeTab.
  • What data leaves the browser? None, to your server, to a third party? This decides privacy disclosures and possibly the whole design.
  • Which browsers? Chromium only, plus Firefox, plus Safari? Safari requires an Xcode/macOS packaging step and a developer account; confirm before promising it.

Ask the user when these are unclear — they change the permission set, which changes the warning users see.

2. Discover context

If extending an existing extension:

  • Read manifest.json first: manifest version, permissions, host permissions, content script matches, background type, CSP, browser_specific_settings.
  • Find the build: is the manifest generated (by a bundler plugin or framework) or hand-written? Edit the source of truth, not the build output.
  • Identify the message protocol already in use (message type names, a router, a typed schema) and extend it rather than adding a parallel one.
  • Check storage keys and any migration logic; changing a key shape without migration breaks existing users.
  • Look for a polyfill or wrapper (browser namespace polyfill, a project-specific API wrapper) and use it consistently.
3. Choose the shape

Decide the minimum set of contexts. Common shapes:

  • Action-only: popup + activeTab + scripting.executeScript on click. No background at all, or a trivial one. Smallest permission footprint; great for "do something to this page".
  • Page enhancer: declared content scripts on specific matches, little or no background. Good for "always tweak site X".
  • Coordinator: background worker owns state, network and API calls; content scripts and UI are thin clients that message it. Good when multiple tabs share state or when calls need credentials.
  • Request modifier: declarative network rules (declarativeNetRequest in Chromium MV3; Firefox also retains blocking webRequest). Prefer declarative rules — they are faster, need fewer permissions and are what MV3 expects.
4. Write the manifest deliberately
  • Start from the smallest permission set and add only with a stated reason. Keep a short note (in the repo or PR) of why each permission exists — reviewers ask, and future you will forget.
  • Put rarely needed permissions in optional_permissions / optional_host_permissions and request them from a user gesture when the feature is first used.
  • Scope content script matches as narrowly as the job allows. <all_urls> is a decision to defend, not a default.
  • Set run_at intentionally: document_idle (default, safest), document_end, or document_start (only when you must act before page scripts, and then expect a partially built DOM).
  • Consider all_frames explicitly: iframes are where many "works on some pages" bugs live.
  • Declare web_accessible_resources only for resources pages genuinely need, with matches restricted; these resources let sites fingerprint that your extension is installed.
  • Do not loosen the extension CSP to allow remote scripts or eval; MV3 forbids remote code and stores reject it.
5. Design the message protocol

Treat messages like a small API:

  • Every message has a type (or equivalent discriminator) and a payload with a known shape. Validate shape on receipt.
  • Decide request/response vs fire-and-forget per message. For responses, either return a Promise from the listener (where the browser supports it) or call sendResponse and return true to keep the channel open. Mixing these is a classic source of undefined responses.
  • Check sender: for messages from content scripts, sender.tab and sender.url/origin tell you which page asked. For external messages (externally_connectable), allow-list origins and extension IDs.
  • Use long-lived ports (runtime.connect) for streams or chatty exchanges; use one-off messages otherwise. Ports also keep a worker alive while open in some browsers, which is useful and also a way to accidentally burn resources.
  • Handle "receiving end does not exist": the content script may not be injected yet (tab loaded before install, restricted page, wrong frame). Catch this, and inject on demand if appropriate.
6. Design storage
StoreScopeSurvivesTypical useWatch out for
storage.localDeviceRestarts, worker suspensionCaches, larger data, stateQuotas (generous but finite; unlimitedStorage if justified)
storage.syncUser's signed-in browsersAcross devicesSmall preferencesTight per-item and total quotas, write-rate limits; never secrets
storage.sessionBrowser session, memory-backedWorker suspension, not restartEphemeral state the worker needs between events, tokens you do not want on diskNot exposed to content scripts by default; small quota
storage.managedSet by enterprise policy—Admin-configured settingsRead-only
IndexedDB (extension origin)DeviceRestartsLarge structured dataNot reachable from content scripts' extension origin directly — go via messages
localStorageExtension page originRestartsAvoidUnavailable in service workers; synchronous

Rules: version your stored schema (schemaVersion key) and migrate on runtime.onInstalled with reason update. Use storage.onChanged to keep UIs in sync instead of polling. Batch writes; storage.sync especially throttles.

7. Build the background for suspension

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Extension points

  • pluginCustom plugin integration

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/kmaruthi2002/universal-llm-skills/browser-extension-development/badge)](https://verified-skill.com/skills/kmaruthi2002/universal-llm-skills/browser-extension-development)

Something wrong with this skill or its page? Tell us.