chrome-extension-wxt
БесплатноЗапускает вложенные скриптыНе проверенBuilds cross-browser extensions with WXT - entrypoints, content-script UI, storage, messaging, MV3 rules, testing, publishing. Use for Chrome or browser…
от tenequm1 853 установки в других каталогахОб этом скилле
Browser Extensions with WXT
WXT is a Vite-based framework that builds one codebase for Chrome, Firefox, Edge and Safari. It generates the manifest from files in entrypoints/, so there is no manifest.json in the source tree.
Verified against [email protected]. WXT 0.21 needs Node >= 22, and vite (^6.3.4, ^7 or ^8) is a required peer dependency.
Before you start
- Confirm it is a WXT project:
wxt.config.tsexists andwxtis inpackage.json. If not, do not migrate the project unasked; the WXT sections do not apply, butreferences/chrome-mv3.mdstill does. - Check the installed
wxtversion. This skill targets 0.21. Below 0.20 the import paths and several APIs differ: follow the upgrade guide before applying these patterns.
Rules that prevent most failures
- WXT APIs are auto-imported globals.
defineBackground,defineContentScript,defineUnlistedScript,createShadowRootUi,browser,storage,injectScript,MatchPatternandContentScriptContextneed no import line. Never "fix" them as missing imports. - The old import paths are gone.
wxt/sandbox,wxt/client,wxt/storageandwxt/match-patterndo not exist; using one fails withMissing "./sandbox" specifier in "wxt" package. For an explicit import useimport { storage } from '#imports'. The per-utility paths arewxt/utils/*andwxt/browser. - "Cannot find name defineBackground" means the generated types are missing. Run
wxt prepare(wired as"postinstall": "wxt prepare"). It regenerates.wxt/, whichtsconfig.jsonextends. Do not add imports to silence it. .wxt/and.output/are generated. Gitignore both, along withweb-ext.config.ts.- Runtime code goes inside
main(). WXT imports every entrypoint in Node at build time, so top-levelbrowser.*ordocument.*calls fail the build withdocument is not defined. - Nothing loose in
entrypoints/. Every file or folder directly inside it becomes an entrypoint. Put helper files inside the entrypoint's own folder (popup/,overlay.content/) or incomponents/andutils/. Entrypoints cannot nest deeper than one level, and names must be unique across types:foo.tsandfoo.content.tsclash. await createShadowRootUi(...). It returns a promise.createIntegratedUiandcreateIframeUiare synchronous.- Write the manifest in MV3 form. WXT converts
action,host_permissionsandweb_accessible_resourcesfor MV2 targets. It does not convert runtime API calls: see Targeting browsers. The extensionversioncomes frompackage.json. - The MV3 service worker is stateless. See Background.
What WXT recommends
Each line restates a recommendation from WXT's or Chrome's own docs.
- Storage: define items with
storage.defineItem; it is WXT's recommended way to get type safety. - Messaging: use a library that wraps the raw API, such as
@webext-core/messaging. - Page-context code: inject an unlisted script with
injectScriptrather thanworld: 'MAIN'. - Manifest: write every property in MV3 form; WXT converts for MV2 targets.
- Entrypoints: one directory per entrypoint, holding its own files.
- Extension APIs: use
browser, and feature-detect APIs a browser may lack. - Routing in pages: hash mode (
createHashRouterand equivalents), because extension pages are static files. - Tests: Vitest with
WxtVitestfor units; Playwright for end-to-end. - Translations: the built-in
browser.i18nAPI or@wxt-dev/i18n.
Two platform facts from Chrome's docs shape most designs:
- Content scripts are less trustworthy than the background. A compromised page can forge their messages. Validate every message they send, and derive the page's origin from
sender.url, not from the payload. - A popup closes as soon as it loses focus and cannot be kept open. Keep its state in storage.
Quick start
npx wxt@latest init my-extension -t react --pm npm
cd my-extension
npm install
Templates are vanilla, vue, react, svelte and solid (all TypeScript). --pm takes npm, pnpm, yarn or bun. There is no create-wxt package, so npm create wxt fails. The templates do not list vite; npm and pnpm install the peer automatically, so nothing is needed. With Yarn, add vite to devDependencies.
For an existing project: npm i -D wxt vite, then add the scripts the templates use:
{
"scripts": {
"dev": "wxt",
"dev:firefox": "wxt -b firefox",
"build": "wxt build",
"build:firefox": "wxt build -b firefox",
"zip": "wxt zip",
"zip:firefox": "wxt zip -b firefox",
"compile": "tsc --noEmit",
"postinstall": "wxt prepare"
}
}
npm run dev opens a browser with the extension loaded only when the optional web-ext package is installed (npm i -D web-ext). Without it, load `.output/chr
Установить chrome-extension-wxt в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл chrome-extension-wxt?
Builds cross-browser extensions with WXT - entrypoints, content-script UI, storage, messaging, MV3 rules, testing, publishing. Use for Chrome or browser extension work, wxt.config.ts, Manifest V3, or WXT build and type errors.
Как установить скилл chrome-extension-wxt?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл chrome-extension-wxt запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic