Skip to content

AI generation ​

code.extension.dev is the workbench where you describe an extension and get a working one back: a coding agent in the left column, an emulated browser in the right, and a compiler between them that never leaves the page. This section covers every part of it, from the terminal and chat mode to checkpoints, drafts, share links and publish. Reach for the workbench when you want a prototype running before a repository exists.

Quick start ​

text
Build an extension with a toolbar popup that shows a counter I can increment and reset, and remembers the count.

Type that into the terminal. The agent seeds a template, writes the files, a compiler builds them inside the page, and the popup opens in the preview next to the terminal. No server compiles your project and nothing installs in your browser.

How it works ​

Five ways in ​

You arrive withAddressWhat it does
A descriptioncode.extension.devThe prompt box starts the workspace, at /new/chromium
A starter card/?prompt=<text>&source=starterRoutes the sentence to a template and seeds it
A template/?template=<slug>Seeds the workspace from that template
A shared artifact/?artifact=gen_<id>Opens a published artifact's files as your own project
A saved draft/drafts/<id>Reopens a draft you saved before

?prompt=<text> alone only fills the prompt box. It never chooses the seed and never sends itself, so one link can carry a template and a first sentence together. When a link carries more than one entry, the draft wins, then the artifact, then the template. Links of the older shape /s/<id> still open and redirect to /drafts/<id>. See Starters and templates.

Every page in the template catalog carries an Open in code.extension.dev button, which is the ?template= entry. The theme builder hands a theme over as an artifact, which is the ?artifact= entry.

What a prompt returns ​

The first prompt on an empty workspace is routed to a starting template, so the agent edits a working extension instead of inventing one. In the terminal the agent then writes files with its own shell and runs build. In chat mode the answer is one structured object:

PartWhat it is
Operationswrite, delete and rename against the files you already have
PreviewWhich entry the preview opens, and notes about it
User stepsWhat you have to do by hand, such as granting a permission
AssumptionsWhat the assistant decided when the prompt did not say
ReasoningThe summary, the steps, and the tradeoffs it took

Only changed files come back. A correction edits what is there, so the parts that were already right stay. See Chat mode.

The workbench ​

TabWhat is on it
AIThe terminal on the left, the running extension on the right
CodeEvery file in the project, in an editor
SettingsThe model, the terminal controls, the allowance, and the browser profile
AccountYour session

Each applied edit saves a checkpoint, compiles, and reloads only what changed in the preview. The compile runs in a web worker with esbuild built to WebAssembly, so the edit to preview loop never leaves your machine. The preview is the same emulator that shared build links open. See Live preview, Build console and The Code tab.

The header control that shows your extension's name lists every checkpoint under the prompt that made it, with Restore last known good for the newest checkpoint whose build passed. See Checkpoints.

The terminal ​

The left column is a terminal running a coding agent. You type what you want; the agent reads the project, writes files, runs build, and reads the preview back with the preview-* commands. The terminal needs WebAssembly JSPI, which Chrome and Edge 137 and Firefox 153 or newer ship and Safari does not yet. A browser without it opens chat mode and says so. Chat mode is also one switch away under Settings.

The agent has a fixed toolchain of 23 commands, and 17 of them are yours to type with no model call: build, changes, checkpoint, template, usage and the twelve preview-* commands. publish, share, download and run-in-chrome are the agent's: typed bare they print a notice pointing at the header control, and asked for, the agent runs them. loop-trace and preview-verify go to the agent as prompts. See Terminal.

What the terminal does not have, on purpose:

  • No npm, node, web-ext, or any package manager. build is the whole toolchain, and the compiler handles TypeScript, React, and CSS on its own.
  • No web access. The agent never fetches a page or an API. Everything it reads is in the project or the preview.
  • No images, paste, or clipboard. share prints its link. Nothing is copied for you.
  • No undo inside the agent. Every applied edit records a checkpoint, so rolling back is the checkpoint list in the header.

Every model call spends one unit of your generation allowance, and Settings shows the number before a refusal does. The conversation is saved with the draft. Open the same draft on another browser and the terminal resumes where it stopped. /new starts a fresh one.

Where the work lives ​

Drafts sync to your account. code.extension.dev/drafts lists the cloud drafts first, the recently deleted ones, and the draft open in this browser.

The browser also keeps the open draft in the tab that made it. Each tab holds its own browser database, and a database whose tab is gone is deleted on a later sweep. Closing the tab is not a save. The draft on your account is. See Drafts.

Sign in and the allowance ​

Everything on code.extension.dev runs on your account. Signed out, the workbench is a sign-in door titled Sign in to Extension.dev, with GitHub, and you come back to the same address. See Settings and sign-in.

