Source: ViewEdit

Tighten an AI-built site

You already have a site the agent built, and the pages work. They still look like a sequence of prompts: radii disagree, every block is a card, and empty areas are icons in rounded squares.

This is a how-to for that site. A tutorial would walk you through building one small page from an empty folder so you learn the contract. That lesson is not written yet. Why the drift happens is Constrained AI web design. The token names and banned patterns are AI site design contract.

Lock the contract before the next prompt

  1. Add a theme file the agent must read (THEME.md, or the CSS variables themselves).

  2. Define semantic tokens for surface, border, text, space, and radius. Use the names in the contract.

  3. Tell the agent to audit JSX and CSS and replace raw palette utilities (bg-slate-800, text-gray-500) and one-off spacing with those tokens.

  4. Keep one or two radii for the whole site. A new feature uses the existing radius.

Until this file exists, every later prompt is allowed to invent a new gray.

Separate sections with surface and space

  1. Walk each page and mark nested cards: a bordered, shadowed box inside another bordered, shadowed box.

  2. Remove about half of those borders and drop shadows.

  3. Separate the sections that remain with a background change (--surface-primary against --surface-muted) and with whitespace from the spacing scale.

  4. Leave a border where the user must see a boundary (a dialog, a selected row, a table). A paragraph does not need one.

Set type before you add color

  1. Tighten heading tracking. Large headings on marketing pages usually want tracking-tight or the equivalent in your scale.

  2. Pair a geometric sans for UI text with a monospace for metadata, dates, and tags. Geist, Plus Jakarta Sans, and JetBrains Mono are examples of that pairing. Self-host the files you actually ship.

  3. Prefer weight, size, and a muted text token over a new badge color for every status.

  4. Check contrast for body text and for the muted token. A gray that looked fine on one card often fails once the card border is gone.

Prompt from a picture of one section

Describing a look in a paragraph hands the model the same defaults you are trying to leave.

  1. Pick one section from a site whose spacing you want (a timeline, a settings row, a file tree).

  2. Capture that section only.

  3. Ask the agent to rebuild your component using the spacing scale, border opacity, and type hierarchy in the image.

  4. Name the component and the data it must keep. The screenshot constrains the visuals. Your data model constrains the content.

Show the product

When a section is about the product, depict the product: a file list, a diff, a chat transcript, a stylized window.

  1. Replace abstract icon tiles in those sections with a small CSS replica of the real UI.

  2. Keep the replica on the same tokens as the rest of the page.

  3. Use an icon when the control is an icon (a button, a nav item). A hero does not have to be a glowing square with a generic glyph.

Run one polish pass

After the tokens are in place, take the repo through a single tightening pass. Scaffolding can stay. The pass is allowed to delete.

  1. Align padding to the spacing scale.

  2. Check one narrow viewport and one wide viewport for each template.

  3. Unify font weights so a label is not medium on one page and bold on the next.

  4. Remove wrapper divs that only existed to hold a card style you deleted.

Stop when a new screen can be built by pointing at the theme file and an existing section. That is the condition the next prompt should meet.