DESIGN.md — the forge's design system

The principles, in short. (The numbered list in §1 is the long form.)

  1. One confident sentence says what the page is for; nothing explains itself twice.
  2. The real product is the visual: show the actual rows, not a picture of them.
  3. Generous rhythm: space between things, not lines.
  4. One background, one text colour (--bg, --fg), muted for the rest.
  5. At most one accent, --accent, for interaction alone. Enforced: accent in scripts/design-lint.ts.
  6. Few borders: a hairline where a thing ends, never a box around a thing.
  7. Rows over boxes: a list is rows, a fact is a dl row, not a card.
  8. Plain words, as in docs/WRITING.md.

Reviewers' repeats are checks (#15416). Enforced in scripts/design-lint.ts under the quiet rules, held per file in docs/design/quiet-debt.json: bare-list (a hand-rolled <ul>/<ol>: principle 7, use row) and row-primary (a primary button made inside a .map(): principle 5, one accent per page).

Overlays are drawn only when open (#11831). One rule keyed on the open state (.dialog[open], .toast:not([hidden])) gives every overlay its layout; a component adds only what is its own, never a bare display on its selector, which beats the browser's dialog:not([open]) { display: none }. Enforced: overlay in scripts/design-lint.ts names the selector, judging its last compound, for the known overlay names and every class a <dialog> or [popover] carries.

The first five minutes. Later work is judged against this one journey, a stranger's from a link to a change live:

  1. They follow a link. 2. They name the forge. 3. They pick a username and create a passkey. 4. They say what to build. 5. They see the crew working.

Budgets (FIRST_FIVE_MINUTES): at most three screens before the forge; the forge ready in under 20 s; the first crew activity in under 60 s; the change live within five minutes.

Words a stranger is never shown on this path: subscription, autonomy, cell, child, claim, founder, autonomous, mode. The list lives once, as STRANGER_NEVER_SEES in src/design/first_five_minutes.ts (with the budgets), for a test to import. bun scripts/design-lint.ts reads the visible text (not attributes, routes, code or styles) of claim.ts, start-forge.ts, new-forge.ts and forge_made.ts and names each of these words with its file and line.

The five rules of attention. Every pass over a page follows them; the owner's time is the cost. Each has a real page as its pair. Enforced by rule 5: test/attention.test.ts.

  1. One answer. A page answers its one question at first sight. State is a word and a glyph, not a sentence.
    • Do: securityPage gives each fact a toned badge (Recent, Overdue), not a paragraph.
    • Don't: previewSection (src/web/pages/apps.ts) says "The last deploy of this preview failed. Push again to redeploy it." where Failed with the tone says it.
  2. No notes. Explanatory prose that does not change a decision goes. Help lives in one place, on demand.
    • Do: the home composer is the sentence of purpose and the control itself (studioHome).
    • Don't: a <p class="muted small"> under a list that explains what the list is; the heading already did.
  3. Real depth only. Details, history, logs and evidence open in place, in their own compartment. The essential is never one tap away, and nothing is a tap with nothing behind it.
    • Do: the disclosure in src/web/ui.ts (used in src/web/pages/new-forge.ts) holds the optional extras; the choice stays on the page.
    • Don't: a disclosure that opens onto one line, or one that hides the verdict.
  4. Compartments. Each concern sits in one region with one heading, in the same order on every page. Regions never repeat each other.
    • Do: /settings, where each concern is one settings-block with one heading.
    • Don't: the same fact in the header, the tab count and a status line, as the Pulls tab and its list once did (#10312).
  5. Measured. Every page has a first-view budget at a narrow (390 px) and a wide (1280 px) width: visible words, text blocks and distinct colours, in docs/design/attention-budget.json. A page over its budget fails test/attention.test.ts. A pass may lower a budget; raising one needs a note in the pull. See docs/features/attention.md.

Worked examples.

One vocabulary, two surfaces. The web renders it as HTML and CSS; a terminal UI renders the same names as cells and boxes. If a component is not in these files, it does not exist — and if you find yourself hand-rolling markup a page already has a name for, that is the bug.

Read this once. It is short on purpose.

Each section is its own file under docs/design/sections/, so a change to one never conflicts with a change to another. The list below is built from them when read (#14354), never typed: a section opens with front matter, order: (a number; sections run lowest first, so leave gaps) and nest: (how deep it sits in the list), and its title is its first heading. The design check (bun scripts/design-lint.ts) reads them in that order. A new component class is named in docs/design/areas/<area>.md, not here.

---

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs