Skills· Official
Design skill for coding agents
Build UI that fits the product: color tokens for light and dark, one type scale, phone-first layouts with no sideways scroll, visible focus and good contrast.
When to use it. When you add or restyle a page, component, or layout, so it looks like part of the product instead of bolted on.
Consistency and legibility first, cleverness second. Reuse what the product already has before inventing anything.
Steps
- Learn the existing system before writing CSS. Find the tokens (CSS variables, a Tailwind theme, a component library), the type scale, spacing, and radii, and two or three existing screens that resemble what you're building. Follow their patterns. A new color, size, or one-off component needs a reason.
- Use tokens, never raw values. Colors come from named tokens —
--bg,--surface,--ink,--muted,--accent,--line. If you need a new one, add it to the token set, in both themes. - Make both themes work. Define dark values under
@media (prefers-color-scheme: dark)and under an explicit[data-theme="dark"], so both the system setting and a manual toggle work. Givebodyan explicit background. A color defined in only one theme is the classic unreadable bug. - Keep to the type scale. Existing sizes and weights only; one
h1per page; headings withtext-wrap: balance; body text about 45–75 characters per line;font-variant-numeric: tabular-numswherever digits line up. - Lay out for the phone first. One column at about 390px, more columns at wider breakpoints. Every grid sets its phone columns explicitly — in Tailwind,
grid-cols-1 sm:grid-cols-2, not justsm:grid-cols-2. Any grid or flex child holding text, code, or a table getsmin-width: 0so it can shrink. Only code blocks, tables, and diagrams scroll sideways, each inside its ownoverflow-x: autobox. - Keep repeated things identical. Cards in a row share padding, radius, border, and height. Use emphasis — fill, border, shadow, color — by role, on the one element that needs it, or the hierarchy flattens.
- Design every state. Hover,
focus-visible, active, disabled, loading, empty, and error — and long content: a 60-character word, a three-line title, zero items and five hundred. - Cover the basics. A visible keyboard focus ring; text contrast of at least 4.5:1;
prefers-reduced-motionrespected; real content while designing, never lorem ipsum.
Verify
Look at it — reading the code isn't enough:
- Phone (about 390px) and desktop (about 1280px), in light and dark.
- No sideways scroll at 390px:
document.documentElement.scrollWidth <= window.innerWidth. - Tab through the page: every control reachable, in a sensible order, with a visible focus ring.
- The longest realistic content in every text slot.
Done when
- No raw color or size values that bypass the tokens
- Correct in light and dark, at phone and desktop widths
- No sideways scroll at 390px, and long text wraps or truncates on purpose
- Focus visible, contrast passing, reduced motion respected
- Empty, loading, and error states designed, not left to chance
Report back
Screenshots at phone and desktop widths in both themes, and any new tokens or components you added, with the reason for each.
Traps
- Hard-coded hex values that break in dark mode.
- A responsive grid with no phone columns set — on a phone it becomes one auto-width column that overflows.
- Judging the design on a wide screen with short sample text.
More skills