How to Build a Chrome Extension with Claude Code (Manifest V3 Tutorial)
Build a Chrome extension with Claude Code: generate the Manifest V3 files, test the popup locally, debug errors and prepare a Chrome Web Store release.

Article content
Search for "claude chrome extension" and you get three different things: Anthropic's own browser extension, a way to connect Claude Code to Chrome, and people using Claude to write extensions of their own. This tutorial covers the third. You'll use Claude or Claude Code to plan, write, load and debug a small Manifest V3 extension called Reading Time. It shows the word count and estimated reading time of the page you're on, and it remembers your reading speed.
There's no framework, no build step and no paid service involved. Every file is printed in full, and we ran this exact code in Chromium before publishing. Claude writes most of it. You still decide what the extension may access, and you still test it.
What Is a Claude Chrome Extension?
The phrase covers three separate things, and only one of them is about writing code. Find your row first.
| What you want to do | What you need | Covered here? |
|---|---|---|
| Have Claude read pages, click and fill forms in your browser | Claude in Chrome, Anthropic's official extension | No. Install it from the Chrome Web Store listing |
| Let Claude Code open pages, read console errors and test a site you're building | Claude Code plus its Chrome integration | Briefly, as an optional testing aid |
| Build your own Chrome extension with AI | Claude.ai in a browser tab, or Claude Code in a project folder | Yes. This is the tutorial |
Claude in Chrome is a product you install and use. Anthropic describes it as an extension that lets Claude work on the pages you have open, and lists it as available on all paid plans. Building an extension with Claude means Claude is your coding assistant and the extension is yours: your name, your code, your Chrome Web Store listing.
You do not need Claude in Chrome installed to build an extension with Claude. The two only meet in one optional place, covered below, where Claude Code borrows that extension to drive your browser during testing.
Can Claude Actually Build a Chrome Extension?
Yes. A Chrome extension is a folder of JSON, HTML, CSS and JavaScript files, which is exactly the kind of work Claude does well. For a small extension it can write every file. Here's what you can reasonably hand over:
- The structure: which files the extension needs, and which it doesn't.
- manifest.json: a valid Manifest V3 file with the permissions the feature requires.
- The interface: popup HTML and CSS, options pages, side panels.
- The logic: JavaScript for popups, content scripts and event-driven service workers, using the right Chrome APIs.
- Debugging: reading an error message you paste in and proposing a fix.
- Cleanup and paperwork: refactoring, a README, store listing copy and a release checklist.
What stays with you is the part no model can see from inside a chat:
- Reading the code. At minimum the manifest, because that file decides what your extension can touch.
- Questioning permissions. Claude tends to ask for more access than a feature needs. Each permission should have a reason you can say out loud.
- Testing on real pages. Sites differ. A script that works on a blog can fail on a web app that loads content late.
- Data handling. If the extension collects or sends anything, you're responsible for what happens to it.
- Store compliance. Google reviews the extension. Claude's opinion that it complies is not a guarantee.
Generating code and shipping reliable software are different jobs. Claude gets you through the first one fast. It can also produce outdated Manifest V2 patterns, invent an API option that doesn't exist, or rewrite a working file while fixing a different one. The steps below are arranged to catch those problems early.
What You Need Before Building Your Chrome Extension
You need Google Chrome, a folder on your computer and one of two ways to work with Claude. For the Reading Time example you don't need Node.js, npm or any build tool, because Chrome loads plain files straight from the folder. A build step only becomes useful later, if you add TypeScript or a UI framework.
Option A: Claude.ai in the browser
This is the lowest-effort start and it works on the free plan. You describe the idea in a chat, ask Claude for a plan, then ask for one file at a time. You create each file yourself in a text editor such as VS Code, paste the contents in and save. When something breaks, you paste the error back into the chat.
The trade-off is that Claude can't see your folder. If you edit a file and forget to mention it, Claude keeps working from its old version. For four files that's manageable. For twenty it gets tedious.
Option B: Claude Code in your project folder
Claude Code is Anthropic's coding tool that reads your project, edits files and runs commands. It's available in the terminal, in IDE extensions, as a desktop app and on the web. You open it inside your project folder and it creates and changes the files directly, showing each change for approval.
Anthropic's setup page lists a native installer that doesn't require Node.js. On macOS, Linux or WSL:
curl -fsSL https://claude.ai/install.sh | bashOn Windows PowerShell:
irm https://claude.ai/install.ps1 | iexThen start it from the folder you want to work in:
mkdir reading-time
cd reading-time
claudeThe same page states that Claude Code needs a Pro, Max, Ultra, Team, Enterprise or Console account, and that the free Claude.ai plan doesn't include it. Check Claude's pricing page for current prices before you subscribe.
Optional: Claude Code's Chrome integration
Claude Code can also connect to your browser. You start it with the --chrome flag, and it uses the Claude in Chrome extension to open tabs, read console errors and inspect page state. Anthropic's documentation says this needs Claude in Chrome version 1.0.36 or later and a direct Anthropic plan, and that it isn't supported in WSL.
It's handy when your extension changes a web page and you want Claude to look at the result. It is not required for anything in this tutorial, and it's a different thing from the extension you're building.
Understanding Chrome Extension Architecture
You'll write better prompts, and spot Claude's mistakes sooner, if you know what the parts are. An extension has up to four of them. Most small extensions need two.

manifest.json
The manifest is the only required file. Chrome reads it first to learn the extension's name, version, what it's allowed to do and which files to run. The fields that matter most:
- manifest_version: must be 3. The Chrome Web Store stopped accepting new Manifest V2 extensions in 2022.
- name, version, description: shown in Chrome and in the store.
- permissions: the Chrome APIs the extension may use, such as storage or scripting.
- host_permissions: the websites it may read or change at any time. This is the field to keep as small as possible.
- action: the toolbar icon and the popup it opens.
- content_scripts: files Chrome injects into matching pages automatically.
- background: the service worker file, if there is one.
Popup interface
The popup is a small web page that opens when someone clicks your toolbar icon. It's usually three files: popup.html for structure, popup.css for looks and popup.js for behaviour. It exists only while it's open. Close it and its JavaScript stops, so anything worth keeping has to be saved somewhere first.
Content scripts
A content script is JavaScript that runs inside a web page and can read or change that page's DOM. You need one when the extension has to work on a page without being clicked, for example to highlight prices as soon as a shop page loads. The matches pattern in the manifest decides which sites it runs on, and a narrow pattern such as one domain is far easier to justify than every website. Our content scripts guide goes deeper.
Reading Time doesn't use a content script file. It only needs the page when the user clicks the icon, so it injects one small function on demand instead. That avoids running code on every page the user visits.
Background service workers
Manifest V3 replaced the always-on background page with a service worker. It wakes up when an event arrives, such as an install, an alarm or a message, and Chrome shuts it down again after about 30 seconds of inactivity. Three consequences trip up generated code:
- No DOM. A service worker can't touch document or window. Only content scripts and extension pages can.
- No lasting variables. A value kept in a global variable disappears when the worker stops. State belongs in chrome.storage.
- Listeners at the top level. Event listeners must be registered when the script first runs, not inside a callback, or Chrome may not find them when it restarts the worker.
Google's service worker migration guide explains each point, and our service worker guide covers the patterns. Reading Time has no background work to do, so it has no service worker at all.
Chrome APIs
Chrome APIs are how extension code talks to the browser. These five cover most first projects:
| API | What it does | Permission | In Reading Time? |
|---|---|---|---|
| chrome.tabs | Finds and manages tabs | None for the active tab's id | Yes, to find the current tab |
| chrome.scripting | Runs a function or file inside a page | scripting, plus access to the page | Yes, to count words |
| chrome.storage | Saves data that survives restarts | storage | Yes, to remember reading speed |
| chrome.runtime | Sends messages between parts of the extension | None | No, there's only one part |
| chrome.alarms | Runs code on a schedule | alarms | No |
If your idea needs the popup to talk to a content script or a service worker, read the message passing guide before you prompt. It's the area where generated code most often looks right and fails silently.
Step-by-Step: Build Your First Chrome Extension with Claude
Here's what you'll have at the end. Click the Reading Time icon on any article and a popup shows the page's word count and an estimated reading time. A dropdown switches between slow, average and fast reading speeds, and the choice is remembered. On pages Chrome protects, such as its own settings pages, the popup says it can't read the page instead of failing silently.

