Communitygithub.com

design-first-ui

Makes the design decisions before writing UI code so the result looks designed, not AI-generated. Picks a grounded visual direction, writes it into a DESIGN.md of tokens and checkable rules, builds every state, then verifies with screenshots against concrete numeric rules (spacing, type, color, contrast, motion) and an anti-slop ban-list. Use this skill whenever you are about to build, generate, redesign, restyle or review any user interface — web pages, landing pages, dashboards, app screens, components, forms, admin panels — in React, Tailwind, shadcn, HTML/CSS, Vue, Svelte or similar, even if the user just says "make it look good", "build me a page", "this looks generic/AI-made", or gives no design guidance at all. Also use it when designing the interface of an AI agent or chat product (plan previews, progress, approvals, undo, citations).

O que é design-first-ui?

design-first-ui is a Claude Code agent skill that makes the design decisions before writing UI code so the result looks designed, not AI-generated. Picks a grounded visual direction, writes it into a DESIGN.md of tokens and checkable rules, builds every state, then verifies with screenshots against concrete numeric rules (spacing, type, color, contrast, motion) and an anti-slop ban-list. Use this skill whenever you are about to build, generate, redesign, restyle or review any user interface — web pages, landing pages, dashboards, app screens, components, forms, admin panels — in React, Tailwind, shadcn, HTML/CSS, Vue, Svelte or similar, even if the user just says "make it look good", "build me a page", "this looks generic/AI-made", or gives no design guidance at all. Also use it when designing the interface of an AI agent or chat product (plan previews, progress, approvals, undo, citations).

Funciona com✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/mal161/design-first-ui/tree/HEAD/skills/design-first-ui

Perguntar na sua IA favorita

Abre um novo chat com esta habilidade de agente já pré-carregada.

Documentação

Design-first UI

Why this skill exists

AI agents produce generic UI because every design decision left open gets filled with the most likely answer from training data: Inter, indigo buttons, a centered hero, three identical cards, fade-up on everything. Anthropic calls this distributional convergence. The user often can't make those decisions themselves — that's usually why they're asking an agent.

So you make the decisions, explicitly, before writing code, and show them to the user. Then constrain the code to those decisions and check the result with your eyes (screenshots), not just your intent.

Ban-lists alone don't work: ban one default and you drift to the next most likely one (when Inter was banned, models switched to Space Grotesk; when purple was banned, cream + serif + terracotta became the new cliché). Specific, grounded choices beat prohibitions.

Distinctiveness must never cost clarity, speed or affordance. "Boring but clear" beats "unique but confusing".

The workflow

Scale the effort to the task. A one-component tweak in an existing design system needs steps 5–8 only. A new screen, page or product needs all of them.

1. Brief — pin down the job

Infer from the request and codebase, ask only what you can't infer:

  • Product, primary user, device, and the one job of this screen (one sentence).
  • Content reality: real data, real copy, real volumes (empty? 10 rows? 10,000?).
  • Tone.

If the user isn't a designer, don't ask open-ended taste questions ("what style do you like?"). Offer 2–3 named, concrete directions and recommend one, e.g.:

  • "Swiss/utilitarian: strict grid, big grotesk type, one signal colour, dense tables"
  • "Editorial: serif display, generous margins, warm neutrals, restrained motion"
  • "Tool-like/Linear-ish: compact, monochrome with one accent, keyboard-first"

If there's an existing design system or brand in the codebase, that is the direction — read it and follow it instead.

2. Ground — borrow from the real world

Pull visual language from the subject's own world (its materials, vernacular, artifacts) and from 1–3 shipped references (real products, not Dribbble shots). Write down what specifically you're taking from each and why. Evocative references ("1970s ski lodge signage", "Japanese train timetable") steer better than adjectives ("modern", "premium", "clean" — these are useless).

3. Token plan — write DESIGN.md

