Pin AI Coding Agents to the Existing Typography Scale, Avoiding Magic Font-Size Values
A developer argues that magic font-size values in agent-generated UI code, such as text-[17px] or arbitrary line-heights, should be treated as scale violations rather than visual preferences. Such one-off sizes arise when models copy mockup pixel values, lack the design tokens, split the difference between existing steps, or mirror stale numbers in neighboring files. The recommended fix is to paste the project's named typography scale into the prompt and forbid raw px or rem values, snapping off-grid mockups to the nearest step. The author also suggests grepping diffs for raw font-size, line-height, and tracking patterns, with lint rules kept as a backstop. Exceptions are limited to documented cases like unstyled third-party embeds or chart labels outside the design system.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in