← library
prompt🧭 Browser extensionsv2 · updated 2026-06-12

Browser extension

Manifest V3 extension with WXT, typed messaging, and store-ready packaging.

Run it as a prompt

Paste this into any AI agent, or fetch it: curl -s https://uplift.page/api/v1/prompts/browser-extension/raw

prompt.md
# Browser extension

Ship a Manifest V3 extension that passes store review the first time and doesn't break when the host page changes.

## Recommended stack

- **WXT** - framework. Vite-powered MV3 scaffolding with HMR, typed entrypoints, and multi-browser builds.
- **TypeScript** - language. Message-passing bugs between contexts are type bugs.
- **@webext-core/messaging** - messaging. Typed request/response between content scripts, background, and popup.

## Build steps

1. Pick the minimal permission set; every extra permission is store-review friction and user distrust.
2. Structure by context: background (service worker), content scripts, popup/options - share types, not state.
3. Use storage.sync for settings with a typed wrapper; never assume the service worker stays alive.
4. Make content scripts resilient: feature-detect DOM hooks, fail silent, retry on SPA navigation.
5. Build for Chrome + Firefox with WXT; write the store listing (screenshots, privacy policy) before submission.

## Watch out for

- Requesting <all_urls> when activeTab would do - instant review rejection risk.
- State in the service worker's memory; MV3 kills it whenever it likes.
- Brittle selectors on a site you don't control without fallbacks.

## Definition of done

- Works after the service worker is manually terminated
- Passes Chrome Web Store review checklist (permissions justified, privacy policy linked)
- Survives the host site's SPA navigation

The full prompt

Ship a Manifest V3 extension that passes store review the first time and doesn't break when the host page changes.

Recommended stack

  • WXT - framework. Vite-powered MV3 scaffolding with HMR, typed entrypoints, and multi-browser builds.
  • TypeScript - language. Message-passing bugs between contexts are type bugs.
  • @webext-core/messaging - messaging. Typed request/response between content scripts, background, and popup.

Build steps

  1. Pick the minimal permission set; every extra permission is store-review friction and user distrust.
  2. Structure by context: background (service worker), content scripts, popup/options - share types, not state.
  3. Use storage.sync for settings with a typed wrapper; never assume the service worker stays alive.
  4. Make content scripts resilient: feature-detect DOM hooks, fail silent, retry on SPA navigation.
  5. Build for Chrome + Firefox with WXT; write the store listing (screenshots, privacy policy) before submission.

Watch out for

  • Requesting when activeTab would do - instant review rejection risk.
  • State in the service worker's memory; MV3 kills it whenever it likes.
  • Brittle selectors on a site you don't control without fallbacks.

Definition of done

  • Works after the service worker is manually terminated
  • Passes Chrome Web Store review checklist (permissions justified, privacy policy linked)
  • Survives the host site's SPA navigation

Served from the uplift.page library and refreshed within 5 minutes of every update.