Screenshot or Code: What to Give Claude Code and Cursor to Rebuild a Design
A screenshot shows an AI what a design looks like. Code tells it what the design is. The difference shows up in every padding value.
Last updated:
8 min read time. Summarize with:
This article coversWhat an AI Loses When You Give It a Screenshot
- What an AI Loses When You Give It a Screenshot
- When a Screenshot Is Still the Right Input
- How to Give Your AI the Code of Any Section
- A Prompt That Keeps the AI on Track
- The Same Rule Applies to Animations
- Screenshot vs Code at a Glance
- Why AI Models Guess When They Only See Pixels
- How Much Code Should You Give the AI?
- Matching the Export to Your Stack
- How to Iterate When the First Result Is Off
- Learning From a Design vs Copying It
- Example: Rebuilding a Pricing Section With Claude Code
- Key Terms
- Key Takeaways
- Frequently Asked Questions
To get Claude Code, Cursor or ChatGPT to rebuild a design accurately, give it the section's code, not just a screenshot. From a picture the model estimates every gap, font size and color, and small errors compound into a page that looks close but wrong. Exported code carries the exact values, breakpoints and hover states. Use screenshots for inspiration and code for reproduction, and keep the screenshot next to the code as a visual check.
What an AI Loses When You Give It a Screenshot
Text is the detail people forget. When a model reads text back from an image, long paragraphs get shortened and special characters break. In code, the copy is already there.
When a Screenshot Is Still the Right Input
Screenshots communicate intent well: "make it feel like this", "use this kind of layout". When you want inspiration, a screenshot is enough. When you want a specific section reproduced, give the code and keep the image as a reference.
How to Give Your AI the Code of Any Section
- 1Select the section
Turn Design Toolkit on with Alt + R and click the section, for example a pricing table.
- 2Open Export code
Press O. The Export card shows a live copy of the section.
- 3Pick the format your project uses
Tailwind, HTML, React, Vue or Elementor.
- 4Check the match
The copy is measured against the page element by element and scored as a percentage. Try it on Phone, Tablet and Desktop.
- 5Paste it into your AI
Claude Code, Cursor, ChatGPT or Gemini, with a short instruction.
A Prompt That Keeps the AI on Track
Here is the exact code of a pricing section from a live page.
Rebuild it in this project:
- use our existing Button and Card components
- keep the spacing, font sizes and colors from the code
- keep the hover states and the mobile layout
- replace the copy and the logo with ours
The last line matters: the goal is to learn from a layout, not to ship someone else's content.
The Same Rule Applies to Animations
A screen recording cannot tell an AI whether an animation is an ease-out or a spring, or whether it lasts 300 or 450 milliseconds. Design Toolkit's animation inspector copies a brief with the duration, easing curve, keyframes and hover values. See how to copy an animation from a website.
Screenshot vs Code at a Glance
| Goal | Give the AI |
|---|---|
| "Something like this" | A screenshot |
| This exact section, rebuilt | The exported code |
| This animation, with the same feel | An animation brief with timing and easing |
| Check the result | The screenshot, next to your build |
Why AI Models Guess When They Only See Pixels
Vision models are good at recognizing what is on a screen: a pricing table, three cards, a dark hero. They are much weaker at reading exact measurements from pixels. A 24 pixel gap and a 20 pixel gap look almost the same in a compressed screenshot, two greys that differ by a few values are indistinguishable, and font identification from letter shapes is unreliable even for experienced designers. The model fills those gaps with sensible defaults, which is why AI rebuilds from screenshots often look generic: they drift toward the most common values the model has seen, not toward the values of your design.
Code removes the guessing. When the input says padding: 24px 32px and font-family: "Inter", the model has nothing to estimate and can spend its effort on adapting the section to your project instead.
How Much Code Should You Give the AI?
More is not always better. A whole page of exported code can exceed what an AI tool reads carefully, and long inputs make it more likely that the model skips details. Work section by section:
| Input size | What works well |
|---|---|
| One component (a button, a card) | Exact reproduction, quick iterations |
| One section (hero, pricing, footer) | The best balance of context and accuracy |
| A whole page | Overview and structure, less precise details |
For a full page, export and rebuild one section at a time, then ask the AI to connect them. You get the accuracy of small inputs with the result of a full page.
Matching the Export to Your Stack
The closer the input is to your stack, the less the AI has to translate, and every translation step is a chance to lose detail. If your project uses Tailwind, export Tailwind; if it uses React components, export React. For a project with its own design system, tell the AI explicitly which components and tokens to use, so it maps the exported values onto your system instead of hard-coding them.
How to Iterate When the First Result Is Off
Even with exact code, the first result may miss something: a hover effect, a breakpoint, an image crop. Do not describe the problem vaguely. Measure it and say it precisely: "the gap between the heading and the paragraph should be 16 pixels, not 24" works much better than "the spacing looks off". Precise feedback is the same advantage code gives you at the start, applied to every round of changes.
- Compare the result and the original at the same width.
- Name the element and the property that differ.
- Give the exact target value, read from the exported code or measured on the page.
Learning From a Design vs Copying It
Exporting the code of a section you admire is a good way to learn how it was built, and rebuilding a layout pattern is normal practice in web design. Shipping someone else's copy, brand assets, photography or licensed fonts is not. A good rule: keep the structure and spacing ideas, replace everything that identifies the original brand, and make sure the final section serves your own content and users.
Example: Rebuilding a Pricing Section With Claude Code
A typical session goes like this. You export a three-tier pricing section as Tailwind and paste it into Claude Code with the prompt from earlier in this article. The first result matches the layout, spacing and colors, and uses your Button component. One thing is off: the highlighted middle tier lost its slightly larger shadow on hover. You measure it on the original page, tell the AI the exact value, and the second result matches. Compare that with a screenshot-based attempt, where the first result usually needs several rounds of "make the gap bigger" and "the font is wrong" before it looks right.
| Round | From a screenshot | From exported code |
|---|---|---|
| First result | Layout right, values approximate | Layout and values right |
| Corrections needed | Spacing, fonts, colors, states | Usually one detail |
| Typical rounds | Several | One or two |
Key Terms
- Exported code: the section's markup and styles, read from the rendered page.
- Design tokens: named values such as colors and spacing that your project reuses.
- Match score: how closely an exported copy lines up with the original, measured element by element.
Key Takeaways
- A screenshot shows the look; code carries the exact values, breakpoints and states.
- Give AI coding tools one section at a time, exported in the format your project uses.
- Use a short prompt that names your components and says what to replace.
- When something is off, give the exact value instead of describing it.
- Keep the structure ideas, replace the brand, copy and images.
Code in, accurate rebuild out, usually in one or two rounds instead of many.
Frequently Asked Questions
Can Claude Code or Cursor rebuild a design from a screenshot?
They can get close, but they have to estimate spacing, fonts and colors. Giving them the exported code of the section provides the exact values.
Which code format should I export for my AI?
The one your project uses: Tailwind for Tailwind projects, React or Vue for component projects, HTML for anything else.
Does the exported code include hover states and the mobile layout?
Yes. The export keeps the page fonts, breakpoints and hover states, and you can preview it on phone, tablet and desktop before copying.
Is it fine to rebuild another website's design?
Studying a layout is normal practice. Replace the copy, logos, images and licensed fonts with your own before shipping.
Why do AI-generated designs look generic?
When the input is a screenshot, the model fills unknown values with common defaults. Giving it exact code removes the guessing and keeps the original details.
Should I give the AI a whole page or one section?
One section at a time gives the best accuracy. Rebuild sections separately, then ask the AI to connect them.

