Reference-Driven Design: Extract a DESIGN.md From a Site You Admire and Build From It
Turn 'make it nice' into a target: pick a reference page, copy its exact colours, type, spacing, radius and motion into DESIGN.md, and have the agent build a new Today page from only those values.
What you will learn
- Explain why a reference beats 'make it nice' as a brief for an AI agent
- Pick the reference that fits a brief and say why
- Extract colour, type, spacing, shape and motion values into a short DESIGN.md
- Build a new page that uses only the values in that file, and check it
Before you start
- Why AI-Built Websites All Look the Same, and Four Levels That Fix It
- Basic HTML and CSS custom properties
Walk into a tailor shop and say "make me something that looks nice". One jacket comes out purple and round, the next blue and sharp, the third orange and loud. Four requests, four guesses, and nothing belongs together. Now hand the tailor a photo of a jacket you love and say "like this". Every piece comes out in the same style.
An AI agent building UI works the same way. "Make it nice" gets you a different guess each time. A good reference turns it into a target the agent can match. The method in this article: pick a site you admire, pull its colours, type, spacing, radius and motion into one file called DESIGN.md, and make every page follow that file.
A folder of strong references
Keep a small folder of reference pages the agent can read. The project has three, each in a clearly different style, with every value as a variable in :root:
| Paper | Night | Soft | |
|---|---|---|---|
| Feel | calm, printed | dark, technical | round, playful |
| Page colour | #FAF6EE | #0B0F14 | #FFF1F5 |
| Accent | --brand: #1F4E3D | --accent: #B6F24A | --brand: #7C5CFF |
| Type | Georgia serif headings | Consolas monospace | Trebuchet MS |
| Spacing unit | 8px | 4px | 8px |
| Radius | 4px | 10px | 28px |
| Motion | 200ms ease-out | 120ms, glow on hover | 350ms, bouncy curve |
Three pages, three very different styles. The folder is your library.
Let the agent pick one
The brief is one line: a calm task app for students. The prompt asks the agent to look at the three references, pick the one that fits, and say why in two lines. The reasoning in the lecture went like this:
- Paper: calm and printed, easy to read for hours. Yes.
- Night: dark and technical, too heavy for students.
- Soft: round and playful, too childish for a study app.
The agent matches the feel of the brief and explains its choice. You can always disagree and pick another.
Five things to pull out
:root, not guessed.Once Paper is chosen, the agent reads references/paper.html and writes five things down, copying the exact values from its :root block:
- Colour: six values, the page, the card, the ink, the muted text, the line and the brand colour.
- Type: serif headings, a system font for the body, and a short list of sizes. Too many sizes is how a page starts to look messy.
- Spacing: one base unit of 8px, used as 8, 16, 24 and 48.
- Shape: small 4px corners, thin borders, no shadows.
- Motion: fast and quiet, 200ms ease-out, and a card lifts 2px on hover.
The real DESIGN.md
# DESIGN.md - Paper
Source: references/paper.html
Feel: calm, printed, trustworthy
## Colour
- page: #FAF6EE
- card: #FFFFFF
- ink: #1F1B16
- muted: #6B6257
- line: #E4DCCB
- brand: #1F4E3D
## Type
- headings: Georgia, serif, bold
- body: system-ui, 18px / 1.6
- sizes: 16, 18, 20, 24, 56
## Spacing
- base unit: 8px (use 8, 16, 24, 48)
## Shape
- radius: 4px
- borders: 1px solid line, no shadows
## Motion
- 200ms ease-out
- hover: lift 2px, links underline slides in
## Rules
- Use only these values.
- Brand colour for the one main action only.
:root.The file is short and exact, and that is a good thing: the agent reads it every single time. The Rules section tells it what not to do. Use only these values, and the brand colour is for the one main action only.
One page, built from the file
Now a brand-new page, a task list rather than a landing page. The prompt:
Build a Today page: a nav, a heading, three tasks with checkboxes and an Add a task button. Follow DESIGN.md exactly. Put every value from DESIGN.md in :root of styles.css and use only those variables. Do not invent a new colour, size or radius.
The agent's stylesheet, ex02-built-from-design/styles.css, puts exactly those values in :root and uses only them:
:root {
--page: #FAF6EE;
--card: #FFFFFF;
--ink: #1F1B16;
--muted: #6B6257;
--line: #E4DCCB;
--brand: #1F4E3D;
--font-head: Georgia, "Times New Roman", serif;
--font-body: system-ui, "Segoe UI", sans-serif;
--space: 8px;
--radius: 4px;
--speed: 200ms ease-out;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font: 400 18px/1.6 var(--font-body); }
nav { display: flex; align-items: center; gap: calc(var(--space) * 3); padding: calc(var(--space) * 3) calc(var(--space) * 6); border-bottom: 1px solid var(--line); }
nav b { font: 700 24px var(--font-head); margin-right: auto; }
nav a { color: var(--ink); text-decoration: none; background: linear-gradient(var(--brand), var(--brand)) 0 100% / 0 2px no-repeat; transition: background-size var(--speed); }
nav a:hover { background-size: 100% 2px; }
main { padding: calc(var(--space) * 5) calc(var(--space) * 6); max-width: 860px; }
h1 { font: 700 56px/1.1 var(--font-head); margin: 0 0 var(--space); }
main > p { color: var(--muted); font-size: 20px; margin: 0 0 calc(var(--space) * 3); }
.task { display: flex; align-items: center; gap: calc(var(--space) * 2); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: calc(var(--space) * 2) calc(var(--space) * 3); margin-bottom: var(--space); transition: transform var(--speed); }
.task:hover { transform: translateY(-2px); }
.task input { width: 20px; height: 20px; accent-color: var(--brand); }
.task span { flex: 1; }
.task small { color: var(--muted); font-size: 16px; }
.btn { display: inline-block; margin-top: calc(var(--space) * 2); background: var(--brand); color: #fff; border: 0; border-radius: var(--radius); padding: calc(var(--space) * 1.5) calc(var(--space) * 3); font: 600 16px var(--font-body); transition: transform var(--speed); }
.btn:hover { transform: translateY(-2px); }
The colours come from the file, the corners and spacing match, and hovering a task card or the button lifts it 2px in 200ms. The heading is serif and the nav is quiet, just like Paper. Nav links get an underline that slides in, the same effect the reference uses. It is a new page, and it feels like the reference.
Finish with a check prompt: Check the page against DESIGN.md and list every value that is not in the file. Fix any hit.
Exercise: recreate a reference 1:1
- Open it. Pick a reference, say Night, and look at it closely.
- Rebuild it. Ask the agent to build the same page with new HTML and CSS, no copying the file.
- Compare. Put both pages side by side and check spacing, size, colour and motion.
- Fix. Ask for a list of every difference and fix them until the two match.
Matching a page exactly trains your eye. After two or three tries you start to see details like a missing 2px of spacing, and that is a real design skill.
Common mistakes
- Describing the feel instead of copying values. "Warm and calm" is a guess.
#FAF6EEis a target. - A long DESIGN.md. The agent reads it every time; keep it short and exact.
- No rules section. Without "use only these values", the agent adds a new grey or a new radius on page three.
Quick recap
| Step | What you do |
|---|---|
| Pick | Choose the reference that fits the brief, and say why |
| Extract | Copy colour, type, spacing, shape and motion into DESIGN.md |
| Rule | Use only these values; brand colour for the main action only |
| Follow | Every new page puts the file's values in :root and uses only them |
| Check | Ask for every value not in the file, and fix it |
These are foundations; with AI you can generate the rest, but these steps let you check what it gives you. The reference pages, DESIGN.md and sample prompts are in the StudyEasy AI Community, free to join.
StudyEasy AI Community
Learn AI engineering, share what you build, and connect with other learners.
Free resources: lesson files, notebooks and code
Ask questions and join engineering discussions
Meet real people learning and building with AI
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.