Free includes an allowance of generation units with a daily ceiling and a monthly one. Every model call spends one unit, and Settings and usage show what is left of both before a refusal does. The daily ceiling resets at the next UTC midnight and the monthly one on the first of the next UTC month. When either is spent, only generation locks. What you already built stays on screen, so you can still preview it, edit it, and download it. The refusal card says when the ceiling resets, links to the pricing page, and its main button is Notify me. See Generation allowance.

Taking the extension out ​

ControlWhat you get
DownloadA dialog with two rows. Source (.zip) is <name>-source.zip, every file as written. Built extension (.zip) is <name>-chrome.zip, the compiled build plus a README with the load unpacked steps
Run in a real browserThe npx -y extension@latest preview command that runs the built extension on your machine
ShareA preview link to the latest build, copied to your clipboard
PublishThe prototype on your account, with three handoffs below

The two zips are not the same thing. Chrome compiles nothing, so a project written in TypeScript or React loads from the built zip and not from the source zip. See Download and run locally.

Publish answers with three handoffs:

  • An import link. It opens www.extension.dev/import?source=generation&artifactId=<id>, which turns the prototype into a GitHub repository connected as a project. See Publish and import and Import.

  • A live preview. The same shared preview a share link opens, so a reviewer installs nothing and signs in to nothing.

  • A command for your terminal.

    bash
    npx -y extension@latest preview <zipUrl>

    That runs the built extension in a fresh browser profile on your machine with Extension.js, the open source framework Extension.dev sponsors. It needs no account, and it is documented at extension.js.org.

A real Gecko can also run the build beside the emulator. Switch to Firefox in the preview's actions bar adds a /firefox suffix to the address, on desktop browsers with JSPI and for logins the engine admits. See Firefox engine.

Reference ​

LimitValue
Generation units, Free50 a day, 300 a month
Generation units, Pro200 a day, 2000 a month
Drafts per account100
Size of one draft4 MB
Repairs chat mode attempts on a build error4
Published source artifact kept90 days
Shared preview link30 days on Free, 365 days on Pro

The allowance numbers are the plan defaults. The deployment can set other ceilings.

CommandWhat it does
buildCompiles the workspace now and prints the diagnostics
preview-errorsReads runtime errors and surface status from the live preview
preview-describe [--host]Prints the preview state and an accessibility snapshot of the open surface, or of the served page
preview-open <surface>Opens a declared surface: popup, options, side-panel, devtools, newtab, history, or bookmarks
preview-click [--host] <selector>Clicks inside the open surface, or in the served page
preview-type [--host] <selector> <text>Types inside the open surface, or into the served page
preview-text [--host] [selector]Reads text from inside the open surface, or from the served page
preview-networkLists the chrome.* API calls the extension has made
preview-logs [--realm background] [--tail N]Reads the service worker's console and the surfaces' console, in time order
preview-storage [local|sync|session] [key]Reads chrome.storage as the extension sees it
preview-navigate <fixture|list>Moves the served page to one of six fixture pages a content script can be proven on
checkpoint <message>Records a restore point under that message
changesPrints the diff of what you edited in the Code tab since the agent's last turn
usagePrints how much of your generation allowance is left
publishThe agent puts the extension on your account and prints the import link
shareThe agent mints a preview link from the last build
download [dist|source]The agent saves a zip into .out/ and hands it to the browser

When it fails ​

  • A template link seeds nothing. The slug is not in the seedable set. The workspace opens on the prompt box with a sentence naming what went wrong. Choose the template again from templates.extension.dev.
  • The workspace asks you to sign in. Your session ended. Sign in and send the prompt again. The draft is still in this browser.
  • Generation is locked. The daily or monthly allowance is spent. Everything you built stays: preview, editing, and download still work, and the refusal links to the pricing page.
  • The preview loads and nothing visible happens. Read the user steps and the assumptions the answer returned. Many extensions need a step the page cannot take for you, such as a permission grant or a page to open.
  • The build breaks after a change. The console under the preview lists the problems it read, and Fix in terminal hands them to the agent. If the fix does not land, restore the last known good checkpoint from the header.
  • The generated code is close but wrong. Correct it in the same conversation. Edits land in place, so you do not lose the parts that worked.
  • An import link returns nothing. A published source artifact is kept 90 days. Publish again from the workspace.
  • A share link stopped opening. A shared preview lives 30 days on Free and 365 days on Pro. Share the same build again to mint a new link.
  • Work disappeared when you reopened the browser. The copy in this browser belongs to one tab and is swept once that tab is gone. Open the draft from code.extension.dev/drafts, where your account keeps it, or download the source before you close the tab.

Next ​