← Back to Skills Marketplace
tenequm

Chrome Extension Development with WXT

by Misha Kolesnik · GitHub ↗ · v1.1.0 · MIT-0
cross-platform ✓ Security Clean
121
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install chrome-extension-wxt
Description
Build Chrome extensions using WXT framework with TypeScript, React, Vue, or Svelte. Use when creating browser extensions, developing cross-browser add-ons, o...
README (SKILL.md)

Chrome Extension Development with WXT

Build modern, cross-browser extensions using WXT - the next-generation framework that supports Chrome, Firefox, Edge, Safari, and all Chromium browsers with a single codebase.

When to Use This Skill

Use this skill when:

  • Creating a new Chrome/browser extension
  • Setting up WXT development environment
  • Building extension features (popup, content scripts, background scripts)
  • Implementing cross-browser compatibility
  • Working with Manifest V3 (mandatory standard as of 2025, V2 deprecated)
  • Integrating React 19, Vue, Svelte, or Solid with extensions

Quick Start Workflow

1. Initialize WXT Project

# Create new project with framework of choice
npm create wxt@latest

# Or with specific template
npm create wxt@latest -- --template react-ts
npm create wxt@latest -- --template vue-ts
npm create wxt@latest -- --template svelte-ts

2. Project Structure

WXT uses file-based conventions:

project/
├── entrypoints/              # Auto-discovered entry points
│   ├── background.ts         # Service worker
│   ├── content.ts           # Content script
│   ├── popup.html           # Popup UI
│   └── options.html         # Options page
├── components/              # Auto-imported UI components
├── utils/                   # Auto-imported utilities
├── public/                  # Static assets
│   └── icon/               # Extension icons
├── wxt.config.ts           # Configuration
└── package.json

3. Development Commands

npm run dev              # Start dev server with HMR
npm run build           # Production build
npm run zip             # Package for store submission

Core Entry Points

WXT recognizes entry points by filename in entrypoints/ directory:

Background Script (Service Worker)

// entrypoints/background.ts
export default defineBackground({
  type: 'module',
  persistent: false,

  main() {
    // Listen for extension events
    browser.action.onClicked.addListener((tab) => {
      console.log('Extension clicked', tab);
    });

    // Handle messages
    browser.runtime.onMessage.addListener((message, sender, sendResponse) => {
      // Handle message
      sendResponse({ success: true });
      return true; // Keep channel open for async
    });
  },
});

Content Script

// entrypoints/content.ts
export default defineContentScript({
  matches: ['*://*.example.com/*'],
  runAt: 'document_end',

  main(ctx) {
    // Content script logic
    console.log('Content script loaded');

    // Create UI
    const ui = createShadowRootUi(ctx, {
      name: 'my-extension-ui',
      position: 'inline',
      anchor: 'body',

      onMount(container) {
        // Mount React/Vue component
        const root = ReactDOM.createRoot(container);
        root.render(\x3CApp />);
      },
    });

    ui.mount();
  },
});

Popup UI

// entrypoints/popup/main.tsx
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';

ReactDOM.createRoot(document.getElementById('root')!).render(
  \x3CReact.StrictMode>
    \x3CApp />
  \x3C/React.StrictMode>
);
\x3C!-- entrypoints/popup/index.html -->
\x3C!DOCTYPE html>
\x3Chtml>
\x3Chead>
  \x3Cmeta charset="UTF-8">
  \x3Ctitle>Extension Popup\x3C/title>
\x3C/head>
\x3Cbody>
  \x3Cdiv id="root">\x3C/div>
  \x3Cscript type="module" src="./main.tsx">\x3C/script>
\x3C/body>
\x3C/html>

Configuration

Basic wxt.config.ts

import { defineConfig } from 'wxt';

export default defineConfig({
  // Framework integration
  modules: ['@wxt-dev/module-react'],

  // Manifest configuration
  manifest: {
    name: 'My Extension',
    description: 'Extension description',
    permissions: ['storage', 'activeTab'],
    host_permissions: ['*://example.com/*'],
  },

  // Browser target
  browser: 'chrome', // or 'firefox', 'edge', 'safari'
});

Common Patterns

Type-Safe Storage

// utils/storage.ts
import { storage } from 'wxt/storage';

export const storageHelper = {
  async get\x3CT>(key: string): Promise\x3CT | null> {
    return await storage.getItem\x3CT>(`local:${key}`);
  },

  async set\x3CT>(key: string, value: T): Promise\x3Cvoid> {
    await storage.setItem(`local:${key}`, value);
  },

  watch\x3CT>(key: string, callback: (newValue: T | null) => void) {
    return storage.watch\x3CT>(`local:${key}`, callback);
  },
};

Type-Safe Messaging

// utils/messaging.ts
interface Messages {
  'get-data': {
    request: { key: string };
    response: { value: any };
  };
}

export async function sendMessage\x3CK extends keyof Messages>(
  type: K,
  payload: Messages[K]['request']
): Promise\x3CMessages[K]['response']> {
  return await browser.runtime.sendMessage({ type, payload });
}

Script Injection

// Inject script into page context
import { injectScript } from 'wxt/client';

await injectScript('/injected.js', {
  keepInDom: false,
});

Building & Deployment

Production Build

# Build for specific browser
npm run build -- --browser=chrome
npm run build -- --browser=firefox

# Create store-ready ZIP
npm run zip
npm run zip -- --browser=firefox

Multi-Browser Build

# Build for all browsers
npm run zip:all

Output: .output/my-extension-{version}-{browser}.zip

Modern Stacks (2025)

Popular technology combinations for building Chrome extensions:

WXT + React + Tailwind + shadcn/ui

Most popular stack in 2025. Combines utility-first styling with pre-built accessible components.

