CC '26
All Chapters

PART I: FOUNDATIONS & CORE SKILLS · SECTION 04

The Art of Prompting for Design

How to communicate visual intent to an AI that thinks in code

Reading time

19 min

The Art of Prompting for Design

How to communicate visual intent to an AI that thinks in code

Good design prompts translate visual intent into structured instructions. This chapter is the one you will come back to. It covers how design prompts differ from code prompts, maps design concepts to their CSS equivalents, gives you copy-paste prompt templates for common tasks, and names the patterns and antipatterns that determine whether your output is great or generic.

You already think in design language: hierarchy, contrast, rhythm, whitespace. Claude Code thinks in code: flexbox, padding, color values, z-index. The prompt is your translation layer between these two worlds. The better you translate, the better the output.

4.1 Why Design Prompts Are Different

Why Design Prompts Are Different

Prompts for visual design outcomes require a different approach than prompts for code functionality. The gap between "I want it to feel premium" and actual CSS properties is wider than most people expect.

A coding prompt asks for a function that does something. The output either works or it does not. A design prompt asks for visual qualities: spacing, color, hierarchy, mood. The output exists on a spectrum from generic to precise. The difference matters because Claude has a default aesthetic it falls back to when instructions are vague.

Generic AI design output often drifts toward a polished but familiar house style: soft backgrounds, large type, warm accents, rounded cards. This is not bad. It is what happens when you have not specified a stronger system. The more concrete your instructions, the more you override generic defaults.

Design prompt with concrete constraints

"Build a pricing card with a dark background (#0A0A0A), gold accent (#E8C547), and 'Space Grotesk' at 700 weight for the heading. 12px border radius. 24px internal padding. Shadow: 0 4px 12px rgba(0,0,0,0.08). Three pricing tiers in a row on desktop, stacking on mobile."

Design prompt with subjective language

"Build a pricing section that looks modern and premium. Use a nice color scheme. Make the cards stand out."

The second prompt produces output. It might even look decent. But it will not match your design intent, because "modern" and "premium" and "nice" mean something different to Claude than they do to you. The first prompt leaves no ambiguity. Every visual decision is specified or delegated intentionally.

The specificity spectrum

You do not need to specify every pixel. The right level of specificity depends on your goal. If you want Claude to explore, give a loose direction and let it propose options. If you want Claude to match a specific design, give exact values. Most productive prompts sit in the middle: specific about what matters (colors, layout, typography) and open about what does not (exact shadow values, transition timing).

4.2 The Design-to-Code Translation Layer

The Design-to-Code Translation Layer

Designers and CSS speak different dialects of the same language. Learning the mapping between design concepts and CSS properties is the single most effective way to improve your prompts.

You do not need to learn CSS syntax. You need to learn the vocabulary — the property names that Claude uses to construct layouts. Think of it like learning enough of a language to give directions. You are not writing a novel. You are saying "turn left at the corner."

Design Concept CSS Property Designer Analogy Example Prompt Phrase
Whitespace / Breathing room padding, gap, margin Figma auto-layout item spacing "Generous padding: 32px section gaps, 64px between sections"
Visual hierarchy font-size, font-weight, line-height Type scale in your character styles "Headlines 48px/700, body 16px/400, 1.6 line-height"
Alignment / Grid display: grid, display: flex Figma layout grid with columns "12-column grid, max-width 1200px, content centered"
Color system --color-primary, --color-bg Figma color styles / variables "Use CSS variables: --primary: #2563EB, --bg: #FFFFFF"
Depth / Elevation box-shadow, z-index Layer order and shadow in Figma "Cards: shadow 0 4px 12px rgba(0,0,0,0.08)"
Rounded corners border-radius Corner radius in Figma frame settings "8px radius on cards, 4px on buttons, 9999px for pills"
Responsive breakpoints @media (min-width: 768px) Responsive resize constraints "Stack below 768px, 2-column at 768px, 3-column at 1024px"
Transitions / Motion transition, @keyframes Figma prototype interaction animations "All transitions 200ms ease-out. Hover: scale(1.02)"
Opacity / Overlay rgba(), opacity, backdrop-filter Fill opacity and blur in Figma "Semi-transparent overlay: rgba(0,0,0,0.5), blur 4px"
Text truncation overflow: hidden, text-overflow: ellipsis Text clipping with "..." in Figma "Single line truncated with ellipsis"

This table is your Rosetta Stone. When you want to communicate a design concept to Claude, find the concept in the left column and use the phrase from the right column in your prompt. You do not need to memorize CSS syntax. Claude handles that. You need the vocabulary.

My Take

