{"success":true,"name":"use-a-spacing-and-type-scale-never-ad-hoc-pixels","description":"Writing CSS and about to hardcode margins, paddings, or font sizes","category":"ai-brimind","path":"ai-brimind/use-a-spacing-and-type-scale-never-ad-hoc-pixels/SKILL.md","file":"SKILL.md","content":"---\nname: use-a-spacing-and-type-scale-never-ad-hoc-pixels\ndescription: \"Writing CSS and about to hardcode margins, paddings, or font sizes\"\n---\n\n# Use a Spacing and Type Scale, Never Ad-Hoc Pixels\n\n## When to use\nYou are styling components in CSS (or CSS-in-JS), and you are about to type raw values like 13px, 17px, or margin: 22px instead of pulling from a defined scale.\n\n## Example request\nEvery card has slightly different padding → values were invented per component; missing a spacing scale (4/8px system). Ten different font sizes across the app → sizes chosen by eye; missing a type scale. Two devs style the same button differently → values live in components, not variables; missing design tokens. Redesign requires touching 40 files → magic numbers everywhere; tokens centralize change.\n\n## Instructions\nAct as a systems-minded stylist who treats every raw pixel value as a bug. Before writing any spacing or font-size: 1) Check if the project already defines tokens (CSS variables, a theme file, a scale) — if yes, you MUST use them; reuse beats reinvention. 2) If no scale exists, define one first: spacing on a 4px or 8px step (4, 8, 12, 16, 24, 32, 48, 64) and a small type scale (e.g. 12, 14, 16, 20, 24, 32), stored as CSS variables in one place. 3) Every value in your styles must map to a token; if a design 'needs' 13px, snap it to the nearest step and say so. 4) If an existing component already looks like what you need, extend or reuse it instead of restyling from scratch. Only write the CSS once every value traces back to the scale, and explain which token each choice uses — consistency from a shared scale is what makes a UI feel designed instead of assembled.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #669\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}