npm create wxt@latest -- --template react-ts
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p
npx shadcn@latest init

Best for: Modern UIs with consistent design system Example: https://github.com/imtiger/wxt-react-shadcn-tailwindcss-chrome-extension

WXT + React + Mantine UI

Complete component library with 100+ components and built-in dark mode.

npm create wxt@latest -- --template react-ts
npm install @mantine/core @mantine/hooks

Best for: Feature-rich extensions needing complex components Example: https://github.com/ongkay/WXT-Mantine-Tailwind-Browser-Extension

WXT + React + TypeScript (Minimal)

Clean setup for custom designs without UI library dependencies.

npm create wxt@latest -- --template react-ts

Best for: Simple extensions or highly custom designs

Advanced Topics

For detailed information on advanced topics, see the reference files:

  • React Integration: See references/react-integration.md for complete React setup, hooks, state management, and popular UI libraries
  • Chrome APIs: See references/chrome-api.md for comprehensive Chrome Extension API reference with examples
  • Chrome 140+ Features: See references/chrome-140-features.md for latest Chrome Extension APIs (sidePanel.getLayout(), etc.)
  • WXT API: See references/wxt-api.md for complete WXT framework API documentation
  • Best Practices: See references/best-practices.md for security, performance, and architecture patterns

Troubleshooting

Common issues and solutions:

  1. Module not found errors: Ensure modules are installed and properly imported
  2. CSP violations: Update content_security_policy in manifest
  3. Hot reload not working: Check browser console for errors
  4. Storage not persisting: Use storage.local or storage.sync correctly

For detailed troubleshooting, see references/troubleshooting.md

Resources

Official Documentation

Bundled Resources

  • scripts/: Helper utilities for common extension tasks
  • references/: Detailed documentation for advanced features
  • assets/: Starter templates and example components

Use these resources as needed when building your extension.

Usage Guidance
This skill is an instruction-only developer guide for WXT-based extensions and appears coherent with that purpose. It does not request credentials or install code on its own, but follow these precautions before using the workflow it describes: - Review package sources/templates before running npm create/npm install — npm packages bring third-party code into your project. Prefer official wxt templates or inspect the template repository. - Check manifest permissions generated for the extension. Avoid broad host_permissions or <all_urls> unless strictly needed; excessive permissions increase risk to users. - Be careful with defineWebExtConfig options like keepProfileChanges and chromiumProfile/firefoxProfile: pointing to your real browser profile or enabling persistent changes will expose cookies, logins, and stored data to the test extension. Use throwaway profiles or CI-specific profiles when testing. - Do not hardcode API keys or secrets in source; follow the references' advice to store secrets in browser.storage and protect them appropriately. - When packaging or publishing, inspect the final build (.zip) and manifest for unexpected permissions or network endpoints. - If you need higher assurance, run builds and template installs inside an isolated environment (container/VM) and audit node_modules or run dependency-scanning tools. Overall, the skill is internally consistent and useful for extension development; the main risks are the normal developer-side privacy and supply-chain concerns inherent to npm-based web development, not anything anomalous in the skill itself.
Capability Analysis
Type: OpenClaw Skill Name: chrome-extension-wxt Version: 1.1.0 The skill bundle provides a comprehensive development environment and documentation for building Chrome extensions using the WXT framework. It includes detailed API references, React integration guides, and security best practices (e.g., CSP and input validation in best-practices.md). No evidence of data exfiltration, malicious execution, or prompt injection was found; all code snippets and instructions are consistent with legitimate extension development.
Capability Assessment
Purpose & Capability
Name/description, examples, and runtime instructions all align: the skill documents how to scaffold, develop, build, and package WXT-based browser extensions. It does not request unrelated credentials, binaries, or system paths.
Instruction Scope
SKILL.md and reference docs stay within extension development scope. Notable caution: examples and defineWebExtConfig encourage using persistent browser profiles (keepProfileChanges, chromiumProfile/firefoxProfile) and custom browser binary paths, which — if used with real personal profiles — can expose cookies, sessions, and other sensitive data. The skill does not instruct reading unrelated system files, but developer actions it suggests can have privacy implications.
Install Mechanism
Instruction-only: no install spec and no code files executed by the platform. The workflow relies on npm tooling (npm create, npm install) which is expected for JavaScript/TypeScript extension projects; this is proportional to the stated purpose.
Credentials
The skill declares no required environment variables, credentials, or config paths. The only potentially sensitive items are developer-specified local paths (browser binaries, profile directories) and optional manifest permissions; these are typical for local extension development and are not requested by the skill itself.
Persistence & Privilege
The skill is not always-enabled and does not request persistent platform privileges. It does not modify other skills or global agent settings. Suggestions in docs to persist profile data are development options, not built-in privileges of the skill.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install chrome-extension-wxt
  3. After installation, invoke the skill by name or use /chrome-extension-wxt
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.1.0
Initial publish of chrome-extension-wxt 1.1.0. Changes: - bootstrap publish of current skill contents
Metadata
Slug chrome-extension-wxt
Version 1.1.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is Chrome Extension Development with WXT?

Build Chrome extensions using WXT framework with TypeScript, React, Vue, or Svelte. Use when creating browser extensions, developing cross-browser add-ons, o... It is an AI Agent Skill for Claude Code / OpenClaw, with 121 downloads so far.

How do I install Chrome Extension Development with WXT?

Run "/install chrome-extension-wxt" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Chrome Extension Development with WXT free?

Yes, Chrome Extension Development with WXT is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Chrome Extension Development with WXT support?

Chrome Extension Development with WXT is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Chrome Extension Development with WXT?

It is built and maintained by Misha Kolesnik (@tenequm); the current version is v1.1.0.

💬 Comments