Learning a handful of CSS layout concepts — flexbox, grid, padding, margin — will improve your prompts more than any prompting trick. These are the building blocks Claude uses to construct layouts. Knowing their names lets you speak Claude's language. You do not need to master CSS. You need to know what the properties are called and what they control. That is enough.

Claude mirrors whatever CSS approach your project already uses. If your project has Tailwind, Claude writes Tailwind classes. If it has CSS Modules, Claude writes CSS Modules. If it has vanilla CSS with custom properties, Claude writes vanilla CSS. This means you can specify the approach in your prompt if it matters: "Use Tailwind classes matching the existing components" or "Write vanilla CSS in a style tag."

4.3 Prompt Patterns for Common Design Tasks

Prompt Patterns for Common Design Tasks

These templates are tested and ready to copy. Each one covers a specific design task with the key details Claude needs to produce reliable output.

The templates follow a consistent structure: specify the component, define the visual specs, reference existing patterns, and set verification expectations. Fill in the bracketed values with your project's specifics.

Task Prompt Template Key Details to Include
Layout "Create a [layout type] layout with [number] columns. The sidebar [width] wide with a [color] background. Main content area [padding] padding, [alignment] text. Use [flexbox/grid]." Column count, widths, gaps, max-width
Typography "Set up typography: headings use [family] at [sizes], body [size] with [line-height]. Scale feels [adjective]. Use clamp() for fluid sizing." Font families, weights, size scale, line-height
Component "Build a [type] with [states: hover, active, disabled]. [spacing] between elements, [radius] corners. Color scheme: [values]. [Paste screenshot]." Interactive states, spacing, radius, colors, screenshot
Color system "Define colors using CSS custom properties. Tone: [descriptor]. Palette: --bg: [hex], --surface: [hex], --accent: [hex], --text: [hex]. Use these consistently everywhere." All hex values, usage rules, tone descriptor
Responsive "Make this responsive. Mobile (<640px): [behavior]. Tablet (640-1024px): [behavior]. Desktop (>1024px): [behavior]. Mobile-first CSS." Breakpoints, layout per breakpoint, nav collapse
Animation "Add [effect] on [trigger]. Duration [time], easing [curve]. Elements should [visual behavior]. Use CSS transitions, not JavaScript." Trigger, effect, duration, easing
Full page "Build a [page type] for [product/audience]. Design direction: [tone]. Visual specs: bg [hex], accent [hex], font display [family/weight], font body [family/weight], radius [value], spacing [value]px base. Max-width [value]px." All visual specs, tone, audience, reference files
Design exploration "Before building, propose 4 visual directions. Each as: bg hex / accent hex / typeface / one-line rationale. Wait for me to choose, then implement only that direction." Product context, audience, any constraints

Three of these templates deserve fuller treatment. Here is how each one looks when filled in for a real task.

Layout: Dashboard with sidebar

Create a dashboard layout with:
- Sidebar: 240px fixed width on desktop, collapsible to hamburger on mobile
- Main content area fills remaining space, 32px padding
- Header bar: 64px height, sticky, white background, subtle bottom border
- Content grid: auto-fill, minmax(320px, 1fr), 24px gap
- Use CSS Grid for overall layout, Flexbox for component internals
- Reference the existing layout in @src/components/AppLayout.tsx

Component: Card with screenshot reference

Build a card component matching the design in this screenshot:

[Paste screenshot]

Requirements:
- Border radius: 12px
- Shadow: 0 1px 3px rgba(0,0,0,0.1)
- Padding: 24px
- Image: 16/9 aspect ratio, object-fit cover
- Title: 20px, semibold, single line with ellipsis truncation
- Description: 14px, regular, 2-line clamp
- Hover: translateY(-2px) with shadow intensifying
- Transition: 200ms ease

Follow the card pattern in @src/components/ProductCard.tsx.

Design exploration: Propose before building

I'm building a fintech dashboard for small business owners.

Before building, propose 4 distinct visual directions.
Each as: background hex / accent hex / typeface / one-line rationale.

Wait for me to choose, then implement only that direction.

The "propose options" pattern is worth highlighting. When you are unsure about direction, asking Claude to propose options before building produces meaningfully different visual directions across runs. It also prevents Claude from defaulting to its editorial aesthetic, because you are choosing from a menu instead of accepting whatever it produces first.

Tip: Reference existing files

Use @filename in your prompts to point Claude at existing components, style files, or design tokens. Claude reads the referenced file and mirrors its patterns. "Follow the pattern in @src/components/Button.tsx" produces output that fits your project. Without the reference, Claude builds from generic defaults that may clash with your existing code.

4.4 When to Show vs Tell

When to Show vs Tell

Claude Code can read images. This changes everything about how you prompt for visual design work, because sometimes a screenshot communicates more precisely than any text description.

