Linter
A good design system makes the wrong decision hard to make, for a person and for an agent. Two things do that here: tokens that say what they are for, and a linter that stops what the tokens can't.
Two layers of tokens
70 primitives hold the raw values and mean nothing on their own. 29 roles say what a colour is for, and point at a different primitive in each mode.
indigo.925 is #13122a. A raw value, no meaning.bg/ground is the page background: indigo.925 in Dark, indigo.25 in Light.bg-ground in a class, var(--c-bg-ground) in CSS, c.bgGround in Flutter. Never the primitive.The four rules
What the tokens can't prevent, the linter catches. Every finding names the file and line, and says what to use instead.
#21201c, rgb(…), bg-white. Use bg-surface, text-fg-muted, var(--c-…).p-[13px], gap-1.5, text-[13px], rounded-lg. Spacing is 2, 4, 8, 12, 16, 20, 24, 32; type comes from the t-* styles.<button> instead of <Button>, a <select> instead of <Dropdown>.Limits
A limit is written once, in the component it belongs to. The linter reads it from there, and so does this page.
TabBar.limits = {
tabs: { prop: "tabs", max: 3, why: "Three tabs at most. The action (the plus) is not a tab: it is the separate dot." },
one: { max: 1, per: "surface", why: "One tab bar per screen." },
} as const;Run it
Before calling any screen or component done. It exits with an error when something needs fixing, so it can gate a commit or an agent's turn.
pnpm lint:ds # the components and everything built from them
pnpm lint:ds src/screens/send.tsx # just the file you touched
pnpm lint:ds --json # findings for an agent to read
pnpm lint:ds --self-test # proves each rule still catches its mistake
send.tsx:5:25 raw-color "#21201c" is a raw colour
→ use a role: var(--c-…), or a Tailwind role class
send.tsx:5:34 one-off-value "p-[13px]" is a one-off value
→ spacing is 2, 4, 8, 12, 16, 20, 24, 32; the nearest is 12
send.tsx:7:7 raw-html <button> where a component exists
→ use Button, IconButton, or the component that owns this control
send.tsx:8:7 limits 2 × primary action in SendScreen; the limit is 1
→ One primary per surface: it is the next step. Make the others secondary or tertiary.Exceptions
Sometimes a raw value is right: a coin's own brand colour is content, not UI. An exception is allowed only out loud, with its reason, and every one is listed in the summary.
// ds-lint-allow raw-color: each coin's own brand colour is content, like its logo, not part of the UI
style={{ background: ["#9945ff", "#29c5a4"][i] }}Without a reason after the colon, the exception itself is an error.