Case study
I turned the design-token spec into a playable coding arcade.
The short version: I was better at Galaga than at design tokens. So I fixed that the hard way.
You don’t read about aliases. You write one in a real editor, run it in a sandbox, and watch the wave clear. Twenty sectors of the W3C Design Tokens Format, graded against the stable 2025.10 spec.
Live site / The arcade
Insert coin. The arcade is the skin; the engine underneath is real.
Pick a sector from the star chart, write your tokens, run them in the sandbox, and clear the wave when every assertion passes. Load the live game below and press start right here.
Receipts
- Skills proven
-
- Interactive learning & curriculum design
- In-browser code execution & sandboxing
- Test-harness engineering
- Deep W3C design-token expertise
- Accessibility engineering
- Motion design
- Stack
-
- Astro 5
- React island
- CodeMirror
- Sandboxed iframe
- axe-core
- Netlify
- Quality
-
- Faithful to the stable 2025.10 spec
- Spec-semantic grading, not pattern-matching
- Reduced-motion honored on every effect
- astro check + a clean build, every ship
- Outcomes
-
- 20 sectors across three arcs
- A serializable assertion engine
- Companion to Rudiment UI
On the docket
- 01 Why teach a spec as an arcade
- 02 What it actually is
- 03 The assertion engine
- 04 Twenty sectors, three arcs
- 05 Accessibility, taught and practiced
- 06 Game feel without a game engine
Here is the honest origin story. I was on the couch playing Galaga Wars on my phone, watching a little ship rank up wave after wave, and it hit me that I should be leveling up on the W3C Design Tokens Format instead. It had just gone stable at 2025.10, I’d been meaning to actually internalize it rather than skim it, and the spec is genuinely useful and a genuinely dry read. So I did what any reasonable person would do. I built a game around it. Duh.
That is the product-design-engineering instinct in miniature: I don’t separate the design idea from the thing that has to run. So instead of writing another explainer, I built the thing I’d actually want to play. A coding arcade where every wave you clear is one more piece of the spec you can prove you understand, because your code had to satisfy a real grader to pass. Nobody asked for it, which meant nobody was around to talk me out of finishing it.
Step 01
Why teach a spec as an arcade
Design tokens are table stakes for any serious design system, but the W3C format is hard
to internalize from the source material. The spec is precise by necessity:
$value,
$type,
group inheritance, aliases, composite types. Precision makes for an excellent reference and
a poor teacher. You finish reading and you have a vocabulary, not judgment.
A game changes the unit of learning from “I read about aliases” to “I used an alias to clear the wave.” Every rule becomes a sector you cannot pass until your code actually applies it. Uncleared sectors create stakes, a fixed sequence creates a path, and pass-or-fail diagnostics create feedback. You leave with the muscle memory of having written spec-correct tokens.
Read the reference
You learn the vocabulary
Spec pages that are accurate, complete, and hard to retain. You skim them once and bookmark them.
Play the reference
You build the judgment
Each rule is a clearable sector that requires you to apply it. You don’t move on until your code has actually used the concept.
Step 02
What it actually is
Token Adventure looks like a deep-space arcade cabinet. You select sectors from a star chart, clear waves, log intel to a pilot log, and rank up from Recruit to Ace. Under that presentation, every sector is a small coding exercise running on real infrastructure. Nothing is faked: the preview is your code running, and a pass means your tokens actually satisfy the spec, not that you picked the right multiple-choice answer.
- 01
An NPC frames the problem
A story panel states the real failure the concept prevents: a brand color hardcoded in five places, a dangling alias that locks a team out of a build.
- 02
You write real code
A CodeMirror editor with the right language modes (JSON for tokens.json, plus CSS, HTML, and JS where the sector calls for it). Only the tabs a sector needs are shown.
- 03
It runs in a sandbox
The host builds an srcdoc document from your editor and loads it with sandbox="allow-scripts" and no same-origin access, so player code is genuinely isolated.
- 04
A test runner grades it
Assertions are posted into the iframe over postMessage, evaluated against the live DOM and your parsed token tree, then posted back. Pass them all and the wave clears.
- 05
You are rewarded
XP, a badge, and a pilot-log entry that distills the lesson into a reusable snippet. Clear a full arc and a celebration interstitial fires.
Architecture at a glance
- Astro 5 renders the static surfaces (star chart, story panels, one route per sector). No client JS ships for these.
- One React island carries the sector runner: editor, sandbox, and test list. It loads only on quest pages.
- The sandbox is an iframe srcdoc with sandbox="allow-scripts". Player code cannot reach the host page.
- The test runtime speaks to the host over postMessage, with a request-id handshake and a timeout so a broken script cannot hang the grader.
- axe-core is pulled into the sandbox to run real accessibility audits against the player’s rendered output.
- Progress lives in localStorage. No backend, no account, no server.
Step 03
The assertion engine
This is the heart of the project. Grading a coding exercise means inspecting code that runs
in an isolated context you deliberately cannot touch from the outside. The solution is a
fully serializable assertion DSL: every
check is a plain data object, so it crosses the
postMessage
boundary into the sandbox, runs there against the live DOM and parsed token tree, and
returns a plain result.
Family one
DOM & accessibility checks
-
selectorExists · tagName · notTagNameStructure and semantics
-
computedStyleResolved CSS values: exact, regex, or one-of a set
-
contrastWCAG contrast ratios (AA normal, AA large, AAA)
-
axeRuns axe-core, optionally scoped to specific rule ids
-
keyboardReachableTab-order reachability
-
hasAttribute · textMatchesARIA and content
Family two
Design-token checks
-
tokenJsonValidConfirms it parses at all
-
tokenHasPath · tokenFieldEqualsStructure and field values
-
tokenTypeMatchesHonors $type inheritance from ancestor groups
-
tokenAliasResolvesFollows {alias} reference chains to a final value
-
cssVarFromTokenReads a CSS custom property to confirm a token wired through
That second family is what makes the game spec-accurate rather than spec-flavored.
tokenAliasResolves
doesn’t look for the string
{color.brand.primary}
in your file. It walks the reference chain the way a real translation tool would and
asserts on the resolved value. The grader understands the spec’s semantics, so the
lessons cannot be gamed by pattern-matching.
The final sector is the boss: a broken tokens.json carrying four realistic 2025.10 violations. Find and fix all four. It is the closest the game gets to the actual job.
Step 04
Twenty sectors, three arcs
The sequence mirrors how the spec has to be learned: foundations first, then the relational and composite machinery, then the real-world build, theming, migration, and audit work. You can’t reason about aliases until you can name a single token, and you can’t audit a broken library until you understand the types it’s supposed to honor.
The foundations: why tokens exist, the file, naming, color, groups, consuming.
- 01 The Hardcoded Hellscape Why tokens exist: a named decision gets one home
- 02 The Registry Awakens tokens.json, $value and $type
- 03 The Cartographer's Codex Naming and path rules
- 04 Color the 2025 Way Object-form color: colorSpace, components, alpha, hex
- 05 Forge a Group Groups and $type inheritance
- 06 Self-Documenting Tokens $description
- 07 Reading the Registry Consuming semantic tokens
Relationships and composites: aliases, layering, types, and the composite shapes.
- 08 Echoes and Aliases Alias references
- 09 Three-Tier Architecture Global, semantic, and component layers
- 10 Types of the Realm Token types and their canonical value shapes
- 11 Composite Constructs The typography composite
- 12 Border Composite The border composite
- 13 Shadow Composite Shadow, including multi-shadow arrays
- 14 Gradient and Transition The gradient and transition composites
Production, theming, and audit: the pipeline, integrity, color spaces, migration, the boss.
- 15 The Translation Pipeline tokens.json to CSS custom properties
- 16 Alias Integrity Detecting dangling and circular references
- 17 Color Spaces Color spaces and wide-gamut output
- 18 Theming and Modes Modes as a tooling convention, flagged as not in the spec
- 19 The Great Reformation Migrating a legacy file to 2025.10
- 20 Audit the Library The final audit boss
A spec read front to back gives you a reference. Clearing it sector by sector gives you the judgment to use it.
Step 05
Accessibility, taught and practiced
Most learn-to-code games stop at the happy path. Token Adventure treats accessibility as a
first-class concern in both directions. It is built
into the product: every motion effect collapses to a static state under
prefers-reduced-motion,
and the celebration interstitial is a real dialog with focus management, Escape and backdrop
dismissal, and a scroll lock.
And it is taught by the product. Several
sectors grade the player’s rendered output with
axe,
contrast, and
keyboardReachable
assertions, holding the player to the same WCAG AA ratios and axe-core rules the app holds
itself to. You learn to ship tokens that produce accessible interfaces.
Built-in, not bolted-on
- Every motion effect gated behind prefers-reduced-motion
- Celebration modal: role="dialog", aria-modal, focus management
- Escape and backdrop dismissal, background scroll lock
- Parallax disables itself on coarse and touch pointers
- Sectors grade output with the same contrast math the app holds itself to
- Sectors run axe and keyboardReachable against the player’s UI
Step 06
Game feel without a game engine
The arcade is built entirely from CSS and the Web Animations API, with no game loop and no canvas. The constraint was deliberate: keep the bundle small and the Core Web Vitals clean while still earning the word arcade. Difficulty is color-coded throughout, cyan for beginner, yellow for intermediate, magenta for expert, and the color encodes the arc rather than decorating it.
A CRT boot sequence
A one-shot scanline sweep across the cabinet plus a marquee-title power-on flicker, built in CSS and the Web Animations API.
Dual-layer neon glow
A tight tube core plus a soft bloom, over a corner-vignetted field, so lit elements read like real neon rather than a flat drop shadow.
A world map you fly
A scout ship follows the mission route via CSS offset-path while a nebula drifts opposite the cursor through a transform-only, rAF-throttled handler.
The app also eats its own cooking. A game about design tokens is itself built on a real three-tier token system with light, dark, and high-contrast modes, so it practices the architecture sector 9 teaches. A tool that taught token discipline while ignoring it would not be credible.
Because the refresh was motion-heavy, I built a precision feedback loop instead of eyeballing
changes: a headless-Chrome screenshot harness captures every key screen at desktop and mobile
for before-and-after diffing, and a
?nomotion
escape hatch freezes the reveal animations so full-page captures show the settled layout. I
also held the source to zero em-dashes and en-dashes anywhere, verified by grep, and shipped
only after astro check
and a clean build pass.
A complete product
Twenty sectors, three arcs, a full reward loop, and a finale. Finished end to end, not a demo.
A real test engine
A serializable assertion DSL that grades player code across a sandbox boundary, with both a11y and deep token-semantic checks.
Part of a set
Token Adventure teaches the spec; Rudiment UI teaches building the library those tokens drive.
Product design engineering
I make hard things worth finishing.
Token Adventure takes the formal text of a W3C spec, the material almost nobody wants to read, and turns it into something people play to the end. The same instinct carries into product work on a team: take the dry but necessary work, give it an interface worth using, hold it to a real accessibility bar, and ship it polished. Let’s talk.