Step 1: Define the extension idea
Don't ask for code yet. A vague request produces a vague extension with broad permissions. Ask for a plan first, and make Claude state its assumptions:
I want to build a Chrome extension called Reading Time.
What it does: when I click the toolbar icon, a popup shows the word count of the current page and an estimated reading time. I can pick a reading speed (slow, average, fast) and the extension remembers my choice.
Who it's for: people who read long articles and want to know how long one will take.
Before writing any code, give me a short plan that covers:
1. The files needed and what each one does. Use as few as possible.
2. Which Chrome APIs you will use and why.
3. Every permission required, with a one-line reason for each. Prefer activeTab over host permissions.
4. Edge cases: pages with no text, Chrome's own pages, very long pages.
5. Whether any data leaves the browser.
Target Manifest V3. Do not add a background service worker or a content script file unless the feature cannot work without one. Wait for my approval before generating files.A good plan comes back with four files, three permissions and no network requests. If the plan includes a service worker, a content script that runs on every site, or access to all websites, ask why. Usually it will agree they aren't needed.
Step 2: Create the project folder
This is the complete project. Nothing else is required:
reading-time/
├── CLAUDE.md
├── manifest.json
├── popup.html
├── popup.css
├── popup.js
└── icons/
├── icon16.png
├── icon48.png
└── icon128.pngWith Claude Code, create the empty folder and start claude inside it. With Claude.ai, create the folder and the empty files yourself. The icons are three square PNG images. Make them in any image editor, or ask Claude Code to generate simple ones. If you'd rather start without icons, remove both icon blocks from the manifest and Chrome shows a default icon. You'll need the 128-pixel icon before publishing.
Step 3: Create a CLAUDE.md project instruction file
Claude Code reads a file called CLAUDE.md from your project folder at the start of every session. It's the place for rules you'd otherwise repeat in every prompt. Anthropic's memory documentation describes it, and running /init generates a starter file. For extension work, write your own:
# Reading Time: Chrome extension
## Platform rules
- Manifest V3 only. Never use Manifest V2 keys or APIs (background.scripts, browser_action, chrome.extension.getBackgroundPage, chrome.tabs.executeScript).
- Use current Chrome extension APIs. If unsure whether an API or option exists, say so instead of guessing.
- Request the minimum permissions. Prefer activeTab over host_permissions. Never add <all_urls> without asking me first.
- No eval(), no new Function(), no inline <script> or onclick attributes, no code loaded from a remote server.
- Never put API keys or other secrets in extension files.
## Architecture
- Plain HTML, CSS and JavaScript. No frameworks, no build step, no new dependencies without asking.
- Only add a service worker or content script if a feature cannot work without one. Explain why first.
- If a service worker is added: register listeners at the top level and keep state in chrome.storage, not in global variables.
- Persistent settings go in chrome.storage.local.
## How to work
- Change the smallest amount of code that solves the task. Do not rewrite files that already work.
- When you change manifest.json, list every permission and the reason for it.
- After each change, tell me exactly how to test it in Chrome.Using Claude.ai instead? Paste the same rules as your first message, or put them in a Project's instructions.
One caution from Anthropic's own documentation: Claude treats this file as context, not as enforced configuration. It makes mistakes less likely. It doesn't make testing optional.
Step 4: Generate manifest.json
Create manifest.json for the Reading Time extension from the approved plan. Manifest V3, a popup as the toolbar action, icons at 16, 48 and 128 pixels in an icons folder, and only the permissions the plan justified. After the file, list each permission with its reason.This is the manifest we tested:
{
"manifest_version": 3,
"name": "Reading Time",
"version": "1.0.0",
"description": "Shows the word count and estimated reading time of the page you are on.",
"action": {
"default_popup": "popup.html",
"default_title": "Reading Time",
"default_icon": {
"16": "icons/icon16.png",
"48": "icons/icon48.png",
"128": "icons/icon128.png"
}
},
"icons": {
"16": "icons/icon16.png",
"48": "icons/icon48.png",
"128": "icons/icon128.png"
},
"permissions": ["activeTab", "scripting", "storage"]
}Check the last line carefully, because it's where generated manifests go wrong. Each permission has a job:
| Permission | Why Reading Time needs it | What it avoids |
|---|---|---|
| activeTab | Temporary access to the current tab, granted only when the user clicks the icon | A host permission for every website, and the install warning that comes with it |
| scripting | Lets the popup run the word-count function inside the page | A content script injected into every page |
| storage | Saves the chosen reading speed | Losing the setting each time the popup closes |
There is no host_permissions field and no background field. If Claude adds either, ask what feature needs it. Google's activeTab documentation explains why temporary access is the safer default.
Step 5: Generate the extension functionality
Now the logic. Be specific about behaviour and failure cases:
Create popup.js for Reading Time.
When the popup opens:
1. Load the saved reading speed from chrome.storage.local (default 230 words per minute) and select it in the dropdown with id "speed".
2. Find the active tab and use chrome.scripting.executeScript to run a function in the page that returns the number of words in document.body.innerText.
3. Show the word count in the element with id "words" and the reading time in minutes, rounded up with a minimum of 1, in the element with id "minutes".
4. When the dropdown changes, save the new speed and update the reading time without counting again.
5. If the page can't be read (for example a chrome:// page), show a friendly message in the element with id "status" and hide the results.
Use async/await. No inline scripts. Add a short comment wherever something is not obvious.const DEFAULT_SPEED = 230;
const statusEl = document.getElementById("status");
const resultEl = document.getElementById("result");
const wordsEl = document.getElementById("words");
const minutesEl = document.getElementById("minutes");
const speedEl = document.getElementById("speed");
let wordCount = null;
// Runs inside the web page, not in the popup. It cannot use popup variables.
function countWordsOnPage() {
const text = document.body ? document.body.innerText : "";
const words = text.trim().split(/\s+/).filter(Boolean);
return words.length;
}
function render() {
if (wordCount === null) return;
const speed = Number(speedEl.value);
const minutes = Math.max(1, Math.ceil(wordCount / speed));
wordsEl.textContent = wordCount.toLocaleString();
minutesEl.textContent = `${minutes} min`;
statusEl.hidden = true;
resultEl.hidden = false;
}
function showError(message) {
resultEl.hidden = true;
statusEl.hidden = false;
statusEl.textContent = message;
}
async function init() {
const stored = await chrome.storage.local.get({ speed: DEFAULT_SPEED });
speedEl.value = String(stored.speed);
speedEl.addEventListener("change", async () => {
await chrome.storage.local.set({ speed: Number(speedEl.value) });
render();
});
try {
const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
const [injection] = await chrome.scripting.executeScript({
target: { tabId: tab.id },
func: countWordsOnPage,
});
wordCount = injection.result;
render();
} catch (error) {
console.error(error);
showError("This page can't be read. Try a normal web page instead.");
}
}
init();Two details are worth understanding. First, countWordsOnPage runs inside the web page, not in the popup. Chrome serializes the function and sends it over, so it can't use variables defined elsewhere in popup.js. If Claude writes an injected function that reaches for a popup variable, it will fail. Second, the try and catch block matters: Chrome refuses to inject scripts into its own pages and the Web Store, and without the catch the popup would sit on "Counting words" forever.
Step 6: Build the popup UI
Create popup.html and popup.css for Reading Time. The popup is 260 pixels wide. It shows a heading, a status line with id "status", a results block with id "result" (hidden until the count arrives) containing the word count (id "words") and reading time (id "minutes"), and a labelled dropdown with id "speed" offering 150, 230 and 300 words per minute. Link popup.css in the head and popup.js at the end of the body. No inline scripts or inline event handlers.<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Reading Time</title>
<link rel="stylesheet" href="popup.css" />
</head>
<body>
<main>
<h1>Reading Time</h1>
<p id="status" role="status">Counting words…</p>
<dl id="result" hidden>
<div>
<dt>Words</dt>
<dd id="words">0</dd>
</div>
<div>
<dt>Reading time</dt>
<dd id="minutes">0 min</dd>
</div>
</dl>
<label for="speed">Reading speed</label>
<select id="speed">
<option value="150">Slow (150 words per minute)</option>
<option value="230">Average (230 words per minute)</option>
<option value="300">Fast (300 words per minute)</option>
</select>
</main>
<script src="popup.js"></script>
</body>
</html>body {
margin: 0;
width: 260px;
font-family: system-ui, sans-serif;
color: #1f2328;
background: #ffffff;
}
main {
padding: 16px;
}
/* display: flex below would otherwise override the hidden attribute */
[hidden] {
display: none !important;
}
h1 {
margin: 0 0 12px;
font-size: 16px;
}
#status {
margin: 0 0 12px;
font-size: 13px;
color: #57606a;
}
dl {
display: flex;
gap: 12px;
margin: 0 0 16px;
}
dl div {
flex: 1;
padding: 10px;
border: 1px solid #d0d7de;
border-radius: 8px;
}
dt {
font-size: 12px;
color: #57606a;
}
dd {
margin: 4px 0 0;
font-size: 20px;
font-weight: 600;
}
label {
display: block;
margin-bottom: 4px;
font-size: 12px;
color: #57606a;
}
select {
width: 100%;
padding: 6px;
font-size: 13px;
}The ids in popup.html have to match the ones popup.js looks up. That sounds obvious, and it's the most common inconsistency when files are generated in separate prompts. If you change a name in one file, tell Claude to update the other.
The script tag sits at the end of the body and loads a separate file. Extension pages block inline JavaScript by default, so a script written directly inside the HTML, or an onclick attribute on a button, simply won't run.
Step 7: Load the extension into Google Chrome
- Open Google Chrome.
- Type chrome://extensions in the address bar and press Enter.
- Turn on Developer mode in the top right corner.
- Click Load unpacked.
- Select the reading-time folder, the one that contains manifest.json.
- Check that a Reading Time card appears with no red Errors button.
- Open any article, click the puzzle-piece icon in the toolbar, then click Reading Time. Pin it if you want it always visible.

