Typography rules for AI-generated dashboards
AI can write dashboard code that looks right but isn’t. I wrote rules that keep AI-generated headings and body text on-brand and accessible. Along the way, I found four ways the output goes wrong without them.
- Company
- Personal project
- My role
- Sole designer
- Design system
- Scale Design System 4.2
- Finished
- October 2026
The problem
When AI makes a mistake with a design system, the result often looks fine.
The code is valid. The token names are real. The sizes seem reasonable. So a reviewer has to catch every error by hand, one decision at a time.
I wanted AI to generate dashboard text that follows Scale Design System without that review. I focused on one slice: page, section, and card titles, plus body text, on desktop dashboards.
What I found
I checked every finding against the installed Scale code, not its documentation. I found four ways AI output goes wrong. Each one ships without warning, because the broken code still looks correct.
- Marketing-size titles
- A plain
<h1>picks up Scale’s default title size, which is 56px. That’s built for marketing pages. A dashboard title should be 32px. - Half-size headings
- “Heading L” sounds like it uses the size token named “L.” It doesn’t. That token is 16px, and Heading L is 32px. An AI that guesses from the name ships titles at half size.
- An out-of-date source
- Scale’s token file, which its own AI tools read, lists the wrong letter spacing for page titles. AI that trusts that file gets every page title slightly wrong.
- Text that won’t grow
- Scale sets type sizes in fixed pixels. Even fully correct output ignores a person’s browser text-size setting. No rule in my layer can fix this. It needs a change inside Scale.
Key decisions
- Trust the shipped code only
- The installed Scale code is the only source of truth. The token file and the Figma library are out of date in places, so AI must never build styles from them.
- One name per style
- AI may use only five named text styles, applied as a whole. It can’t use raw sizes or shortcut names. Each allowed name states its weight, so a reviewer can see what was chosen.
- Headings are always semibold
- Scale offers three weights for each heading. I allowed only one. That gives up some range, but it removes a whole class of mixed-weight mistakes.
- Three text colors
- I tested every text color for contrast in light and dark themes. Only three passed 4.5:1 on every surface I checked, so those are the only ones allowed. The lightest one is limited to regular body text.
- Narrow on purpose
- Scale already offers general AI tools that cover every page type. My layer sits on top and covers only dashboards. Because it’s narrow, it can make stricter rules. I traded completeness for predictability.
One rule up close
This is the half-size heading mistake. An AI guesses the size token from the style name:
.dashboard-title {
font-size: var(--sc-type-size-l); /* 16px, not 32px */
}
My rule allows only the named styles, written as a pattern a validator can check:
^sc-typography-(heading-(l|m|s)-semi-bold|text-(l|m)-regular)$
Any raw size token fails the check. The AI has to use the full style instead, and the title comes out right:
.dashboard-title { ${headingLSemiBold} } /* 32px, semibold */
The same rule also stops the marketing-size mistake, because every title must name its style.
Results
The rules prevent three of the four mistakes. Review work that used to happen after the fact now happens when the code is generated.
I documented the work in five parts: an audit of every text style, a constraint table, two prompt specs (one for headings, one for body text), and a log of the failures and their fixes.
What’s still open
I checked contrast on three of Scale’s five surface colors. Next time I’d check all five, plus see-through overlays, since dashboards use them.
Text that won’t grow needs a fix inside Scale. I proposed one: base its size units on rem, so every size follows the person’s text setting.
Some guidance can be written down but not enforced yet, such as line length and paragraph spacing. Scale has no tokens for them.
Tasks and tools
-
Tasks
-
Tools