DESIGN.md for iOS: Give Your AI Coding Agent a Design System
Ask an AI coding agent for "a paywall screen" and you'll get something that works and looks like every other AI-built app: system blue, default spacing, a gradient nobody asked for. The model isn't bad at design. It just has nothing to design to. Every screen is a fresh guess.
A DESIGN.md fixes that. It's a plain-text design system that lives in your repo, next to the code, where agents already look. They read it before building UI, and every screen comes out in the same visual language.
What is a DESIGN.md?
A DESIGN.md is a Markdown file with two parts:
- Design tokens in YAML front matter: colors for light and dark mode, type styles, spacing, corner radii, shadows and motion. These are exact values an agent can copy into code.
- Written rules in the body: what the style feels like, how components behave, and a list of do's and don'ts. These cover the judgment calls tokens can't, like "one accent color per screen" or "numbers are the hero on finance screens".
Because it's just a file, it works with any tool that reads your repository: Claude Code, Cursor, Codex, Windsurf, Copilot. Tools such as Claude Design and Google Stitch can import it directly.
What goes in one for SwiftUI
Here's the start of the front matter from Ledger, one of Effect UI's styles for finance and productivity apps:
---
name: Ledger
description: Calm, precise finance. Warm paper and ink, hairline rules,
tabular numerals as heroes and one deep green accent.
colors:
primary: "#0E5C46"
on-primary: "#FFFFFF"
positive: "#0E7A4F"
negative: "#C23B22"
light:
surface: "#F4F1EA"
surface-raised: "#FBF9F4"
on-surface: "#17160F"
on-surface-variant: "#5E5A4E"
rule: "#17160F1F"
dark:
surface: "#111110"
surface-raised: "#1A1A18"
on-surface: "#EDEAE0"
on-surface-variant: "#A8A495"
rule: "#EDEAE01F"
typography:
numeral-display:
fontFamily: SF Pro
fontSize: 48px
fontWeight: 600
letterSpacing: -0.03em
fontFeature: tnum
headline-lg:
fontFamily: SF Pro
fontSize: 28px
fontWeight: 600
---A few things make tokens work well for an agent:
- Semantic names, not raw colors.
on-surface-varianttells the agent where a color goes;#5E5A4Edoesn't. - Light and dark values side by side, so dark mode is designed, not inverted.
- Type as named roles (
numeral-display,headline-lg) that map onto SwiftUIFontvalues. - A closed spacing scale, for example 4, 8, 12, 16, 24, 32, so the agent can't invent 13 points.
The body then explains the style in prose, describes each kind of component (buttons, cards, lists, inputs, empty states) and ends with do's and don'ts. Ledger's read:
## Do's and Don'ts
- Do right-align numbers and use tabular figures everywhere.
- Do separate with rules and whitespace instead of boxes.
- Don't use gradients, glows, glass, emoji or illustrations.
- Don't use colour for decoration. Colour means action (green) or sign (positive/negative).
- Don't centre-align body content. Only onboarding hero text may be centred.The best DESIGN.md files finish with a short implementation section for the target platform, so the agent knows how to build the rules in SwiftUI: for example, that hero numbers use .monospacedDigit() and that hairline rules are Rectangle().frame(height: 0.5).
Making the agent actually follow it
A file in the repo is a start; it works better when the agent is told to use it and has examples to copy.
1. Point to it from your agent instructions. In CLAUDE.md, AGENTS.md or Cursor rules, add one line: "Read DESIGN.md before writing any UI and follow it exactly."
2. Turn tokens into code once. Have the agent write a single Theme.swift from the DESIGN.md, with colors, fonts, spacing and shared components, and use it everywhere. Then the design lives in one place in code too. (More on that in design tokens in SwiftUI.)
3. Give it reference screens. Agents imitate. Five finished screens in the style (onboarding, home, paywall, profile, settings) teach layout and rhythm faster than any rule.
4. Package it as a skill. A Claude Code skill bundles the DESIGN.md, Theme.swift and reference screens with short instructions, and the agent loads it whenever it builds UI.
5. Make it check its work. End every UI task with "compare the screen to DESIGN.md's do's and don'ts and check light and dark mode." It catches most drift.
Why not just a Figma file?
Figma is great for people. Agents can't reliably read a Figma file from your repo, and even when they get an export, pixel values without intent lead to rigid, brittle layouts. DESIGN.md is the part of a design system an agent can use: exact values plus the reasoning behind them.
Get one that's already been tested
Writing a good DESIGN.md takes a designer and a lot of iteration. Effect UI's design styles are original, finished DESIGN.md files for iOS, each with a Claude Code skill, a Theme.swift and five reference screens, and each tested by having AI generate and compile real apps from it. Ledger is free.