Evals for UI output: catching what AI-generated frontend breaks

LLM evals usually mean checking text output. But when agents write frontend code, the failures are visual: broken layouts, dead interactions, accessibility regressions. Here's how to eval what users actually see.

Published

Updated

Read time

5 min

Cover for 'Evals for AI-generated UI': the headline Eval what users see, with five failure patterns and three eval layers catching about 90 percent of them

Everyone evals their LLM's words. Almost nobody evals its pixels, and when coding agents write frontend, the pixels are where it breaks. The code compiles, the tests pass, and the button is invisible on mobile.

What actually breaks

AI-generated UI fails in patterns. Learn the patterns and you can check for them systematically:

  1. Responsive collapse. The desktop layout is perfect; at 375px the nav overlaps the hero. Agents design at one viewport unless told otherwise.
  2. Dead interactions. Buttons that look clickable and do nothing, forms that submit nowhere. The agent built the surface, not the wiring.
  3. Accessibility regressions. Missing labels, divs-as-buttons, contrast failures, no focus states. Agents don't use screen readers.
  4. State amnesia. Loading, empty, and error states simply don't exist. The agent built the happy path and stopped.
  5. Layout shift. Images without dimensions, fonts swapping late, content jumping. The agent didn't measure.

The eval stack

You don't need a research lab. Three layers catch ~90% of it:

Layer 1: Screenshots at three viewports

Render every AI-generated page at 375px, 768px, and 1440px and look at them. This sounds embarrassingly manual, and it catches embarrassingly many bugs. Automate the capture (Playwright's screenshot API is one function call); keep a human in the review loop until the patterns stop surprising you.

Layer 2: Visual regression diffs

Once you have baseline screenshots, diff against them on every AI-generated change. Playwright, Percy, Chromatic, pick one. The rule: any pixel diff on an AI-touched page gets a human look before merge. Agents are prolific; diffs are cheap.

Layer 3: Interaction smoke tests

For every form, button, and navigation element the agent created: click it in a test and assert something happened. Not full E2E suites, just "does the thing do the thing." Dead interactions are the most common AI UI failure and the easiest to catch mechanically.

Layer 0 (bonus): The accessibility pass

axe-core in CI. It takes ten minutes to set up and catches the label/contrast/focus failures agents produce constantly. There's no reason to ship AI-generated UI without it.

The eval stack for AI-generated UI: screenshots at 375, 768 and 1440 pixels, visual regression diffs, interaction smoke tests, and axe-core accessibility checks

What not to eval

Don't try to eval "does it look good." Taste isn't automatable and you'll drown in false positives. Eval the mechanical failures: layout, interaction, accessibility, states, and leave aesthetics to human review. The goal isn't replacing designers; it's making sure the agent's output is reviewable instead of broken.

Keep a failure log, and feed it back

Every failure the stack catches should land in a log with three fields: what broke, which of the five patterns it belongs to, and what the fix was. This sounds like bureaucracy. It's actually the highest-leverage artifact in AI-assisted frontend work, for two reasons.

First, the log tells you where to automate next. The first time an agent ships a form with no error state, a human catches it. The third time, that check belongs in the eval stack, not in a reviewer's head. Your Layer 3 smoke tests should grow directly out of the log, one test per repeated pattern.

Second, the log is prompt material. A monthly skim of repeated failures becomes concrete instructions in your context file: "every form gets an error state and a disabled-while-submitting state," "never ship an image without width and height." Agents repeat the failures you tolerate and avoid the ones you name. The failure log is how you name them systematically instead of angrily, in a PR comment, at midnight.

Set failure budgets, not vibes

Not every eval failure deserves the same response, and treating them alike either blocks everything or teaches the team to ignore the dashboard. Split them:

  • Hard fail: a dead primary action, an axe-core critical violation, a page that doesn't render at 375px. The PR does not merge. No exceptions, no "fix it later," because later is where these go to live forever.
  • Review queue: pixel diffs, new console warnings, a layout-shift regression. A human looks, decides, and the decision gets logged. These are judgment calls, and the log keeps them consistent.
  • Trend only: counts of minor issues (missing alt text on decorative images, non-critical contrast on disabled states). Nobody acts on a single occurrence; everybody acts when the trend line climbs for a month.

Budgets turn evals from a gate people resent into a signal people trust. The hard-fail list should be short, mechanical, and genuinely non-negotiable. Everything else is information.

One practical note on cost: this stack is cheap to run and occasionally expensive to review, so protect the review step. Batch the screenshot diffs into the PR as a contact sheet, three viewports side by side, so a human can clear a clean PR in under a minute. The moment reviewing eval output takes longer than reviewing the code did, teams stop looking, and a check nobody reads is worse than none at all, because it manufactures confidence. Keep the signal fast, visual, and boring.

The workflow

  1. Agent generates or modifies UI
  2. CI captures screenshots at three viewports + runs axe + runs interaction smokes
  3. Human reviews the visual diff (2 minutes, not 20)
  4. Merge or send back with the specific failure

The teams shipping AI-generated frontend with confidence aren't trusting the agent more. They're verifying it faster.

Share this article

Newsletter

The NotVibesCoded Weekly

One email a week: the newest articles, project teardowns and AI-coding notes. No slop, no spam, unsubscribe anytime.

We will send a confirmation email. Click the link in it to finish subscribing.

Written by

NotVibesCoded Editorial Team

NotVibesCoded is written and reviewed by its editorial team under the standards in the editorial policy. A named author page, with full credentials, replaces this placeholder shortly.

More about the author

Related

Projects mentioned

AI Engineering

Claude Code logoClaude Code

Anthropic's agentic coding tool that works in your terminal.

Claude Code brought the agent loop to the command line: it reads your codebase, plans changes, runs commands, and iterates, with you directing, not typing. The reference implementation of terminal-native AI engineering.

TypeScript
Developer Tools

Windsurf logoWindsurf

The agentic IDE built around human-AI flow state.

Windsurf (formerly Codeium) designed the editor around continuous collaboration: Cascade, its agent, tracks your intent across files and terminal, keeping you in flow instead of context-switching to chat.

TypeScript
AI Engineering

Bolt logoBolt

Prompt, run, edit, and deploy full-stack apps in the browser.

StackBlitz's Bolt turns a text prompt into a working full-stack application, running live in the browser via WebContainers, editable in a real IDE, deployable in one click.

Related

Related articles