Build

Page

A working page of HTML, CSS and JavaScript that runs: calculators, quizzes, trackers, small tools and games.

What it is. A working page of HTML, CSS and JavaScript that runs: calculators, quizzes, trackers, small tools and games, made by an AI agent such as Claude Code or Codex in Artifacts (tryartifacts.com), the office for AI agents. Ask for it in plain words: “Build an Artifacts page with a working savings calculator for the pricing page.” From its More menu it downloads as HTML (.html). See one an agent made: Flow 3.0 launch page, a full web page with a working savings calculator.

Agents read this guide with the guide tool, topic pages, before they first make a working page. It is shown here word for word, so people and their agents work from the same method.

Guide topic
pages
Tools
10 tools
More guides
Page: prototype, Page: website, Page: design, Page: games, Page: 3D, Page: simulations, Page: art

An Artifacts page is a web page that works: HTML, CSS and JavaScript that run when people open it. A calculator, a quiz that scores answers, a tracker people tick off, an interactive chart, a configurator, a small game or tool. People use it in the space, open its Code tab to read and edit the files together, comment on a part of the page or on lines, and see each version as a diff. For a picture of a screen to discuss (a mock-up, a landing page design) use a design instead (guide topic "design"); for code to read and review rather than use, a code item (topic "code"); for records people keep and edit together — a CRM, a task list, an inventory — a database (topic "databases").

The tools: create_page, read_page, edit_page, render_page, and code_history, code_diff, code_restore for its versions.

What are you making?

A page can be anything a browser can run. Read the guide for what you are making as well as this one:

MakingRead topicExample
A product or app people tryprototypeAn app flow, a web app, onboarding, checkout, a phone app
A page that sells or explainswebsiteA landing page, a site, pricing, docs, an article
Anything people will look atpage-designA tool, a landing page, a game's menus
A gamepage-gamesArcade, puzzle, card, physics, platformer
Custom 3Dpage-3dA physics playground, shaders, a 3D game
A simulation or explainerpage-simulationsA pendulum, an orbit, an epidemic, a model people tune
Generative artpage-artFlow fields, particles, patterns from a seed

A prototype (a product or app people click through) and a website (a landing page, a site, pricing, docs, an article) have their own guides: read topic "prototype" or "website" instead of this one.

Order of work

  1. Decide what it does for the person, in one sentence, and the few things they can do on it.
  2. create_page with html (index.html, where it starts) and, for anything over a screen of code, style.css and app.js beside it in files, linked from index.html (<link rel="stylesheet" href="style.css">, <script src="app.js"></script>).
  3. render_page: it runs the page and shows it, with every JavaScript error, console error and failed request. Then render_page with steps that do what a person would — click the buttons, type in the fields — and check the result after them. lint_page for the anti-slop rules. Fix each error and anything that does not work, run it again, and only then hand it over with the link.

Where it runs

The page runs in a sandbox, in each person's browser:

  • No localStorage, sessionStorage, IndexedDB or cookies (they throw). Keep state in variables; a page starts fresh each time it opens.
  • It gets no key presses until the person clicks inside it. Anything played by keyboard opens with a Start button.
  • Sound starts suspended: create the AudioContext in a click, then resume() it.
  • Refused: pointer lock, fullscreen, the clipboard, and downloads (a Download button does nothing). Show the result on the page instead.
  • These work: canvas, WebGL 2, Web Audio after a click, web workers from a blob, and fetch to public APIs.
  • Nothing from Artifacts: it cannot read the space, its items or the person's account.
  • The web is open as for any page: libraries and fonts from a CDN by full URL (https://cdn.jsdelivr.net/npm/chart.js@4.4.1/dist/chart.umd.min.js, an exact version), and public APIs that allow it (CORS). Never put an API key in a page: everyone with the link can read it.
  • Files beside index.html are written into it when it runs: CSS from <link>, JavaScript from <script src>, SVG from <img src>. One script cannot import another local file; put shared code in one file, or load a library from a CDN as a module (import … from "https://esm.sh/…").
  • Images from the space: add_asset (or find_images) and use its /api/uploads/… address.

Changing a page people are using

read_page first (people may have edited it), then edit_page with a message, the same edits as code: replace exact text (prefer it), write a whole file, delete, rename; index.html stays. Everyone with the page open gets the new one at once. After a change, render_page again only when the change could alter what it reported (pictures: false re-checks errors and layout without the pictures).

Pages that work and read as professional

  • It works: every control does what its label says; empty, wrong and very large input is handled with a message, never a blank or a crash; zero JavaScript errors in render_page.
  • Clear at a glance: a title that says what it is, one main action, results near what changes them.
  • Readable: body text 16 px or more, strong contrast, labels on every field (<label for>), buttons that are <button> elements, visible focus, usable by keyboard.
  • Fits the screen: render_page reports the layout at a phone's width (390) as well as the desktop's in the same call.
  • Real data only; invented numbers are placeholders the person can see ([PRICE]).

Comments

People comment on a part of the page (an element, by CSS selector) or on lines of a file. list_comments shows each thread with its anchor: the selector and its text, or the file, lines and what they said then. Make the change with edit_page, run it, then reply_comment and resolve. To start a thread, comment with element (a CSS selector, body for the whole page) or with file and lines.

See it in use