English

Developer guide Design system

Design system workflow

How tokens, the component bundle, previews and Claude Design artifacts fit together.

On this page

The Archipelego design system lives in design-system/. It holds the tokens, the brand book, the component bundle, the glyphs and the logo. The app loads it from there and never copies it. For the full reference of every token and component, read DESIGN.md.

What is where

Path What it is
design-system/project/tokens.json The source of every token: colours per theme, type, spacing, canvas geometry, radii, strokes, shadows, durations, easings.
design-system/project/README.md The brand book: voice, colour, type, motion, sound, layout and accessibility rules.
design-system/project/components/bundle.js The component bundle. A classic script that registers everything on window.Archipelego.
design-system/project/components/bundle.css The component styles, with the ap- class prefix.
design-system/project/components/index.d.ts TypeScript types for the bundle.
design-system/project/components/<Name>/ One folder per component, with README.md and preview.html.
design-system/project/assets/ The glyph SVGs and the logo files.
design-system/project/design-system.json The manifest of the published Claude Design System artifact.
design-system/dev/ Local tooling: the token compiler, the compiled tokens.css, a showcase page and its server.
design-system/gen-previews.js Generates the component previews, the component READMEs and the glyph files.
design-prototype/project/*.dc.html The clickable Claude Design prototype artboards.

Tokens

tokens.json is the only place where a token value is defined. Compile it into CSS custom properties:

bash
npm run tokens

This runs node design-system/dev/build-tokens.js and writes design-system/dev/tokens.css.

  • Colour and shadow tokens are written per theme: light under :root and [data-theme="light"], dark under [data-theme="dark"].
  • Every other token is written once under :root, for example --space-4 or --duration-base.
  • Font families become --font-display, --font-sans and --font-mono.
  • Each type style becomes a class, for example .body or .mono.

npm run dev and npm run build run npm run tokens first, so the file is always fresh.

The bundle in the app

The app imports the design system through the @ds alias, defined in app/vite.config.ts. app/src/ds/index.ts is the single entry point:

ts
import './react-global';
import '@ds/project/components/bundle.js';
import '@ds/dev/tokens.css';
import '@ds/project/components/bundle.css';

The order matters. react-global sets window.React first, because the bundle reads window.React when it runs. The app and the bundle then share one React. index.ts re-exports the components and constants from window.Archipelego, with their types from index.d.ts.

The theme is a data-theme attribute on the html element. The app sets it to light or dark.

Previews and the showcase

Regenerate the component previews, the component READMEs and the glyph files:

bash
node design-system/gen-previews.js

Serve the showcase locally:

bash
node design-system/dev/serve.js

It serves the design-system/ folder on port 4173, with dev/index.html as the home page. Set PORT to use another port.

Claude Design artifacts

The design system is published as a Claude Design System artifact, described by design-system/project/design-system.json. Each component's preview.html starts with a @dsCard marker that places it in the published system. The prototype artboards in design-prototype/project/ are the clickable Claude Design prototype: the main canvas, the chat, AI keys, the library, the 3D explorer, features, docking and the phone layout.

Changes to the design system go through the design system owners. Change the source in design-system/, regenerate, and republish the artifact. The app picks the change up because it never copies the files.

Adding a block kind

A new kind touches several places. Keep them in step:

  1. Draw a glyph that reads at 16px, on the 24px grid with 1.75px strokes, round caps and joins. Add it to GLYPHS in the bundle.
  2. Add the kind to KINDS in the bundle, with a title-case name and a layer (1 to 4, or security). Set container: true only for kinds that hold other blocks.
  3. Add the kind to the Kind type in index.d.ts.
  4. Add it to the list of kinds in the brand book, design-system/project/README.md.
  5. Run node design-system/gen-previews.js to write the glyph file.
  6. Add it to KINDS in server/src/explain.ts, so Explain and the Architect accept it.
  7. Add it to KNOWN in scripts/build-library.mjs, so library builds keep it.
  8. Add it to a group in GROUPS in app/src/panels/Toolbox.tsx, so people can place it.