There are three ways to give Claude an image: drag and drop a file into the Claude Code window, paste from your clipboard (Ctrl+V in terminal, standard paste in Desktop app and VS Code), or reference a file path in your prompt.

Before you paste a screenshot

Confirm that you are allowed to send the image to the AI tool you are using. Client dashboards, unreleased products, internal strategy pages, customer data, brand assets, and third-party artwork may be confidential or rights-restricted. Redact sensitive text and use approved references whenever possible.

The rule is straightforward. Use images when you want Claude to match a visual. Use text when you want Claude to follow exact specifications. Use both when you want the best results.

Show + Tell (hybrid approach)

"[Paste screenshot] Implement this component. Font: DM Sans, 16px body, 24px headline. Colors: --bg: #FAFAFA, --primary: #2563EB. Spacing: 24px padding, 16px gap. Border radius: 8px. Take a screenshot when done and compare to the original. List any differences and fix them."

Text only (when a reference exists)

"Create a card with a 16:9 image on top, a title below in bold, and a two-line description. The card should have rounded corners and a subtle shadow."

The hybrid approach wins because the screenshot gives Claude the visual goal and the text gives Claude the exact specifications. Claude can see the overall composition from the image and use the text values for colors, fonts, and spacing. Then the "take a screenshot and compare" instruction creates a verification loop.

Text descriptions work better than images for exact color values (hex codes are unambiguous), typography specs (font names and weights are precise), layout measurements (pixel values leave nothing to interpretation), interaction behavior (hover states are easier to describe than to show), and accessibility requirements (ARIA labels and contrast ratios are text by nature).

Images work better than text for overall composition and layout, visual style references from other sites or designs, matching an existing design, and communicating a mood or aesthetic that is hard to put into words.

My Take

The single best thing you can do for design prompts is paste a screenshot alongside your text description. A screenshot communicates visual intent more precisely than any paragraph. Claude Code can read images. Use that capability. The hybrid approach — screenshot for visual intent, text for exact specs — consistently produces the best output in my testing. Use screenshots strategically, not for every prompt, because image inputs consume more context. But for any component where you have a visual reference, paste it.

4.5 Iteration Patterns

Iteration Patterns

Basic refinement — "make the heading bigger" — is what you learned in Chapter 3. This section teaches three named iteration patterns that produce better results than ad-hoc corrections.

These patterns are not about writing better initial prompts. They are about what you do after the first generation, when the output is close but not right. The pattern you choose depends on what kind of gap exists between the output and your intent.

Pattern 1: Explore-Plan-Build

Use this when you are building something new and want Claude to understand your project before writing code. The pattern has three phases.

Phase one — explore. Ask Claude to read your existing files and understand the design system before proposing anything:

Read @src/components/ and @src/styles/ and understand the design system:
- What CSS approach is used?
- What are the existing color and spacing tokens?
- What component patterns exist?

Summarize what you find before proceeding.

Phase two — plan. Ask Claude to create an implementation plan based on what it found:

Based on the existing design system, create a plan for a pricing page:
1. Which components should be reused vs created new?
2. What is the layout structure?
3. List every component with its specs.

Do not write code yet. Wait for my approval.

Phase three — build. Only after the plan is approved:

Implement the pricing page from your plan.
Follow the design system in @src/styles/tokens.css.
Take a screenshot when done and compare to the design spec.

This pattern takes longer upfront but produces output that fits your project from the start, because Claude has context about your existing patterns before it writes a single line.

Pattern 2: Screenshot-Driven Iteration

Use this when you have a visual target — a mockup, a reference design, or a previous version you want to match. The pattern loops until the output matches the target.

[Paste design mockup]

Implement this design.
After implementing, take a screenshot and compare to the original.
List every visual difference.
Fix each difference.
Repeat until the output matches the mockup.

This is the highest-leverage iteration pattern for visual work. Claude becomes its own quality checker. It builds, it looks, it compares, it fixes. The loop converges on the target design without you having to describe every discrepancy in words.

Pattern 3: Clear-and-Refine

Use this when the first output is going in the wrong direction and incremental corrections are not helping. Instead of correcting the same session, reset and start fresh with a better prompt.

The pattern works like this: you note what is wrong with the first attempt, run /clear to reset the conversation context, then write a new prompt that incorporates the lesson from the failed attempt. The fresh context combined with a better-informed prompt produces better results than accumulated corrections in a cluttered session.

The two-correction rule

If you have corrected Claude on the same issue twice and it is still not right, stop. Run /clear and write a new prompt that addresses the problem from the start. A clean session with a better prompt almost always outperforms a long session with accumulated corrections. After two failed corrections, the conversation context is cluttered with wrong approaches, and Claude starts confusing which version is current.