You should see a popup like this, with numbers for the page you're on:

If Chrome says the manifest file is missing or unreadable, you selected the wrong folder, usually the parent. If it reports that it could not load an icon, the manifest names an icon file that doesn't exist.
Step 8: Test and iterate with Claude
Try it on a long article, a page with almost no text, and chrome://extensions itself. Change the reading speed, close the popup, open it again and confirm the setting stuck. When you edit popup files, reopening the popup picks up the change. When you edit manifest.json, click the reload arrow on the extension's card.
When we first ran this example, both result boxes showed a zero before the count arrived, even though the HTML marks the block as hidden. Nothing errored. The cause was in the CSS: setting display: flex on the list overrides the hidden attribute. The [hidden] rule near the top of popup.css is the fix. It's a small bug, and a useful reminder that generated code can be wrong without any error message. You only find that kind of problem by looking.
To see errors, right-click the extension's toolbar icon and choose Inspect popup. That opens DevTools for the popup, with a Console tab. When you ask Claude for a fix, limit its scope:
Reading Time has a bug. Here is what I did, what I expected and what happened instead:
[describe the steps]
Console output from Inspect popup:
[paste the exact error text]
Find the cause before changing anything and explain it in two or three sentences. Then make the smallest change that fixes it. Do not rewrite or reformat code that is unrelated to this bug, and do not add permissions.Step 9: Prepare the extension for publication
A folder that works on your machine isn't yet a product. Before other people install it, go through this list:
- Version: every upload to the store needs a higher version number than the last.
- Icons: real 16, 48 and 128 pixel icons, not placeholders.
- Error handling: every failure a user can hit shows a readable message.
- Permissions: remove anything left over from experiments.
- Performance: on very long pages, check the popup still responds quickly.
- Privacy: write down what data the extension reads, stores and sends. For Reading Time: it reads page text only when clicked, stores one number locally and sends nothing.
- Packaging: a ZIP file with manifest.json at the top level, without CLAUDE.md, notes or version-control folders.
The publishing section further down walks through the store side. Nobody can promise approval, and this checklist doesn't either. It removes the avoidable reasons for rejection.
The Best Claude Prompts for Chrome Extension Development
These prompts are written to be reused. Replace the parts in square brackets. Each one tells Claude what to deliver and what not to do, which matters as much as the request itself.
Prompt 1: Plan a Chrome extension
I want to build a Chrome extension. Here is the idea:
[describe what it does, who uses it and when]
Do not write code yet. Give me:
1. A one-paragraph feature specification in plain language.
2. The smallest set of files that delivers it, with one line on each file's job.
3. The Chrome APIs involved and the permission each one requires.
4. Whether it needs a popup, a content script, a service worker or an options page, and why. Leave out any part the feature does not need.
5. Edge cases and what should happen in each.
6. What user data is read, stored or sent, and where it goes.
7. An implementation order in small steps I can test one at a time.
Target Manifest V3 and the narrowest permissions that work. List anything you are unsure about as an open question.Prompt 2: Generate a complete Manifest V3 project
Build the extension from the plan we agreed. Requirements:
- Manifest V3 only, with no deprecated Manifest V2 keys or APIs.
- Plain HTML, CSS and JavaScript with no build step, unless I asked for a framework.
- Only the permissions listed in the plan. If you believe another is required, stop and ask.
- No inline scripts, no eval, no remotely loaded code.
- File names, element ids, function names and message types must match across every file.
Output every file in full with its path, never a fragment. Then give me: a table of permissions and reasons, a short explanation of how the parts communicate, and step-by-step instructions to load and test it in Chrome.Prompt 3: Review and improve existing extension code
Review this Chrome extension. All files are below [or: in this folder].
Report, in this order:
1. Bugs: anything that will fail or behave incorrectly, with the file and line.
2. Inconsistencies between files, such as ids, message names or paths that don't match.
3. Permissions that are requested but not used, or broader than needed.
4. Security concerns.
5. Duplicated or unnecessarily complex code.
For each finding, say how confident you are and how I can verify it. Do not change any code yet. I will choose what to fix.Prompt 4: Debug a Chrome extension
My extension isn't working as expected.
What I did: [steps]
What I expected: [result]
What happened: [result]
Exact error text and where I found it (popup console, service worker console, page console, or the Errors button on chrome://extensions): [paste]
If you need more information to be sure of the cause, ask me for it before proposing a fix. Otherwise, explain the most likely cause, then give the smallest change that fixes it and tell me how to confirm the fix. Leave working code alone.Prompt 5: Perform a security and permission audit
Audit this Chrome extension for security and privacy. Check:
- Every entry in permissions and host_permissions: is it used, and is there a narrower alternative?
- Every Chrome API call and whether its permission is declared.
- What user data is read, where it is stored and whether it leaves the browser.
- Every external request: destination, what is sent and why.
- Secrets: API keys, tokens or credentials anywhere in the files.
- Content security: inline scripts, eval, new Function, remotely hosted code, HTML built from untrusted page content.
- Anything likely to conflict with Chrome Web Store policies.
Present the results as a table with: finding, file, severity, and whether it is a confirmed problem or a possible risk. Do not present guesses as facts.Prompt 6: Optimize an extension for production
This extension works. Review it for production readiness without changing its behaviour:
- Performance: unnecessary work, repeated DOM queries, anything slow on large pages.
- Reliability: unhandled promise rejections, missing error handling, states the user can get stuck in.
- Service worker lifecycle, if there is one: state kept in global variables, listeners not registered at the top level.
- Maintainability: unclear names, dead code, missing comments where logic is not obvious.
- User experience: loading, empty and error states, keyboard access, readable text.
List proposed changes in priority order with the benefit of each. Wait for my approval before editing.Prompt 7: Prepare for Chrome Web Store submission
I want to submit this extension to the Chrome Web Store. Based on the actual code:
1. Write a single-purpose description in one or two sentences.
2. Write a justification for each permission in the manifest, in plain language a reviewer can check against the code.
3. State whether the extension uses remote code.
4. List the data it collects, stores or transmits, for the data-use disclosure.
5. Draft a store description: what it does, who it's for and how to use it. No exaggerated claims.
6. Give me a pre-submission checklist: version number, icons, screenshots, files to exclude from the ZIP, and anything in the code I should fix first.
Flag anything you can't determine from the code. Store requirements change, so tell me which points I should confirm in Google's current documentation.Common Problems When Building Chrome Extensions with Claude
Most failures fall into a handful of patterns. Find what you're seeing in the first column.
| What you see | Likely cause | How to check | Fix | Prompt for Claude |
|---|---|---|---|---|
| Chrome refuses to load the folder | Invalid JSON in the manifest, a wrong folder, or a file the manifest names doesn't exist | Read the error dialog on chrome://extensions. It names the problem | Correct the manifest, or select the folder that contains manifest.json | "Chrome shows this error when loading: [error]. Fix only the manifest." |
| Code uses browser_action, background.scripts or chrome.tabs.executeScript | Claude produced Manifest V2 code | Search the files for those names | Regenerate with Manifest V3 stated explicitly, and keep the rule in CLAUDE.md | "This uses Manifest V2 APIs. Convert it to Manifest V3 and list what changed." |
| An API call fails or is undefined | The permission for that API isn't in the manifest | Compare each chrome.* call with the permissions list | Add the single missing permission, then reload the extension | "List every Chrome API this code calls and the permission each needs. Which are missing?" |
| Works on one site, fails on another | Host permissions or match patterns don't cover the page, or the page is protected | Check the pattern against the page's address | Adjust the pattern, or use activeTab with a click | "The extension must work on [site]. What is the narrowest permission that allows it?" |
| Content script does nothing | Pattern doesn't match, the page wasn't refreshed, or the content loads after the script runs | Open the page's own console and look for your script's logs | Fix the pattern, reload the extension, then refresh the page | "My content script doesn't run on [address]. Here is the manifest and script. Why?" |
| Popup doesn't open or is blank | Wrong path in action.default_popup, or a script error on load | Right-click the icon and choose Inspect popup | Fix the path or the error shown in the console | "The popup is blank. Console says: [error]. Find the cause first." |
| Buttons do nothing | Inline script or onclick attribute, blocked by the extension content security policy | The popup console shows a content security policy message | Move the code to a .js file and attach listeners there | "Remove all inline scripts and inline handlers. Use addEventListener in popup.js." |
| Service worker shows as inactive, or data vanishes | Normal behaviour. Chrome stops idle workers, and global variables are lost | Click the service worker link on chrome://extensions to see its console | Store state in chrome.storage and register listeners at the top level | "Rewrite the service worker so it survives being stopped and restarted at any time." |
| Could not establish connection. Receiving end does not exist | A message was sent to a tab with no content script listening | Confirm the content script is loaded on that tab | Inject or reload the script before sending, and handle the error | "Show me which part sends each message and which part listens. Find the mismatch." |
| Error mentioning document or window is not defined | DOM code placed in the service worker | Check which file the error comes from | Move DOM work into a content script or injected function | "Service workers have no DOM. Move this logic to the right place." |
| Changes don't appear | The extension or page wasn't reloaded | Note what you changed: popup file, manifest or content script | Reopen the popup, click the reload arrow, or reload and refresh the page | "After this change, what exactly do I need to reload to see it?" |
| A fix broke something else | Claude rewrote more than it was asked to | Compare the file with the previous version | Restore the old file and ask again with a narrower scope | "Change only the function named [name]. Leave every other line as it is." |
Version control makes the last row painless. If your project is a Git repository, you can see exactly what changed and undo it. Our list of common vibe coding mistakes covers more of these habits, and the error handling guide shows how to make failures visible instead of silent.
Security Considerations: What Claude Might Get Wrong
Extensions run with more access than a web page, so mistakes cost more. These are the areas to check by hand, whatever Claude says about its own output.
Permissions that are broader than the feature
The most common problem is over-asking: access to all websites for a feature that works on one, or the tabs permission where activeTab would do. Broad access widens what a bug or a compromised update can reach. It also shows users a stronger warning at install, and Google's review process documentation notes that broad host permissions can lengthen review. Start from the least access that works and add only when a feature fails without it.
Remote code, eval and dependencies
Manifest V3 doesn't allow an extension to run code that isn't in its own package. Loading a script from a CDN, or evaluating a string as code, is exactly what Google's remotely hosted code rules prohibit. Fetching data from a server is fine. Fetching JavaScript and running it is not. Watch for libraries Claude adds casually: every dependency is code you ship and are responsible for, and some load further code themselves.
API keys and the Claude API
An extension can call the Claude API, and this is where generated code is most often unsafe. A key placed in popup.js, a config file or the manifest is not secret. Anyone who installs the extension can open its files and read it, then spend your credit.
For an extension other people will install, the usual design is a small backend you control. The extension sends the user's request to your server, your server adds the key and calls Anthropic, and the response comes back. That server is also where you handle the parts a key alone can't:
- Authentication: know which user is calling, so one person can't use everyone's allowance.
- Rate limiting: cap requests per user so a bug or abuse can't run up a bill.
- Data minimization: send only the text the feature needs, not the whole page by default.
- Consent: tell users before page content leaves their browser, and say where it goes.
The alternative for personal tools is to have each user paste their own key into an options page and store it with chrome.storage.local. That keeps your key out of the package. It isn't encrypted storage, so say so plainly and never ship a default key.
User data and privacy
If your extension reads page content, form fields or browsing activity, decide what it stores and for how long before you write the code. Keep data in the browser where you can. If it handles user data, the Chrome Web Store asks for a privacy policy and a data-use disclosure, and the disclosure has to match what the code does. Our Chrome Storage API guide explains where extension data lives.
How to Publish Your Claude-Built Chrome Extension
Google doesn't treat AI-written extensions differently. The same review and policies apply to everyone. The process, following the official publishing documentation:
- Register as a developer. Sign in to the Chrome Web Store Developer Dashboard, accept the agreement and pay the one-time registration fee. The dashboard shows the amount before you pay. The Chromium Blog put it at $5 when the current registration flow launched in 2020. The account email can't be changed later, so choose it deliberately.
- Create the ZIP. Compress the contents of the project so manifest.json sits at the top level of the archive. Leave out CLAUDE.md, notes and hidden folders.
- Upload it. In the dashboard, add a new item and choose the ZIP. If the manifest is valid, the item's pages open.
- Complete the store listing. Title, description, category, the 128 by 128 pixel icon and at least one screenshot at 1280 by 800 or 640 by 400 pixels. A small 440 by 280 promotional image is optional, though Google says listings without one are shown after those that have it.
- Fill in the Privacy tab. State the extension's single purpose, justify each permission, declare whether it uses remote code, certify your data use and link a privacy policy.
- Set distribution. Choose visibility and countries, and add test instructions if a reviewer needs an account to try it.
- Submit for review.
For Reading Time, the permission justifications are short because the permissions are narrow. activeTab: reads the text of the current page only when the user clicks the icon. scripting: runs the word-count function on that page. storage: saves the reading-speed setting on the device.
On timing, Google says most reviews complete within a few days, that some take up to a few weeks, and that broad host permissions and hard-to-read code add time. New publisher accounts are also limited to two published extensions at first. Treat every figure here as a snapshot and confirm it in the linked documentation when you submit. For store graphics, Canva has templates sized for screenshots and promotional images.
What Can You Build with Claude and Chrome Extensions?
Once the first one works, the same four-file pattern stretches a long way. A few directions, with the problem each solves and what it needs from Chrome:
| Type of extension | Problem it solves | What it needs |
|---|---|---|
| Reading and research tools | Saving highlights, summarizing or timing long pages | activeTab and scripting to read the page, storage to keep notes |
| Tab management | Too many open tabs and no way to group or restore them | The tabs and tabGroups APIs, storage for saved sessions |
| SEO utilities | Checking titles, headings and links without opening DevTools | An injected function that reads the page's HTML, a popup to show results |
| Developer utilities | Inspecting colors, fonts or JSON while building a site | Content scripts or a DevTools panel |
| Text tools | Reformatting, counting or cleaning selected text | The contextMenus API and scripting |
| Gmail and web-app helpers | Repetitive steps inside one specific site | A content script limited to that site's address |
| Lightweight AI tools | Explaining or rewriting text on the page | Everything above, plus a backend that holds the API key |
The narrower the job, the better these work. An extension that does one thing on one kind of page needs fewer permissions, is easier to test and is easier to explain in a store listing. For more specific starting points, see the Gmail extension ideas and SEO extension ideas guides. If you'd rather not touch code at all, compare the options in building a Chrome extension without coding.
From a Simple Chrome Extension to a Profitable Product
Getting an extension to run is the technical beginning. With Claude doing the typing, it's also becoming the easy part. The questions that decide whether anyone installs it are different ones:
- Is there real demand, or just an idea you like?
- Are people already searching for this?
- What exists already, and what do its users complain about?
- Would anyone pay, and through which model?
- Can one person maintain it when the target site changes?
- What would make yours meaningfully different?
Start with how to validate a Chrome extension idea before you invest weeks in one, and the profitable Chrome extension niches guide for where solo makers find room. When you're ready to charge, the monetization guide compares the models.
One shortcut is to begin with extensions that already had users. Chrome Goldmine is our researched database of 9,656 expired Chrome extensions, each with its former user count, why it disappeared and who competes now. You can browse sample ideas for free in the Chrome extension ideas directory. If that's the route you want, our guide to rebuilding expired Chrome extensions with Claude picks up where this tutorial ends, and the complete Chrome extension development guide covers the fundamentals in more depth. If the product needs accounts and billing around it, a starter kit such as TurboStarter saves you from building those yourself.
Whatever you build next, keep the habit from this tutorial: plan first, ask for the least access, and test what Claude gives you. For other tools that fit the same workflow, see our vibe coding tools for Chrome extensions overview.
Now pick an idea worth building
Building is the quick part. Chrome Goldmine shows 9,656 expired extensions with their former user counts, why they disappeared and who competes now.
$23.20 $29 · 20% off for the first 100 buyers · one-time payment


