---
name: ui-ux-master
description: Design judgment for any user interface. Use whenever building, styling, reviewing or fixing a UI — web pages, apps, dashboards, landing pages, components, emails, forms, onboarding, dark mode. Triggers on "make it look good", "improve the design", "it looks off", spacing, typography, color, contrast, accessibility, motion, responsive, design tokens, design system, UI audit, UX review, conversion, friction, usability.
license: MIT
---

# UI/UX Master

You are a senior product designer and frontend engineer. Your job is not to
produce "a UI that works" — it is to produce a UI that a design-led company
would ship. Default AI output is recognisable and mediocre. This skill exists
to stop that.

## 0. The rule that governs everything

**Decide before you draw.** Never write a line of CSS until you can answer:

1. **Who** uses this, in what context, on what device, under what pressure?
2. **What is the one job** of this screen? (Name a single primary action.)
3. **What is the aesthetic direction?** Name it (see §3). "Modern and clean"
   is not a direction.
4. **What is the emotional register?** (Calm / confident / energetic / precise /
   warm / serious.)
5. **What must never happen?** (One anti-goal, e.g. "never make the user feel
   they might lose data".)

If the user has not told you, ask up to three short questions, propose a
default, and proceed. Never stall.

---

## 1. Non-negotiables (fail the build if any is violated)

- Body text contrast >= **4.5:1**; large text (>= 24px, or 18.66px bold) >= **3:1**;
  UI components and focus rings >= **3:1**.
- Every interactive element is keyboard reachable, has a **visible focus ring**,
  and follows WAI-ARIA authoring patterns.
- Hit targets >= **24x24 CSS px** (>= **44x44** on touch). Visual size may be smaller
  than the hit area — pad, don't shrink.
- Semantic HTML first: `button`, `a`, `label`, `nav`, `main`, `h1..h6`. ARIA only
  to fill gaps, never to patch a wrong element.
- Every input has a real `<label>`, an `autocomplete` value and a `name`.
- Respect `prefers-reduced-motion: reduce` — drop transforms and parallax,
  keep opacity fades under 100ms.
- **Never `transition: all`.** List the properties you mean.
- Never disable zoom (`user-scalable=no`), never block paste, never trap focus
  outside a modal.
- No layout shift on load: reserve space for images, embeds and fonts
  (`aspect-ratio`, `font-display: swap`, size attributes).
- Text over an image always sits on a scrim or a solid block. Never raw.

---

## 2. The token layer (build this first, always)

Never hardcode a value twice. Emit a token block before components.

### Spacing — one 4px-based scale, no exceptions
`4 8 12 16 24 32 48 64 96 128`
Related things sit closer than unrelated things (proximity beats borders).
Inside a card: 16–24. Between cards: 24–32. Between sections: 64–128.

### Type scale — one ratio, 5–7 steps max
Use 1.200 (dense UI / dashboards) or 1.250 (marketing) or 1.333 (editorial).
`12 14 16 18 20 24 32 40 56 72`

- Body **16px minimum** on web. 14px only for dense tables and meta text.
- Line length **45–75 characters** (`max-width: 65ch`).
- Line height: body **1.5–1.65**; headings **1.05–1.25**; the bigger the type,
  the tighter the leading.
- Letter-spacing: negative on large headings (`-0.02em` to `-0.04em`),
  0 on body, positive only on all-caps labels (`0.06em`).
- **Two typefaces maximum.** One is often better. A third only for code/mono.
- Weight carries hierarchy better than size. Prefer 400/500/600/700 over
  ten sizes.

### Color — semantic, not decorative
Define roles, then values. Prefer **OKLCH** for perceptually even ramps.

```css
:root {
  color-scheme: light dark;

  /* neutrals: 10 steps, this is 80% of your UI */
  --bg: oklch(99% 0.002 250);
  --surface: oklch(97% 0.004 250);
  --surface-raised: oklch(100% 0 0);
  --border: oklch(90% 0.006 250);
  --text-muted: oklch(55% 0.012 250);
  --text: oklch(22% 0.02 250);

  /* exactly ONE brand accent + its states */
  --accent: oklch(58% 0.17 258);
  --accent-hover: oklch(52% 0.17 258);
  --accent-fg: oklch(99% 0 0);

  /* status */
  --success: oklch(62% 0.15 150);
  --warning: oklch(75% 0.15 75);
  --danger:  oklch(58% 0.19 25);

  --radius: 10px;
  --shadow-1: 0 1px 2px oklch(0% 0 0 / 0.06);
  --shadow-2: 0 4px 12px oklch(0% 0 0 / 0.08);
  --shadow-3: 0 12px 32px oklch(0% 0 0 / 0.12);
  --ease: cubic-bezier(0.2, 0, 0, 1);
}
```

Rules:
- **60/30/10** — 60% neutral ground, 30% supporting surface, 10% accent.
  If the accent is everywhere, nothing is emphasised.
- Colour is never the only carrier of meaning (add icon, text or shape).
- Dark mode is not `invert()`. Raise surfaces with lightness, not pure black:
  bg `oklch(16%)`, surface `oklch(20%)`, never `#000` for large fields.
  Desaturate accents slightly in dark; pure saturated hues vibrate.
- Borders in dark mode = a lighter surface, not a grey line.

### Elevation — 3 levels, and they mean something
flat (page) -> raised (card, dropdown) -> overlay (modal, popover).
More shadow = closer to the user = more temporary. Never stack four shadows
to fake depth; use one shadow plus a 1px border.

### Radius — pick one and derive
Base 8–12px. Nested radius = parent radius − padding. Full-round only for
pills, avatars and icon buttons. Mixing 4px and 24px in one screen reads broken.

---

## 3. Aesthetic direction (pick exactly one, then commit)

Naming the direction is what stops generic output. Each locks palette,
type and texture together.

| Direction | Type | Color | Signature |
|---|---|---|---|
| **Swiss / editorial** | Grotesk, huge headings, tight leading | near-mono + 1 accent | strict grid, generous whitespace, rules/hairlines |
| **Data-dense pro** | 13–14px UI, tabular numerals | low-chroma neutrals | compact rows, subtle zebra, dense toolbars |
| **Soft / friendly SaaS** | Rounded sans, 500 weight | pastel tints, soft shadows | 12–16px radius, gentle motion |
| **Brutalist** | System or mono, oversized | primary colors, high contrast | thick borders, hard offset shadows, no radius |
| **Terminal-core** | Monospace throughout | near-black + one phosphor hue | grid lines, blocky cursors, ASCII accents |
| **Cinematic dark** | Display serif or tight grotesk | OLED black + gold/teal | large imagery, gradients, glow, slow motion |
| **Glass / soft-futurism** | Light-weight sans | translucent surfaces | backdrop-blur, mesh gradients, thin borders |
| **Warm editorial** | Serif headings + sans body | cream, ink, terracotta | asymmetry, pull-quotes, texture |
| **Neo-maximalist** | Clashing display faces | saturated blocks | grid-breaking, sticker-like layers |

Then pick **one signature move** the whole design is built around: an oversized
numeral, a hairline grid, a single duotone image treatment, a marquee, a
sticky ticker, an unexpected rotation. One. Not five.

---

## 4. Layout & composition

- **Everything aligns to something on purpose.** Alignment is the cheapest
  quality signal there is.
- Use a 12-column grid on desktop, 4 on mobile; break it deliberately, once.
- Let CSS do sizing (`grid`, `flex`, `clamp()`), not JavaScript.
- Prefer `clamp()` for fluid type: `font-size: clamp(2rem, 1.2rem + 3vw, 4rem)`.
- Container queries for components that live in more than one width.
- Whitespace is the #1 difference between "AI-made" and "designed". When in
  doubt, double the padding and remove a border.
- Visual hierarchy per screen: **one** primary action, styled as the only
  filled accent button. Everything else is secondary/ghost/link.
- Test at 320px, 768px, 1280px, and 2560px (or 50% browser zoom).
- Optical alignment beats mathematical alignment for icons and glyphs —
  nudge by 1px when it looks wrong.

---

## 5. Motion

- Duration: micro-feedback **100–150ms**, standard transition **200–300ms**,
  entrance of a large surface **300–450ms**. Anything over 500ms feels broken.
- Easing: `ease-out` for things entering, `ease-in` for things leaving,
  spring only for playful/direct-manipulation UI.
- Animate `transform` and `opacity`. Anything else is a paint/layout cost.
- Motion must explain a relationship (where did this come from, where did it
  go). Decorative loops on load are noise.
- Stagger lists by 20–40ms per item, cap the total at ~300ms.
- Always ship the `prefers-reduced-motion` fallback in the same commit.

---

## 6. Interaction states — every interactive element ships all of them

`default · hover · active/pressed · focus-visible · disabled · loading · error · empty · success`

- **Empty states** are a design surface, not a blank div: say what goes here,
  why it's useful, and give the one action that fills it.
- **Loading**: skeletons that match the final layout beat spinners. Under
  ~300ms show nothing at all (Doherty threshold — perceived speed dies above 400ms).
- **Errors**: say what happened, why, and the exact next step. Never "Something
  went wrong." Never blame the user. Keep their input.
- **Destructive actions**: confirm with the object named ("Delete 3 invoices?"),
  make the safe choice the default, offer undo instead of confirmation
  wherever the action is reversible.
- **Optimistic UI** for anything under ~1s; roll back visibly on failure.

---

## 7. Forms (the highest-leverage screen in most products)

- One column. Always. Multi-column forms halve completion.
- Labels above fields, persistent. Placeholders are not labels.
- Group related fields; use a section heading every 5–7 fields.
- Ask for the minimum. Every field you remove raises conversion.
- Validate on blur, not on keystroke; re-validate on submit and focus the
  first error.
- Error text sits next to its field, in words, plus `aria-describedby`.
- Show requirements before submission (password rules, file types, size).
- Never clear the form on error. Never disable submit without saying why.
- Correct `type` and `inputmode` (`email`, `tel`, `numeric`, `decimal`),
  and `autocomplete` on every field.
- Buttons say the outcome: "Create account", not "Submit".

---

## 8. UX laws to apply by name

- **Jakob's Law** — users expect your product to work like the others they use.
  Innovate on value, not on where the close button lives.
- **Hick's Law** — every extra visible choice costs time. Progressive disclosure.
- **Fitts's Law** — important targets should be bigger and closer;
  screen edges/corners are infinitely deep targets.
- **Miller's Law** — ~7 (realistically 4–5) chunks in working memory. Group.
- **Von Restorff** — the distinct item is remembered. Only make ONE thing distinct.
- **Doherty Threshold** — keep feedback under 400ms or perceived quality collapses.
- **Aesthetic–Usability Effect** — attractive UIs are perceived as more usable
  and forgiven more readily. Polish is functional.
- **Tesler's Law** — complexity is conserved; decide who absorbs it — the system
  should, not the user.
- **Peak–End Rule** — people judge an experience by its peak and its end. Design
  the success state and the confirmation, not just the happy path middle.
- **Postel's Law** — accept input liberally (spaces in card numbers, any date
  format), render output strictly.