Once Claude has built something you are happy with, lock the design decisions into CLAUDE.md so they persist across sessions:

## Design System

- Card component: 12px radius, 24px padding, shadow 0 1px 3px rgba(0,0,0,0.1)
- Color palette: --primary: #2563EB, --bg: #FFFFFF, --text: #1A1A2E
- Typography: Inter, scale 14/16/20/24/32/48px
- Spacing: 8px base unit (8, 16, 24, 32, 48, 64, 80)
- Border radius: 12px cards, 8px buttons, 9999px pills
- All future components follow this system.

This uses Claude Code's memory system. Every new session reads CLAUDE.md before responding, so your design decisions carry forward without you restating them.

4.6 Prompt Antipatterns

Prompt Antipatterns

These are the mistakes I see most often. Each one produces bad output in a predictable way. Recognizing them is faster than learning every good pattern.

Antipattern Why It Fails Better Approach
Vague aesthetic language ("make it modern and clean") Claude falls back to its default editorial aesthetic. "Modern" and "clean" mean nothing specific. Specify concrete constraints: hex codes, font names, border-radius values, spacing units
Kitchen sink session ("build the whole app") Context window fills up. By page 3, Claude has forgotten the design system from page 1. One component per session. Use /clear between components. Lock tokens in CLAUDE.md
Endless corrections in one session Context fills with failed attempts. Claude confuses which version is current. /clear after two failed corrections. Start fresh with a better-informed prompt
Fighting the default aesthetic ("don't use cream, don't use serif") Telling Claude what NOT to do shifts it to a different fixed palette instead of producing variety Specify what TO do. Provide a concrete alternative with hex codes and font names
No verification ("build this UI") Without visual verification, Claude has no way to know if the output matches the intent Add "take a screenshot and compare to the design spec" to every visual prompt
Ignoring existing patterns Claude builds generic components from scratch, ignoring your project's CSS approach and conventions Reference existing files with @filename. Ask Claude to read patterns before building
Ambiguous sizing ("make it a bit bigger") "A bit" and "slightly" are imprecise. Claude guesses, often wrong. Use exact values: "change padding from 16px to 32px"
Overloaded CLAUDE.md A CLAUDE.md with 50+ design rules causes important rules to get lost. Claude ignores your actual instructions. Keep CLAUDE.md under 200 lines. Use path-scoped rules for component-specific guidance

These antipatterns have one thing in common: they leave too much room for interpretation. Every antipattern can be fixed by replacing subjective language with concrete specifications. The fix is always the same: be specific about what you want instead of vague about what you do not want.

Telling Claude what to do

"Use a cold monochrome palette. Background #E9ECEC, text #11171B. Angular sans-serif typeface (Inter or Space Grotesk). 4px corner radius everywhere. Generous whitespace. Use shadow for elevation instead of borders."

Telling Claude what not to do

"Don't use cream backgrounds. Don't use serif fonts. Don't use terracotta or amber. Don't make it look like a blog."

The negative prompt gives Claude a list of things to avoid but no direction on what to pursue instead. Claude will pick a different default — often equally generic. The positive prompt gives Claude a complete specification to target. Both prompts take roughly the same effort to write. One produces predictable results.

My Take

The most common mistake I see from designers new to AI prompting is under-specifying on the first prompt and then over-correcting in the conversation that follows. They write "build a nice dashboard" and then spend ten messages fixing the colors, the spacing, the layout, and the typography — each correction adding context that makes the next correction harder. A specific first prompt — two minutes of writing instead of thirty seconds — saves ten minutes of correction. Write the prompt you would hand to a junior developer you respect. Detailed enough to guide, open enough to let them make good decisions.

Here is a mental checklist for every design prompt before you send it:

  • Did I specify colors with hex values or variable names?
  • Did I name the fonts and weights?
  • Did I describe the layout with specific values (columns, gaps, max-width)?
  • Did I reference existing files that Claude should follow?
  • Did I include a verification instruction ("take a screenshot and compare")?
  • Did I avoid subjective terms without concrete definitions?

If you can answer yes to all six, send it. If not, fill in the gaps. The thirty seconds you spend sharpening the prompt saves minutes of iteration.

Good prompting is not a talent. It is a skill that develops with practice, and it has concrete, learnable patterns. The translation layer between design thinking and code output is the core skill this book teaches. The tables and templates in this chapter are your reference. Come back to them whenever the output is not matching your intent. The gap between what you imagined and what Claude produced is almost always a translation problem — and translation problems have concrete fixes.

Next Chapter

Teaching Claude Your Design Language

CLAUDE.md for designers, design tokens, brand guidelines, and component conventions

Continue Reading

©2026 Mehran Mozaffari. All rights reserved.