Blog

How to design UI with Claude Code before it writes code

Three ways to see a screen before Claude Code builds it. Plan and rules, an HTML mockup, or a drawn screen you comment on and approve.

To design UI with Claude Code before it writes code, ask for the screen first and tell it to wait. You can do that three ways: a written plan with rules, an HTML mockup, or a screen drawn in a design app that you comment on and approve. This guide walks through each one and ends with a table to help you pick.

Why Claude Code builds first

Ask for "a home screen for my language app" and Claude Code does what a coding agent does. It writes the code. You see the screen only after it's built, in a simulator or a browser. If the main button is in the wrong place, you write another prompt and wait for another build.

The agent isn't doing anything wrong. Nothing in the request told it to stop and show you first. So tell it.

The three routes below differ in what you get to look at before any code exists: words, a web page, or a picture of the screen.

Route 1: Plan and rules

This is the lightest route. It needs no new tools.

  1. Start in plan mode. Claude Code proposes what it will do and waits for your go before it changes files.
  2. Ask for the screen in words: "Describe the Home screen before you build it. List each part from top to bottom, what it says, and what happens when I tap it."
  3. Put what must hold on every screen in CLAUDE.md, the rules file Claude Code reads in your project: your colors, your font, your spacing, and the components that already exist.

What you get. A description you can correct in one message, and rules that carry over to the next session.

What you don't get. A picture. A list that reads fine can still look wrong once it's built, and you can't point at a button in a text file.

Use this route for small changes to screens that already exist.

Route 2: An HTML mockup

Ask Claude Code to write the screen as one plain HTML file first, with no app code.

Make mockups/home.html: a static mockup of the Home screen at phone width. Inline CSS, no framework, no app code. Stop there and wait for my feedback.

Open the file in a browser. Now you have something to look at. You can edit it yourself, try interactions in the browser, and commit it so Git keeps the history.

The limits show up in review:

  • Feedback goes through words. You name the element in chat ("the second card, the grey label") or attach a screenshot you marked up.
  • For iOS and Android, the mockup is a stand-in. The real screen gets written again in your app's own code. You check the build against the mockup yourself, side by side.
  • Going back means opening an earlier commit. The diff shows what changed in the source, not in the picture.

This route suits web apps, where the mockup is close to the real thing. The page HTML mockups or AgentDesign follows one change through both workflows.

Route 3: A drawn screen you review

Here Claude Code draws the screen in a design app. It doesn't describe it and it doesn't code it yet.

This is what AgentDesign is for. It's a Mac app where your coding agent draws each screen first. You point at what to change and approve it. Only then does the agent write code. Claude Code talks to the app through MCP, the standard way an AI agent plugs into a tool.

Connect Claude Code

  1. Install AgentDesign on an Apple silicon Mac with macOS 13 or later, and make a project.
  2. Open Settings → Agents and choose Connect my agents. The app lists every file it will change, backs each one up first, and changes none until you say yes. Remove undoes it.
  3. Start a new Claude Code session and ask: "List my AgentDesign projects." Your project should appear.

To connect by hand, run this in a terminal and restart Claude Code:

claude mcp add --scope user agentdesign -- "/Applications/AgentDesign.app/Contents/MacOS/agentdesign" mcp --root "<your designs folder>"

Help has the same lines for Codex, Cursor and other MCP clients.

Ask for the screen

Name the project and say what the screen is for. End with the sentence that matters:

Draw the Home screen for Sprout in AgentDesign: today's lesson, the list of units, and a Continue button. Wait for my feedback before writing code.

The screen appears in the app as a picture, before any code exists.

The Screens page in AgentDesign for Sprout, a language-learning app. Six screens drawn by the agent, each marked Needs review: Home, Lesson question, Pick a language, Profile, Progress and Welcome.

Comment on the exact spot

Something's off? Don't describe where it is. Point at it.

Choose Pin a Point and click the part you want to change, or choose Mark an Area and drag around it. Write one request and choose Post.

On Sprout's Home screen, the comment pinned on Continue says: "Continue is why people open the app. Put it at the top, above the unit list." Claude Code changes the design and replies in the same thread: "Moved Continue into the top card under Unit 3, so it's the first thing you can tap."

Sprout's Home screen in AgentDesign with a comment pinned on the Continue button. In the Comments panel, Claude Code's reply is marked "Addressed in r0002", with Resolve and Reply buttons.

Claude Code can be told about new comments as they arrive when you start it with the command shown in Settings → Agents. Otherwise, ask it to read the open comments on the screen.

Approve, then build

Before you say yes, look at what changed.

Open the screen's Revisions and use Compare beside the earlier revision. You see before and after side by side, with the change outlined. If the agent touched something you didn't ask for, this is where you catch it.

Two revisions of Sprout's Home screen side by side in AgentDesign. In the newer one, Continue sits in a card at the top and the change is outlined. A note from Claude Code explains the move.

Then:

  1. Choose Resolve on the comment when the change is right. Only you can resolve it.
  2. Mark the design Approved. Only you can approve.
  3. Tell Claude Code it can write the code.

After the build, ask Claude Code to screenshot the running app from a simulator, an emulator or your local web build. AgentDesign puts that screenshot beside the design and marks the differences. Every earlier revision stays, so you can go back to any of them.

Which route when

Plan and rulesHTML mockupDrawn screen
What you look atA descriptionA web pageA picture of the screen
How you give feedbackChatChat, a marked-up screenshot, or your own editA comment pinned on the element
HistoryRules file in GitGit commitsEvery revision kept, compare any two
Checking the buildBy eyeSide by side, by handScreenshot beside the design, differences marked
Extra toolNoneNoneAgentDesign, on a Mac
SuitsSmall changesWeb appsiOS, Android and web apps with many screens

The routes stack. A rules file works well alongside a drawn screen: the rules tell Claude Code what not to touch, and the drawing shows you the screen before it's built.

A short checklist

  • Say "wait for my feedback before writing code" in the first prompt.
  • Do one screen at a time until the look is settled.
  • Ask for one change per comment.
  • Compare the new revision with the old one before you approve.
  • Say "approved, build it" in so many words.
  • Check the built screen against what you approved.

Try route 3

AgentDesign's free demo has every feature for one project and two versions, with no account and no time limit. A license is $29, paid once. Review your first screen takes you from install to an approved design, and How it works shows how the agent, the app and your files fit together.