name: frontend-ui description: Build or change a user interface to match a reference screenshot, mockup or spec, and prove it with screenshots at desktop and mobile widths in light and dark themes, keyboard and accessibility checks, and real empty, loading and error states. Use when the work is a page, screen, component, layout, CSS or styling, or the user says "make it look like this", "pixel perfect", "match the mockup", "responsive", "dark mode", "frontend" or "UI". Not for API and data model design (architect) or checking that a released service behaves (prove-it-live). metadata: phase: design
Frontend UI
A screen that matches its reference, shown in screenshots at two widths and two themes, with every real data state and the accessibility basics checked.
When to use
- A page, screen, component or layout is being built or changed.
- The user hands over a screenshot, mockup, design file or written spec to match.
- A visual bug: overflow, wrong spacing, broken dark mode, a layout that breaks on mobile.
Not for: the data model and API behind the screen (architect), or proving a released service works end to end (prove-it-live).
Steps
- Fix the target. Save the reference images (screenshot, mockup, design export) to the ledger task's
run/evidence/ui/(work/ui/if there is no task). With no reference, write a five-line design contract: the screen's job, its primary action, the states it must show, the responsive rule, and the existing screens it should resemble. Use the project's design system, tokens and components. Done when: reference images or the contract are saved. - Set up capture. Reuse the repo's own harness first (Playwright, Cypress, Storybook, a visual test suite). Without one, write a scratch capture script outside the repo using browser tooling already installed; don't add dependencies to the product to check it. Capture four cells: desktop 1440×900 and mobile 390×844 (or the project's breakpoints), each in light and dark (emulate
prefers-color-scheme). Capture the current screen as the baseline before you change anything. Done when: baseline screenshots exist for all four cells, with paths. - Build with real states. Use realistic data, never placeholder text: long names, many rows, missing fields. Make every state reachable by URL, story or fixture: empty, loading, error, long content, and no permission where it applies. Use semantic elements (
button,label,nav, headings in order) and the design system's tokens instead of raw colour and pixel values. Done when: each state can be opened directly and has been seen rendering. - Capture and compare. Screenshot every state in all four cells. Where a baseline or reference image exists, compare by image diff. Otherwise compare side by side and list each difference: spacing, type, colour, alignment, overflow, clipping. Fix and repeat. Done when: the diff is zero, or each remaining difference is listed with a reason.
- Check accessibility. Work through references/ui-checklist.md: keyboard order and visible focus, labels, contrast, headings, no colour-only meaning, reduced motion. Run the project's accessibility check, or axe if it is already available. Check the browser console for errors and warnings. Done when: every checklist item passes or is listed as a known gap.
- Record the evidence. Copy
../istack-mode/templates/evidence.mdtorun/evidence/<id>-ui.mdand fill it with the screenshot paths (baseline and after), the diff results, the accessibility result and the capture command. Point the tracker item at it and link it from the pull request body. Done when: the evidence file exists and the tracker item cites it.
Red flags
| If you're thinking | Do this instead |
|---|---|
| "It looks right on my screen." | Capture all four cells. Mobile and dark mode are where it breaks. |
| "The diff fails by a few pixels; I'll raise the threshold." | Never edit the baseline, threshold or harness to pass. If the baseline looks wrong, stop and ask. |
| "Placeholder text is fine for now." | Real content exposes wrapping, overflow and truncation. Use it. |
| "The happy path is done." | Empty, loading and error are part of the screen. Build and capture them. |
"A div with a click handler works." |
Use a button. It brings focus, keyboard and the accessible role for free. |
| "I'll add Playwright to the project to check this." | Use the repo's harness or a scratch script outside the repo. Verification shouldn't change the product. |
| "I'll tell the user to open the page and look." | Take the screenshots yourself and link them (no-homework). |
| "Colour shows the error state clearly." | Add text or an icon. Colour alone fails some users and every screen reader. |
| "I'll pick a fresh palette; the old one is dull." | Match the reference and the design system. Restyling is a separate change (smallest-change). |
Verify
- Baseline and after screenshots exist for desktop and mobile, light and dark.
- Empty, loading and error states were captured.
- Diffs are zero, or every remaining difference is listed with a reason.
- The accessibility checklist passed or its gaps are listed; the console shows no errors.
- The baseline, thresholds and harness are unchanged.
- The evidence file exists and the tracker item cites it.
Reply
**Matches reference:** yes | with <n> listed differences
| View | Light | Dark | Diff |
|---|---|---|---|
| Desktop 1440 | <path> | <path> | 0 / <n> |
| Mobile 390 | <path> | <path> | 0 / <n> |
**States:** empty <path>, loading <path>, error <path>
**Accessibility:** <tool> → <result>. Keyboard: pass | <gap>. Gaps: <list, or "none">
**Evidence:** <evidence file>
Credits
Baseline first, image diff over eyeballing, and never touching the baseline or harness to pass follow the visual-parity playbook in pstack by Lauren Tan. Real data states, accessibility basics and design-system adherence come from frontend-ui-engineering in addyosmani/agent-skills. Reusing the repo's own harness instead of adding dependencies follows the Cursor team kit's control-ui skill.