Critiquing AI-Generated UI: Six Checks for Every Screen
An AI tool can build a tidy-looking dashboard in seconds and still hide six problems. Review it with six questions, measure the contrast with a ten-line script, and fix each issue with a small CSS change, before and after.
What you will learn
- Review an AI-built screen with six questions: hierarchy, states, contrast, consistency, labels and focus
- Measure text contrast with a small Python script instead of trusting your eyes
- Fix each problem with a small CSS change: variables, an empty state, a skeleton, clear labels, a focus ring
- Ask an AI assistant to review and fix a page against the checklist
Before you start
- Basic HTML and CSS
AI tools can build a page in seconds, so the useful skill now is reviewing what they build. In this lesson we take one AI-generated page, find six problems in it, and fix each one. You'll leave with a checklist you can run on any screen in about two minutes.
The AI draft
We gave an AI tool one prompt: build a dashboard and settings page for a team task app. It came back with three stat cards, two panels and a profile form. It runs, and at first glance it looks tidy.

Look closer and the problems show up. Here is the checklist that finds them.
Six questions for every AI screen
| # | Check | Ask yourself | Quick test |
|---|---|---|---|
| 1 | Hierarchy | What do I see first, second, third? | Squint at the page. Does one thing lead? |
| 2 | States | What if it is empty? Loading? Failed? | Remove the data and reload slowly |
| 3 | Contrast | Can I read it? | Text needs 4.5 : 1 against its background (large text 3 : 1) |
| 4 | Consistency | Same radius, same spacing, same sizes? | Compare cards, buttons and inputs side by side |
| 5 | Labels | Does each button say what it does? | Read only the buttons. Do they make sense? |
| 6 | Focus | Can I see where the keyboard is? | Press Tab through the page |
The AI drafts, and you review.
1. Hierarchy: what comes first?
In the draft, the page title and the numbers on the cards are all about the same size and weight. Nothing leads the eye.
The fix: make the title 28 pixels and bold, make the key numbers 32 pixels, and put small muted labels above them.
h1 { font-size: 28px; font-weight: 800; color: #111827; margin: 0; line-height: 1.2; }
.lbl { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.num { font-size: 32px; font-weight: 800; line-height: 1.15; color: #111827; }
Now your eye knows where to start. The basics of size and weight are covered in Visual Hierarchy, Spacing and the 8-Point Grid.
2. States: empty and loading
The Recent activity and Reports panels are blank. With no data, the user sees an empty white box, and while data is loading there's no sign of it either.
The reviewed page shows an empty state (a short message and a link for the next step) and a skeleton while loading: grey bars with a small pulse.
<div class="panel"><h2>Recent activity</h2><p class="empty">No activity yet. Update a task and it shows up here.<br><a href="#">Create a task</a></p></div>
<div class="panel"><h2>Reports</h2><div class="skeleton w80"></div><div class="skeleton"></div><div class="skeleton w60"></div></div>
.skeleton { height: 10px; border-radius: 6px; background: #e5e7eb; margin: 8px 0; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
Every screen has three extra states to design: empty, loading and error.
3. Contrast: measure it
The grey helper text and the placeholder in the form are hard to read. Don't trust your eyes. Measure it.
The contrast ratio is (lighter + 0.05) / (darker + 0.05), where each colour is first turned into a relative luminance. The project's contrast.py does the sums:
"""WCAG contrast ratio: python contrast.py "#A3A9B3" "#FFFFFF" """
import sys
def lin(c):
c /= 255
return c / 12.92 if c <= 0.03928 else ((c + 0.055) / 1.055) ** 2.4
def lum(hex_):
h = hex_.lstrip('#')
r, g, b = (int(h[i:i + 2], 16) for i in (0, 2, 4))
return 0.2126 * lin(r) + 0.7152 * lin(g) + 0.0722 * lin(b)
def ratio(fg, bg):
a, b = sorted((lum(fg), lum(bg)), reverse=True)
return (a + 0.05) / (b + 0.05)
if __name__ == '__main__':
fg, bg = sys.argv[1:3] if len(sys.argv) > 2 else ('#A3A9B3', '#FFFFFF')
r = ratio(fg, bg)
print(f'{fg} on {bg} = {r:.1f} : 1 ({"passes" if r >= 4.5 else "fails"} the 4.5 : 1 rule for body text)')
Run it on the draft's grey and on the darker grey from the reviewed page:
python contrast.py "#A3A9B3" "#FFFFFF"
python contrast.py "#5B6472" "#FFFFFF"
#A3A9B3 on #FFFFFF = 2.4 : 1 (fails the 4.5 : 1 rule for body text)
#5B6472 on #FFFFFF = 6.0 : 1 (passes the 4.5 : 1 rule for body text)
Body text needs 4.5 : 1, so the draft's grey fails at 2.4 : 1 and #5B6472 passes at 6.0 : 1. A tiny script, or any free checker, gives you this number in a second. Colour and contrast are explained further in Colour, Contrast and Dark Palettes.
4. Consistency: one radius, one gap
Compare the three cards at the top. The first has a 4 pixel radius, the second 16, and the third none at all. The padding and the gaps keep changing too. AI tools often do this, because each piece is generated on its own.
The fix is two variables, one radius and one spacing step, used by every card:
:root { --radius: 12px; --space: 12px; --muted: #5B6472; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space); margin-bottom: var(--space); }
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: var(--radius); padding: 10px 12px; display: flex; flex-direction: column; }
You don't need to memorise every CSS property. You need to know that variables like these exist, so you can ask the AI for them. That's the idea behind design tokens.
5. Labels: say what it does
The form buttons say Submit, OK and Click here. Read only the buttons and you can't tell what each one does. Which one deletes the account?
The reviewed version says it plainly: Save changes, Discard and Delete account. A good label is a verb and an object.
6. Focus: show the keyboard
Press Tab and the keyboard moves from button to button. In the draft the focus ring was switched off with outline: none, so keyboard users can't see where they are.
The reviewed version brings it back with :focus-visible, which shows a 3 pixel amber outline for keyboard users only. Mouse clicks stay clean.
button:focus-visible { outline: 3px solid #F59E0B; outline-offset: 2px; }
The same page, after the review

Nothing was redrawn. The content and the layout are the same; six small fixes made it ready to ship.
Let the AI run the checklist
You can hand the checklist to an AI assistant. Ask it to review first, without changing anything:
Review this page against six checks: hierarchy, empty and loading states, colour contrast (WCAG 4.5 : 1 for body text),
consistency of radius and spacing, button and link labels, and keyboard focus styles. List each problem with the exact CSS line
and the measured contrast ratio where it applies. Do not change anything yet.
Then ask it to fix only what it listed:
Fix only the problems you listed. Use CSS variables for the radius and the spacing, add an empty state and a skeleton loading state,
use specific button labels, and add a visible :focus-visible outline. Show the changed CSS only.
Finish by asking which of the six checks still fail, and check the contrast of every text colour yourself.
Quick recap
| Check | Problem in the draft | Fix |
|---|---|---|
| Hierarchy | Title and numbers the same size | 28px bold title, 32px numbers, small muted labels |
| States | Blank panels | Empty message with a next step, skeleton while loading |
| Contrast | #A3A9B3 on white, 2.4 : 1 | #5B6472, 6.0 : 1 |
| Consistency | Radius 4, 16 and 0 | --radius and --space |
| Labels | Submit, OK, Click here | Save changes, Discard, Delete account |
| Focus | outline: none | :focus-visible amber outline |
Look, measure, fix.
Try it yourself
Ask any AI tool for a small dashboard page, then run the six checks on it before you read its code. Measure every text colour with contrast.py. How many of the six did it get right on the first try?
Related course on Udemy
The Python Architect Masterclass: Full Stack to AI Engineer
Python, Django, FastAPI, React, Docker, AWS, LLMs, RAG, agents and MCP, from first steps to AI engineer.View on Udemy ↗: The Python Architect Masterclass: Full Stack to AI Engineer (paid course, opens in a new tab)Related posts
One Request, Two Answers: the Same Post as an HTML Page and as JSON
Ask a Django blog for the same post twice: once as a 12,731-byte HTML page built by a template, once as 2,976 bytes of JSON built by a serializer. Compare the headers, see who builds the page, and why the server still owns every write.
A Blog Design from a Prompt: Downloading Figma Make Code and Reading App.tsx and BlogCard.tsx
Make a blog design from a prompt in Figma Make, download src.zip, unzip it with Python's zipfile module, and read the two files that matter: App.tsx with its selectedPost state and BlogCard.tsx with its props.
How a Web Page Works: HTML Tags, Elements and Attributes
A web page is a text file full of labelled pieces. Learn tags, attributes and nesting with three tiny pages, and see what breaks when an attribute or a closing tag is wrong.
Semantic HTML: header, nav, main, aside and footer as Page Landmarks
The same page written as div soup and with semantic tags looks identical, but only one gives screen readers and search engines landmarks and an outline. Plus tables, div, span and the one-main rule.
