Agentic Design Pattern: Visual Verification
When AI agents write your UI, check their work the way a person does: by looking at the page after the browser has drawn it.
Building Blocks
On this page
In App Zoo, the product I'm building, coding agents write most of the screens. They write code that compiles, passes its tests, and still looks wrong: a name cut off mid-word, two buttons at different heights, a header that starts a few pixels off the title. I kept catching these by eye. So I built a camera: a checker that looks at each page after the browser has drawn it, at three screen widths, against about 110 written design laws.
- 01DrawRender every page in a real browser, at 1920, 1440 and 390 px.
- 02MeasureRun each written law against the boxes, lines and colors on screen.
- 03CompareCount only what a change added, not what was already there.
- 04JudgeThe next full walk decides whether a fix held.
- 01DrawRender every page in a real browser, at 1920, 1440 and 390 px.
- 02MeasureRun each written law against the boxes, lines and colors on screen.
- 03CompareCount only what a change added, not what was already there.
- 04JudgeThe next full walk decides whether a fix held.
Everything below moves. Click through it.
Why it has to look at the drawing
Most of the defects you catch by eye don't show up anywhere in the code. A code checker reads the component and sees nothing wrong. The browser draws it and the name is gone.
<Card>
<Name>{person.name}</Name>
<Role>{person.title}</Role>
</Card>Code checker: looks fineSo the camera measures the drawing, never the source.
Be the camera
This is the core move, small enough to run right here. The page below has six planted mistakes. The checks are real: they measure the drawn page the same way the full laws do.
Below is a small Bills page with six planted mistakes. Pick a screen width, then run the camera. The checks really run in your browser: they measure boxes, line counts and colors, the same way the real laws do. Fix a mistake, run it again, and watch the finding clear.
The night shift
Every night, while I sleep, the camera walks every page of the development site. Nobody types the list of pages, and nobody grades their own fixes.
It wakes from a fresh copy of the code
It never borrows a copy an agent is working in, so the laws it runs are always the ones everyone shares.
The camera on every preview
Before an agent opens a preview for me, the camera draws the pages it's about to show at all three widths. It also draws the same pages from the shared, current code. It only stops the preview for problems the change added.
When the camera is wrong
An agent can report a false alarm, with a reason. Click to step through what that does.
The laws are measurements
There are about 110 laws, and every one is a measurement written in plain words. Each law exists because I caught that defect by eye at least once. Here's a sample, by family.
Who checks the camera
A law doesn't count until the camera has been shown it can fail it. Every law ships with a test page that has the mistake planted on purpose, and a clean twin.
two buttons, 40px and 34px tall, side by side
the same two buttons, both 40px tall
And the camera's own numbers need the same suspicion.
What it can and can't see
- Text cut off, wrapped or spilling out of its box
- Things out of line, at the wrong height, overlapping
- Colors that aren't the approved ones, read pixel by pixel
- Missing headers, footers and summary states
- Tables whose columns don't share the space evenly
- A section, button or label nobody asked for
- Whether a page was built from an approved recipe
- A layout that's legal but wastes space
- Pages and states the nightly walk never reaches
- Anything taste-shaped that hasn't been written as a law
Two rules keep the whole thing honest. A law is not ratified until the camera can fail it. And no sweep verifies itself. I wrote both after finding defects by eye three nights in a row that the checks had reported clean. A checker that grades its own work always passes.