promptdojo_

The design kit — brand bible and design tokens as structured data — step 9 of 10

The token audit — the interface twin of the kit validator. Two token files are on deck: the approved set, and a draft a contractor sent over at 11pm. Write audit_tokens(tokens) returning a list of fault strings, checks in this order:

  1. Grid — for each value in tokens["space"] that isn't a multiple of BASE, in list order: "off-grid spacing: {v}"
  2. Scale — for each adjacent pair a -> b in tokens["type"] where b / a is less than MIN_RATIO: "flat type step: {a} -> {b} (ratio {b/a:.2f})"
  3. Text floor — if text on background is under 4.5:1: "text contrast {c:.2f}:1 below 4.5:1"
  4. Component floor — if accent on background is under 3.0:1 (WCAG's non-text rule — the button floor): "accent contrast {c:.2f}:1 below 3.0:1"

contrast() is the one you wrote two drills ago, provided. The harness prints SHIP for a clean set, REJECT plus the fault list otherwise. Expected output:

halfmoon-app-v1: SHIP
halfmoon-app-v2-draft: REJECT
  - off-grid spacing: 18
  - flat type step: 16 -> 18 (ratio 1.12)
  - text contrast 2.68:1 below 4.5:1
  - accent contrast 1.78:1 below 3.0:1

The draft fails all four ways — sage text nobody can read, goldenrod buttons nobody can find, a typo'd margin, and a type step that isn't a step. Better a script says so tonight than a client tomorrow.

full-screen editor opens — close anytime to keep reading.