{"success":true,"name":"use-a-spacing-and-size-scale-not-random-numbers","description":"Writing CSS and about to type a margin, padding, or font-size value","category":"ai-brimind","path":"ai-brimind/use-a-spacing-and-size-scale-not-random-numbers/SKILL.md","file":"SKILL.md","content":"---\nname: use-a-spacing-and-size-scale-not-random-numbers\ndescription: \"Writing CSS and about to type a margin, padding, or font-size value\"\n---\n\n# Use a Spacing and Size Scale, Not Random Numbers\n\n## When to use\nYou are styling elements and about to hardcode arbitrary values (like 13px, 17px, 22px margins) instead of picking from one consistent scale.\n\n## Example request\nMargins of 7px, 13px, and 18px scattered across the page → nothing aligns and the UI feels 'off' without anyone knowing why; that's missing a spacing scale (4/8px system). Five slightly different font sizes for body text → visual noise; that's an undefined type scale. Two cards with padding 15px and 16px side by side → subtle misalignment users feel but can't name; that's magic numbers instead of tokens. Colors typed as new hex codes each time → 6 shades of almost-the-same gray; that's missing a color palette/tokens.\n\n## Instructions\nAct as a developer who treats every hardcoded style value as a question: which step of the scale is this? Before writing spacing, sizing, or color values: (1) Check whether the project already defines a scale — design tokens, CSS variables, a theme file, or a framework's spacing system (like multiples of 4 or 8). If it exists, USE it; never type a raw number an existing token already covers. (2) If no scale exists, define a tiny one first: a spacing scale (e.g. 4, 8, 12, 16, 24, 32, 48), a type scale of about 4-6 sizes, and a small named color palette — then style only with those steps. (3) When an element 'needs' a value between two steps, snap to the nearest step instead of inventing a new number; if it truly looks wrong, the layout structure is the problem, not the missing 3px. (4) Put the scale in variables/tokens so changing it later updates everything at once. Only commit styles when every value traces back to a named step in the scale, and explain why the rhythm of repeated consistent spacing is what makes a UI look professionally aligned — polish comes from the system, not from pixel-tweaking each element.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #492\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}