Create or update DESIGN.md (template in references/design-md-template.md). Required content:

  • 4–6 named colors (hex or OKLCH) mapped to semantic roles (bg, surface, text, muted, accent, danger…)
  • 1–2 named fonts, chosen for the product's character
  • type scale (~4 sizes), spacing scale, radius by role, shadow recipe, motion tokens, density mode
  • one signature element — the single place you spend boldness. Everything else stays restrained.
  • a do/don't list

Every rule must be checkable by looking ("buttons are pill-shaped with a hard 2px black shadow"), not vibes ("generous padding"). Show the user the plan briefly before building when the work is substantial.

4. Critique the plan

Compare it against references/ban-list.md. Anything that reads as a default (first- or second-generation) gets replaced unless the brief asked for it. Ask: "Would a fresh chat guess an AI made this?"

5. Constrain the stack

Agents imitate the codebase more than they follow rules files, so put the decisions in code:

  • Tokens as CSS variables / Tailwind theme. In Tailwind v4, --color-*: initial; in @theme deletes the default palette so bg-indigo-500 stops existing.
  • With shadcn/ui: keep its semantic names (bg-primary, text-muted-foreground) — they match model priors — but change the values, radius, font and density.
  • Reuse existing components; don't rebuild tabs/menus from divs.
  • No raw hex or arbitrary pixel values in components.

6. Build ambitiously

  • Solve layout and hierarchy in grayscale logic first, then add color (one accent).
  • Build every state: loading, empty (first-use, no-results, cleared), error, disabled, focus, success. Keyboard navigation. Real or clearly-placeholder copy.
  • Follow the numeric rules below.

7. Look

Don't skip this step. In testing, pages that passed every checklist item on paper still shipped broken: a dashboard whose content never appeared after its loading skeletons, and a hero card frozen half-faded by its entrance animation. Only a rendered look catches that. If you can render (Playwright, browser tool, preview server, or python -m http.server + a headless browser), do it:

  • First confirm the final loaded state actually shows content: wait past every loading delay and entrance animation, then check that data, charts and tables are visible and fully opaque. Check the console for errors.
  • Screenshot after network idle at 390, 768, 1024, 1440 widths; light and dark if both exist.
  • Compare against DESIGN.md. Run the squint/blur test: exactly one thing should win per view.
  • Check contrast; run any linter/detector available (e.g. npx impeccable detect).
  • If you can't render, say so and review the code against references/checklist.md instead.

8. Remove and fix

Remove one accessory (a badge, a glow, a divider, a decorative icon). Fix issues found. Cap at ~3 rounds, then show the user screenshots.

9. Remember

When a correction is needed twice, write it into DESIGN.md so it doesn't recur.

Core numeric rules

These carry most of visual quality. Full table with sources: references/rules.md.

Hierarchy comes from de-emphasizing competitors, not enlarging what matters. ~3 text colors (primary, secondary, tertiary), 2 weights (400–500 text, 600–700 emphasis). One primary button per view. At most 3 contrast treatments; at most 2 elements at the largest size.

Spacing: only 4, 8, 12, 16, 24, 32, 48, 64, 96, 128px. Start with too much whitespace and tighten. Within-group gap ≤ ½ between-group gap. Headings sit closer to their content than to what's above. Use spacing before borders/dividers.

Layout: prose 45–75 characters (~65ch), forms ~600–720px wide, max-width content. Left-align text longer than 2–3 lines; right-align numbers. Data apps want tables and rows, not card grids. Don't mix densities on one surface.

Type: ~4 sizes from 12/14/16/18/20/24/30/36/48/60/72. Body 16px (14px only in dense tables); mobile inputs ≥16px. Line-height 1.4–1.6 body, 1.1–1.3 headings. All-caps +5–12% tracking. Max 2 families. Choose a font for the product's character; Inter unchosen is the problem.

Color: 3–5 colors total. Each hue a ramp of 11–12 steps (OKLCH). Slightly tinted neutrals. Accent ≈10% of surface. No #000 text. On colored backgrounds use a tint/shade of that hue, not gray. Dark mode: ~#121212 tinted surfaces, off-white text, desaturated accents, lighter = higher.