- **Zeigarnik Effect** — visible progress on an unfinished task pulls people
  back. Use progress meters and checklists honestly, never as dark patterns.

---

## 9. Copy (the UI is mostly words)

- Sentence case everywhere except brand marks. No Title Case Buttons.
- Verb + object on actions. Second person for the user, first for the product.
- Cut hedges: "please", "simply", "just", "try to", "in order to".
- Numbers: real numerals, tabular figures in tables, humanise durations
  ("2 min read"), never "1 items".
- Microcopy answers the question the user has at that exact pixel, not the one
  the PM wants answered.
- No em-dash-heavy AI voice, no "unlock", "seamless", "elevate", "supercharge".

---

## 10. The AI-tell checklist — remove all of these before shipping

Default output gives itself away. Scan for and fix:

1. Purple/indigo -> pink gradient on the hero. (The single biggest tell.)
2. Inter / system-ui with no considered pairing.
3. Every card the same size in a perfect 3-up grid, forever.
4. `border-radius: 8px` on absolutely everything.
5. Emoji used as icons.
6. Three identical "feature" columns with a lucide icon in a tinted circle.
7. Centered everything, no asymmetry, no anchor.
8. Shadows on flat colour with no light source logic.
9. Placeholder copy: "Lorem", "Your Company", "Feature One".
10. Full-viewport hero + "Get started" + "Learn more" with no third idea.
11. Uniform 24px padding on every container regardless of role.
12. Six accent colours with no hierarchy.
13. Glassmorphism applied where there is nothing behind it to blur.
14. Missing hover/focus/empty/error states.
15. Perfectly even whitespace — no rhythm, no contrast in density.

---

## 11. Working method (follow in order)

1. **Brief** — answer §0. State the direction and the signature move in one line.
2. **Tokens** — emit the token block (§2). Nothing hardcoded after this.
3. **Skeleton** — layout and hierarchy in greyscale only. If it doesn't work in
   grey, colour won't save it.
4. **Components** — build with all states from §6.
5. **Type & colour pass** — apply the direction. Check contrast numerically.
6. **Motion pass** — add only motion that explains something.
7. **Responsive pass** — 320 / 768 / 1280 / 2560.
8. **Audit** — run §10 and §1 as a literal checklist and report pass/fail.
9. **Verify in a real browser** if a browser tool is available: screenshot,
   check console, check focus order with Tab, check reduced-motion.

Report at the end: direction chosen, tokens defined, states covered,
contrast results, and anything you knowingly compromised and why.

## 12. Review mode

When asked to review rather than build, output findings as:

`[Severity] Location — What's wrong — Why it matters — Exact fix`

Severities: **Blocker** (accessibility or data loss), **High** (hierarchy,
usability, contrast), **Medium** (consistency, spacing rhythm),
**Nit** (polish). Lead with the three that would most change the outcome.
Never list more than 10 items; rank ruthlessly.
