Design systems · AI · 2026
A design system WBK’s AI tools can build from
WBK’s DS3 already lives in Figma variables. This work made it something an AI can follow too: a contract for every component, checks that score every screen in English and Arabic, and one way in for new parts.
- Role
- Product designer, framework and build
- For
- AI tools that build WBK screens, and the people who review them
- What it adds to DS3
Used across projects on Webook’s DS3. The tokens, names and components are DS3’s; the contracts, rules, checks and triage are what I added on top.
DS3
1 / 5DS3 tokens, components and templates
01
More people build WBK screens now.
WBK sells tickets, flights, hotels and merch, in English and Arabic, in dark and light. A season like Riyadh Season needs dozens of new screens in weeks. With AI tools, PMs prototype event pages, marketing builds campaign pages, and squads ship faster than the design team can review.
Give an AI DS3’s component library and it still guesses: which button is the one that buys, how far apart a card’s parts sit, whether a price says “SAR” or uses the riyal sign, what flips in Arabic. Nothing in the library answers that, so screens drift, and nobody sees it until a release.
- 2languages, with Arabic mirrored
- 2themes, dark and light
- 82semantic colours in DS3
- 45Shop components in the prototype alone
So the system needs what a library leaves out: when to use each part, what never to do, and a check for both.
02
Tokens, components and templates
Figma and code, the same names
DS3 lives in Figma as variables. In the WBK Shop prototype, a script already turns them into a generated file, and nothing in the app writes a colour by hand: every name points to a DS3 path. The framework builds on that, and keeps the two in step through Figma’s MCP server, so a screen an AI builds in code opens in Figma with the same components, and a fix made in Figma comes back to code as a pull request.
Figma
Repository
AGENTS.md what an AI reads first, in order
tokens/ds3.generated.ts DS3's Figma variables, generated, never edited
tokens/colors.ts the app's names, each a path into DS3
components/ one component per contract, typed props
templates/ event page, listing, checkout step, order pass
contracts/ one per component: use for, never, lives in, checked by
rules.md spacing, type, colour and direction between components
decision-map.md the contracts, indexed by job, built from them
harness/ the checks that score every screen
Semantic tokens, verbatim
DS3 names a value by its job, not its look, and keeps Figma’s spelling exactly, typos included. A screen asks for Bg-Accent, not “pink”, and for Gap-L, not “12”.
/* Colour: dark theme, from Color/Colors Semantic/Dark */
Backgrounds/Bg-Accent #ff2c79
Backgrounds/Bg-Primary #0b0b0e
Content/Content-Primary #e4e4e7
Content/States/Content-Positive #22c55e
/* Spacing: from Spacing Semantic */
UI Elements/Gaps/Gap-S 4 Gap-M 8 Gap-L 12 Gap-XL 16
Section/Gab/⌶ Gab-Default 16 ⌶ Gab-Wide 24 // "Gab", as Figma spells it
Container/Radius/Container-Radius-M 30
/* Type: Figtree for English, Vazirmatn for Arabic */
Titles/Title Section 700 22/28 // Arabic: 600, one step lighter
Body/Body-Default 400 15/22
Components and templates
Components are built only from tokens. Templates are whole WBK screens built from components: an event page, a listing, a checkout step and an order pass. A new screen starts from the template that fits its job; if none fits, the AI says which came closest, so the screen reaches triage as a possible template.
03
Contracts and rules
A contract for every component
A component’s code says how it looks. Its contract says when to use it and what never to do with it, which an AI can’t infer. Every contract has the same parts, and the last line names the checks that enforce it.
# Buy bar
The price and the one action that buys, pinned to the bottom of a
product, event or package screen.
## Use for
- The screen's main purchase: Add to bag, Book, Buy tickets
## Never
- Two pink (Bg-Accent) buttons in one bar
- A price written as text: use Price, with the riyal sign
- Scrolling away with the page
## Lives in
Product, event and package screens. Never inside a sheet.
## Checked by
CTA-01, PRICE-01
Rules, written as values
Contracts can’t say how components sit together, so the rules do: surfaces, type, spacing, colour, motion and direction. Every answer is a token or a named component. “Comfortable spacing” fails; “Gab-Wide between sections, Gap-L inside a card, Gap-M between buttons” passes.
| Rule | Written as |
|---|---|
| Spacing | Gab-Wide between sections, Gap-L inside a card, Gap-M between buttons |
| One action that buys | One Bg-Accent button per screen; every other action is Secondary |
| Prices | Always the Price component with the riyal sign; never “SAR” typed out |
| Arabic type | Vazirmatn, one weight lighter than Figtree at the same level |
| Direction | Arrows, chevrons and progress mirror in Arabic; logos, media and maps don’t |
| Themes | Every screen in dark and light, from the same semantic tokens |
04
AI builds
What the AI reads first
Every AI coding tool starts at AGENTS.md. It sets the order: the rules, the decision map, then the contract of each component the screen will use, and nothing else. The AI reads what the screen needs, so a new component adds one short contract, not a longer prompt.
# AGENTS.md
1. Read rules.md
2. Read decision-map.md, find the component for each job
3. Read the contract of every component you'll use
4. Start from the template that fits: event, listing, checkout, order pass
5. Build in English and Arabic, dark and light
6. If no component fits, build a NewPart and label it
The decision map, in WBK’s jobs
The map holds each contract’s “use for” lines, sorted by job. When a nearby job belongs to another component, the last column says so. It’s rebuilt from the contracts on every change, so nobody edits it by hand.
| The job | Use | Instead |
|---|---|---|
| The one action that buys | Buy bar | A second action: Secondary button |
| A price, with or without a deal | Price | A total in the bag: Price, size Large |
| Pick how many tickets | Quantity stepper | Pick a size: Option chip |
| Narrow a list | Filter chip row | Switch views of one list: Segmented control |
| Say it worked | Toast | Something that needs a decision: Sheet |
| A live signal, like selling fast | Demand pill | A count of items: a numeral, not a pill |
Only what DS3 has
Four rules decide what a screen may use, and each can pass or fail:
- CMP-01Build only with components that have a contract.
- CMP-02No new variants. The contract lists every variant there is.
- CMP-03If no component fits, build one and keep going, labelled with its name, its job and why nothing fit.
- CMP-04Never restyle a component. A new look is a new part, under CMP-03.
The types enforce part of this before any check runs: a component takes no style prop, and its variants are only the ones its contract lists. A labelled new part looks like this, as an AI would write it for a Riyadh Season pass:
<NewPart
name="countdown-chip"
base="demand-pill"
job="Show the time left before a ticket sale closes"
why="Demand pill shows a status, not a live countdown">
05
Checks
The harness
On every pull request, the harness opens each screen in a headless browser, at phone width, in English and Arabic, in dark and light, and runs the checks. The score is the share of checks that apply and pass. Each check is a few lines:
Headless browser
// PRICE-01 every price is the Price component, with the riyal sign
const typed = texts.filter(t =>
/\bSAR\b|ر\.س|﷼/.test(t.textContent) && !t.closest('[data-c="price"]'));
set('PRICE-01', texts.length > 0, typed.length === 0,
`${typed.length} prices typed as text`);
The checks only WBK needs
- TOKEN-01Every token a screen names exists in DS3, spelled as Figma spells it. An invented name shows no error; the value just goes missing.
- PRICE-01Every price is the Price component with the riyal sign; never “SAR” or the old ligature typed in.
- RTL-01In Arabic, arrows, chevrons and progress mirror; logos, play buttons and maps stay put.
- AR-TYPE-01Arabic text is Vazirmatn, one weight lighter than the English at the same level.
- THEME-01Every text reaches 4.5:1 contrast against what’s behind it, in dark and in light.
- CTA-01One
Bg-Accentbutton per screen.
When a check fails
A failed check names the rule, what broke, and the contract it comes from. The harness doesn’t change the screen: the AI fixes it in the same pull request, and the screen ships only when every check passes, so an error never reaches triage.
event-page ar · dark
✓ TOKEN-01
✗ PRICE-01 2 prices typed as text ← contracts/price.md
✗ RTL-01 back chevron not mirrored ← rules.md#direction
✓ AR-TYPE-01
✓ THEME-01
✓ CTA-01
score 4 / 6 fix in this pull request, then run again
06
Ships, and new parts go to triage
Once every check passes, the screen ships with its new parts labelled, and each one opens an item in the tracker the team already uses. Only new parts reach triage, never errors.
How triage decides
The design system team picks the first decision that fits, and every decision goes back into the system, so the next build uses it.
07
How it’s tested on a new feature
The real test is a feature DS3 doesn’t cover yet, like a Riyadh Season pass with a wallet pass, a live countdown and a zone map. This is the method for comparing builds with and without the framework.
- Same brief, two setupsBuild the feature three times with DS3’s components only, and three times with the framework. A fresh AI agent each time, none of them shown the harness.
- Four conditionsEvery screen in English and Arabic, dark and light.
- Count what mattersParts built outside the system with no label, labelled new parts, and the harness score.
- What shows it worksFewer unlabelled parts, every missing piece reaching triage with a job and a reason, and no Arabic or theme failures shipped.
08
For WBK’s teams
At WBK, screens come from many squads: Shop, ticketing, flights and hotels, marketing for each season. The rules stay the same; who does what changes.
| Question | Who, at WBK |
|---|---|
| Who builds screens | Designers, PMs and marketing, with AI tools |
| Who explores new parts | Designers in each squad |
| When nothing fits | The part is built and labelled, the build carries on, the part goes to triage |
| Who decides what enters DS3 | The design system team, in triage |
| Who updates Figma, code and contracts | The design system team, one name in all three |
Exploring still works: an explored part, a refined component and an improvised one get the same label and land in the same list.
09
What I’d carry into any design system
- Contracts
“When” and “never” next to each component
A library shows how a part looks; an AI also needs when to use it, in the same place.
- Rules
Every rule as a value
An AI applies
Gap-Lthe same way every time; “comfortable” makes it guess. - Two languages
Check Arabic as hard as English
Mirroring and type weight are where bilingual screens drift first, and both can be checked.
10
Where it applies
The framework was used across projects on Webook’s DS3. In the WBK Shop prototype, every colour, space and type size comes from DS3 through a generated file, so a token can’t drift from Figma; contracts, checks and triage sit on top of that.