Contrast: text ≥4.5:1, large text (≥24px or ~18.5px bold) ≥3:1, UI boundaries/icons/focus rings ≥3:1. Placeholders still need 4.5:1.

Targets: ≥44px on touch, ≥24px absolute floor.

States, craft and motion

Full details: references/states-and-craft.md. The essentials:

  • Loading: no indicator under ~1s; 150–300ms show-delay, 300–500ms minimum visible; skeleton that mirrors final layout; progress + Cancel past 10s; loading buttons keep their label.
  • Empty: never blank, never "No records" while loading, always a next action.
  • Errors: inline next to the source, more than color alone, keep the user's input, say how to fix. Avoid "please / sorry / invalid / oops / an error occurred".
  • Disabled submit is an anti-pattern — keep enabled and validate on submit.
  • Focus: visible :focus-visible ring ~2px at 3:1.
  • Buttons: verb + object, sentence case ("Save changes", not "Submit"). Confirmations name the outcome ("Delete file"). Prefer undo over confirm.
  • Motion: never on high-frequency actions (shortcuts, command palette, typing). 100–300ms; ease-out cubic-bezier(0.23,1,0.32,1) for enter/exit; enter from scale ≥0.95 + opacity, never scale(0); transform/opacity only; no transition: all; respect prefers-reduced-motion. One orchestrated moment beats fade-up on every section.
  • Surfaces: nested radii are concentric (outer = inner + padding). Shadows layered, low-opacity, tinted to the background. Shadows for elevation, borders for structure. Hover changes color/shadow, never size or weight.
  • Icons: one SVG set, stroke matched to text weight (1.5px with 400, 2px with 600), labeled unless universal. No emoji as icons.

Anti-slop ban-list (summary)

Scan for co-occurrence: one tell isn't proof; four together read as AI. Each ban has a replacement in references/ban-list.md — always replace, don't just delete.

  • Purple/indigo CTAs, purple→blue gradients, gradient text, glows everywhere, gradient blobs
  • Gen 2: cream #F4F1EA + serif + terracotta; near-black + single acid-green accent
  • Unchosen Inter/Roboto/system; reflexive Space Grotesk / Instrument Serif / Fraunces
  • Centered hero + pill badge + two equal CTAs; 3 or 6 identical icon cards; cards in cards; everything a card
  • Tracked all-caps mono eyebrow labels; one accented word per headline; 01/02/03 on non-sequences; "→" on every link
  • One radius and one soft shadow everywhere; glassmorphism on every panel; colored accent stripe on cards
  • Emoji icons; rounded-square icon tile above every heading
  • Fade-up on every section; hover-grow on cards; bounce easing; 600ms animations
  • Filler copy (empower, leverage, unlock, seamless, elevate), "John Doe" testimonials, round-number stat banners
  • Unmodified shadcn defaults; spinner-only loading; missing empty/error states

If you're designing an AI agent / chat product

Read references/agent-products.md. In short: show the plan before high-impact actions; set autonomy per task type; replace spinners with a live step checklist or status text (verb + specific item); report partial success; make reasoning and tool calls inspectable; link citations to exact passages and show uncertainty; reserve approvals for irreversible, credentialed, financial or external actions and phrase them as effects ("will delete 3 files in /src"); use checkpoints + undo for everything else; give the prompt box labeled controls, not a lone sparkle/wand icon; disclose the agent and stop when asked. Keep frequent actions instant; spend motion on the plan reveal and the "done" moment.

Before you hand it over

Run references/checklist.md. Tell the user which direction you chose and why, what the signature element is, and show screenshots if you took them. If something couldn't be verified (e.g. no way to render), say so.

Reference files

  • references/rules.md — full numeric rules table with sources
  • references/states-and-craft.md — states, forms, motion, surfaces in detail
  • references/ban-list.md — every slop pattern with its replacement and source
  • references/design-md-template.md — DESIGN.md template + prompt skeleton
  • references/agent-products.md — UX patterns for AI agent products
  • references/checklist.md — pre-ship checklist

Habilidades Relacionadas