Module 45

AI Design with HTML

Last updated 2026-06-02

Key points

Lesson 1: What is AI Design with HTML and why it matters

AI Design with HTML means using the structure of web pages (HTML scaffolding, CSS class names, script tags) as the raw material an AI reads, rather than asking it to write code from scratch. When an AI agent (an autonomous program that performs tasks) reads a typical webpage, roughly 80% of what it processes is “HTML packaging” like navigation bars, cookie banners, and inline styles—only about 3,000 out of 16,000 tokens (units of text the AI processes) are actual content. That means most of an AI’s processing power is wasted on design fluff instead of substance.

This matters for AI development because it reveals a hidden bottleneck: the AI’s “brain” struggles with visual elements. Most AI coding tools operate through chat windows or terminals, lacking the visual feedback that helps humans understand what’s being built. By designing AI interfaces using structured HTML—or, even better, using a technique called JSON Render (a pattern where the AI outputs data instead of code)—you can avoid the risk of hallucinated code (incorrect or dangerous code generated by AI). The core insight is to let AI select from a predefined “catalog” of components rather than generate raw code, cutting costs and improving safety. For example, an AI can be given an HTML styling guide and simply choose how to present research results, avoiding the bloat of full page generation. The result: AI spends its resources on reasoning, not reading useless markup.

Sources

Lesson 2: How to use AI Design with HTML: step-by-step

To build a website with AI design using Claude, start by writing a prompt in plain English inside Claude Code (the AI brain that follows your instructions). For example: "Design a landing page for a premium AI automation course targeted at agency owners. Include a hero section, social proof, a pricing table, and a CTA."

Claude will generate the output in markdown (a simple text format with headers and bullet points), but for richer design you should request HTML instead. Markdown can only handle lists, while HTML can carry CSS design, SVG charts, live interactions, and real images. When you give Claude HTML, it stops faking charts and draws them properly.

To get better results, gather inspiration from existing websites or component libraries like 21st.dev. Then ask Claude to iterate by making small tweaks rather than starting over. A powerful workflow is to use Google Stitch with Claude Code — this stack helps you build professional-looking websites in about 30 minutes.

After Claude generates the HTML, you can drop it into a new project to see animations, scrolling banners, and consistent branding. You can also export the HTML to Figma, Canva, or PowerPoint to make further edits. For animation tuning, Claude sketches in HTML first, then adds sliders and knobs so you can adjust motion and copy parameters back into your prompt.

To guide Claude effectively, give it a Claude.md file (a markdown file) with your project instructions. Use the agent skill (a tool that helps Claude design UI/UX) unless you explicitly tell it not to. Always test the output and request revisions until the design matches your vision.

Sources

Lesson 3: Best practices and pitfalls

When designing with AI tools like Claude, avoid the common pitfall of using markdown for everything. Markdown can only carry headings, bold text, bullet lists, and tables. HTML, however, carries far more—CSS design, SVG charts, live interactions, spatial data, and real images. When you give AI agents HTML, they stop faking charts and just draw them. Claude design is built on HTML for exactly this reason; HTML is incredibly expressive for design, even when your final output is React or Swift.

A major mistake is ignoring the hidden tax of HTML bloat. Your AI agent reads 16,000 tokens from a single web page, but only 3,000 are actual content. The rest is HTML packaging—navigation bars, cookie banners, inline styles, and analytic scripts. You pay for every token on every request. Compare two words: "About Us." In markdown, that is three tokens: clean, explicit, done. In HTML, that same heading becomes a section tag with containers and classes, costing far more. One HTTP header can fix this, a mechanism that has existed since 1997.

Best practices include using markdown for outlines and research, then handing that to Claude design in HTML for final polish. Treat AI as a specialized tool. Avoid generic "AI slop" websites by combining tools like Claude Code with component libraries such as 21st.dev. Use the screenshot loop: AI gets you 40% of the way there, but manual correction and front-end design skill steers you the rest. Always verify skills for malicious intent. The key insight: markdown is what your colleague skims; HTML is what your colleague opens.

Sources