Building with AI Coding Agents · Course book
Chapter 2: Designing Interfaces That Look Deliberate
Ask an AI tool for a website with a one-line request and you tend to get the same thing every time: a centred headline, a purple gradient, three cards in a row and a generous scattering of icons. It works, and it looks like a thousand other pages. That generic, unfinished quality has earned the nickname "AI slop". The cause is not that the tools cannot do better. It is that they were given nothing to aim at. This chapter explains why the default output is bland and sets out the design systems and working process that produce an interface that looks deliberate.
Why the default output looks generic
A language model produces the most likely continuation of what it has been given. With a vague request there is very little to continue from, so the model falls back on the most common patterns in the many pages it learned from. The average of everything is, by definition, unremarkable.
There is a second cause. Polish in an interface comes from consistency: the same few sizes, spacings and colours used everywhere. An agent building a page piece by piece, with no shared rules, chooses each value afresh. One heading is 28 pixels and the next is 30; one gap is 14 pixels and another is 18. No single choice is wrong, yet the eye registers the lack of system as cheapness.
Both causes point to the same cure. Before any interface is generated, the agent needs two things: a clear description of what is being built, and a set of design rules to build it with.
Start with a specification
The first step involves no visuals at all. In a discovery session you reverse the usual direction and have the AI interview you. Instead of you guessing what to tell it, it asks: who is this for, what must a visitor be able to do, what data appears on each screen, what happens when there is no data, when something is loading, when something fails? Your answers are written into a specification, a document that later prompts can refer to.
The questions about awkward states matter most. A design that only considers the perfect case, with full data and short names, breaks on first contact with reality. Table 2.1 lists the states every screen should account for.
| State | Question to answer | Typical treatment |
|---|---|---|
| Empty | What appears before there is any data? | A short explanation and a clear first action |
| Loading | What appears while data is on its way? | Placeholder shapes where the content will be |
| Error | What appears when something fails? | A plain message and a way to try again |
| Overflow | What if a name is very long or a list has 500 items? | Truncation, wrapping or pagination, chosen on purpose |
| Small screen | How does it rearrange on a phone? | Columns stack; navigation collapses |
Starting from a proven structure helps as well. Established products have already solved common layout problems such as dashboards, pricing pages and settings screens, and open-source component libraries provide well-built buttons, menus and tables. Studying how a good dashboard arranges its navigation, summary figures and detail, and building on a component library, gives the agent a sound skeleton. The aim is to learn from structure and patterns. Another product's branding, artwork and wording are theirs and should never be copied.
Design tokens: the rules behind polish
The design rules are best expressed as design tokens: named values for size, space and colour, defined once and used everywhere. When the agent is told to use only tokens, consistency follows automatically. Three systems do most of the work.
A type scale
Instead of picking font sizes one at a time, choose a base size and a ratio, and multiply. With a base of 16 pixels and a ratio of 1.25, each step is the previous size multiplied by 1.25.
- 16 × 1.25 = 20
- 20 × 1.25 = 25
- 25 × 1.25 = 31.25
- 31.25 × 1.25 = 39.06
Rounded, the scale is 16, 20, 25, 31 and 39 pixels: body text, then four levels of heading. Because every size is related to the others by the same ratio, the page has a visual rhythm, in the same way that notes in a musical scale belong together.
A spacing scale
The same discipline applies to the gaps between things. A common system uses multiples of 4 pixels: 4, 8, 12, 16, 24, 32, 48 and 64. Every margin and every gap must be one of those values. Small values separate items that belong together and large values separate sections, so the spacing itself tells the reader how the page is organised.
Colour and contrast
Restraint matters here too: one neutral family for text and backgrounds, one accent colour for the things a visitor can act on, and a few reserved colours for success, warning and error. Text must also be readable, and this can be measured. The contrast ratio compares the brightness of text with that of its background, and runs from 1 to 1, meaning identical colours, up to 21 to 1 for pure black on pure white. Accessibility guidelines ask for at least 4.5 to 1 for ordinary text and 3 to 1 for large text.
The ratio is (L1 + 0.05) ÷ (L2 + 0.05), where L1 is the relative brightness of the lighter colour and L2 that of the darker, each on a scale from 0 for black to 1 for white. For black text on white this gives (1 + 0.05) ÷ (0 + 0.05) = 1.05 ÷ 0.05 = 21. A mid-grey with a brightness of 0.18 on white gives 1.05 ÷ 0.23 = about 4.6, which only just passes. A paler grey at 0.40 gives 1.05 ÷ 0.45 = about 2.3 and fails, however elegant it looks. Pale grey text is one of the most common faults in generated designs, and one of the easiest to check.
Explore several directions, then choose
With a specification and tokens in place, the agent can build a first working version. It will be sound in structure and plain in style, which is the right order: structure first, appearance second.
Now comes the step that most separates a designed result from a generated one. Rather than accepting the first look, produce several and compare. Git supports this through worktrees, which let one project have several branches checked out in separate folders at the same time. You can ask for three distinct visual directions, each in its own worktree: perhaps one quiet and editorial, one dense and data-heavy, one bold and high in contrast. Because each lives in its own folder they do not interfere, and you can open them side by side.
Comparison is easier than invention. Few people can describe the design they want in the abstract, but almost everyone can look at three options and say which is best and why. The winner is merged, useful ideas from the others are borrowed, and the rest are discarded at no cost.
Motion, performance and release
Movement is the final layer, and it is easy to overdo. Good motion has a purpose: it shows where something came from, draws attention to a change or gives feedback on an action. Short durations, roughly 150 to 300 milliseconds, feel responsive; longer ones feel sluggish. One popular effect links an animation to scrolling, so that it advances as the visitor moves down the page.
Three checks keep motion from doing harm.
- Weight. Video and large images are the heaviest things on a page. Compress them, and load them only when they are about to come into view.
- Preference. Some people find movement uncomfortable, and their devices offer a "reduce motion" setting. A well-made site honours it by replacing animations with simple fades or nothing at all.
- Content first. The page must be usable before any animation has loaded and if it never loads.
The last step is release. A site made of static files can be published on a hosting service that copies it to servers around the world, so it loads quickly everywhere. Before calling it done, test on a real phone, on a slow connection, and with the keyboard alone. An agent can build the page, but only a person can judge whether it feels right.
Practice tasks
- Build a type scale from a base of 18 pixels with a ratio of 1.2, giving the first four steps above the base. (Answer: 21.6, 25.92, 31.1 and 37.32, or 22, 26, 31 and 37 when rounded.)
- A page uses gaps of 6, 10, 14, 18 and 30 pixels. Replace each with the nearest value from the 4 pixel spacing scale in this chapter. (Answer: 4 or 8, 8 or 12, 12 or 16, 16 and 32.)
- Text has a relative brightness of 0.10 and its background 0.80. What is the contrast ratio, and does it pass for ordinary text? (Answer: 0.85 ÷ 0.15 = about 5.7, which passes.)
- Choose any screen in an app you use and write down what it shows in its empty, loading and error states.
- Write five questions an AI should ask you in a discovery session for a personal portfolio site.
- Describe three contrasting visual directions you would ask for when exploring a design for a local bakery's website.
This course book is available to read online only at tech-academy.chrysolites.org.