Glean 拾遗
Daily /2026-05-27 / Using Claude Code: The unreasonable effectiveness of HTML

Using Claude Code: The unreasonable effectiveness of HTML

Source claude.com Glean’d 2026-05-27 14:54 Read 12 min
AI summary

Thariq Shihipar argues for using HTML instead of Markdown when working with Claude Code. HTML can represent tables, SVG, designs, and interactions—far denser information than Markdown. HTML docs are more readable, shareable, and can include interactive elements. Claude Code can pull context from codebases, Slack, git history to generate rich HTML reports, prototypes, and review interfaces. Concrete use cases cover planning, code review, design, reporting, and custom editing tools, with reusable prompt examples. For developers seeking to make Claude Code outputs more engaging and actionable.

Original · 12 min
claude.com ↗
§ 1

Why use HTML?

A few things make HTML a better fit than Markdown for the kind of work I'm now doing with Claude Code, including tasks that require or entail:

Information density

HTML can convey much richer information compared to Markdown. It can, of course, do simple document structure like headers and formatting, but it can also represent all sorts of other information such as:

Tabular data using tables Design data with CSS Illustrations with SVG Code snippets with script tags Interactions using HTML elements with javascript + CSS Workflows using SVG and HTML Spatial data using absolute positions and canvases Images using image tags

In my opinion, there is almost no set of information that Claude can read that you cannot efficiently represent with HTML. This makes it a highly efficient way for the model to communicate in-depth information to you and for you to review it.

I’ve found that in the absence of being able to do this, the model may do more inefficient things in Markdown, like ASCII diagrams or, my favorite, estimating colors with unicode characters.

为何用 HTML?

有几个因素让 HTML 比 Markdown 更适合我现在用 Claude Code 做的工作,包括需要以下能力的任务:

信息密度

HTML 能传达比 Markdown 丰富得多的信息。当然,它可以实现标题、格式化等基本文档结构,但它还能表示各种其他信息,例如:

表格数据(table) 用 CSS 表达的设计数据 SVG 插图 通过 script 标签嵌入的代码片段 利用 HTML 元素配合 JavaScript + CSS 实现的交互 用 SVG 和 HTML 表达的工作流程 用绝对定位和画布表达的空间数据 通过 img 标签嵌入的图像

在我看来,几乎没有 Claude 能读取的信息集是你无法通过 HTML 高效表达的。这让它成为一种模型向你传递深入信息并供你审查的高效方式。

我发现,如果没有这种能力,模型可能会在 Markdown 中做效率更低的事情,比如 ASCII 示意图,或者我最爱的 — 用 Unicode 字符估算颜色。

§ 2

Visual clarity and ease of reading

As Claude is capable of tackling more complex work, it's also able to write larger and larger specs and plans. I’ve found that I tend to not actually read more than a 100-line Markdown file, and I certainly am not able to get anyone else in my organization to read it.

But HTML documents are much easier to read because Claude can organize the structure visually to be ideal to navigate with tabs, illustrations, and links. It can even be mobile responsive so you can read it differently based on your form factor.

视觉清晰与易读性

随着 Claude 能处理更复杂的工作,它也能写出越来越大的规格说明和计划。我发现我实际上不会去读超过 100 行的 Markdown 文件,而且我肯定无法让组织里的其他人去读。

但 HTML 文档更容易阅读,因为 Claude 可以视觉化地组织结构,使其适合用标签页、插图和链接来导航。它甚至可以做到移动端响应式,让你根据设备尺寸获得不同的阅读体验。

§ 3

Ease of sharing

Markdown files are fairly hard to share since most browsers do not render them natively well. You often have to add them as attachments to emails or messages.

As long as you upload the HTML file, you can share the link easily. Your colleagues can open it wherever they wish and easily reference it.

The chance of someone actually reading your spec, report, or PR writeup is much higher if it’s in HTML.

易于分享

Markdown 文件很难分享,因为大多数浏览器不能原生良好地渲染它们。你通常需要把它们作为附件添加到邮件或消息中。

只要你上传 HTML 文件,就可以轻松分享链接。你的同事可以在任意地方打开它并轻松参考。

如果你的规格说明、报告或 PR 文档是 HTML 格式,别人真正去读的几率会高得多。

§ 4

Two-way interactions

HTML can also allow you to interact with the document; for example, you might want to ask it to add sliders or knobs to adjust a design or allow you to tweak different options in the algorithm to see what happens. You can also ask it to let you copy these changes into a prompt to paste back into Claude Code.

When useful, this can allow you to create individual editing environments for the specific problem you’re working on.

双向交互

HTML 还能让你与文档交互;比如,你可能想让它添加滑块或旋钮来调整设计,或者让你微调算法中的不同选项看看效果。你还可以让它提供“复制变动”按钮,以便将更改作为提示词粘贴回 Claude Code。

在有用的情况下,这能让你为手头的特定问题创建专属的编辑环境。

§ 5

Data ingestion

One of the biggest reasons to use Claude Code to make HTML files instead of Claude.ai or Claude Design is all of the context Claude Code can ingest. For example, when writing this article, I asked Claude Code to read through my code folder and find all the HTML files I've generated, group and categorize them, and then make an HTML file with diagrams representing each type. The diagrams you see in this article are a direct result of that.

Besides the file system, Claude Code can find additional context using your MCPs (like Slack, Linear, etc.), your web browser (with Claude in Chrome), and your git history.

数据摄取能力

使用 Claude Code 而非 Claude.ai 或 Claude Design 来生成 HTML 文件的最大原因之一,是 Claude Code 能摄取的所有上下文。例如,写本文时,我让 Claude Code 读取我的代码文件夹,找出所有我生成的 HTML 文件,将它们分组归类,然后制作一个 HTML 文件,用图示代表每个类型。你在这篇文章中看到的图示正是这样来的。

除了文件系统,Claude Code 还能通过 MCP(如 Slack、Linear 等)、网页浏览器(通过 Chrome 中的 Claude)以及你的 git 历史来获取额外上下文。

§ 6

Getting started

One thing worth noting: you don't need to do much to get Claude to generate HTML like this. You can simply prompt it to "make an HTML file" or "make an HTML artifact." The main thing is knowing what you want the artifact to do and how you might use it. Over time, it may make sense to build a skill around recurring patterns, but starting by prompting from scratch is a good way to get a feel for how it works across different use cases.

上手极其简单

有一点值得注意:你不必做太多事情就能让 Claude 生成这样的 HTML。你只需提示它“制作一个 HTML 文件”或“制作一个 HTML artifact”。关键在于,你要知道想让 artifact 做什么、可能如何使用它。随着时间的推移,围绕重复模式构建技能可能是合理的,但一开始直接从零写提示词是感受其在不同用例中如何工作的好方法。

§ 7

Use cases

To make this approach more concrete, below are some example use cases where I think using HTML files make more sense than Markdown. You can also follow along with a GitHub gallery of these use cases, here.

Specs, planning, and exploration

HTML is a rich canvas for Claude to dive into a problem. When I start working on a problem instead of a simple Markdown plan I expect to make a web of HTML files. For example, I might start with asking Claude Code to brainstorm and create some explorations of different options. I would then ask it to expand more into one, maybe make mockups or examples of the type interfaces. Finally, when I feel good I’ll ask it to write an implementation plan. When I’m happy with the plan I’ll create a new session and pass in all of these files for it to implement.

When verifying I’ll also ask the verification agent to read in the files and it will have much broader context on what is needed.

Example prompts:

I'm not sure what direction to take the onboarding screen. Generate 6 distinctly different approaches—vary layout, tone, and density—and lay them out as a single HTML file in a grid so I can compare them side by side. Label each with the tradeoff it's making.

Create a thorough implementation plan in a HTML file, be sure to make some mockups, show data flow and add important code snippets I might want to review. Make it easy to read and digest.

Use this for:

Exploring other ways to implement something in code Experimenting with multiple visual designs at once

用例

为了让这种方法更具体,下面是一些我认为使用 HTML 文件比 Markdown 更合理的用例。你也可以在 GitHub gallery 上追踪这些用例。

需求、计划与探索

HTML 是 Claude 深入问题的丰富画布。当我开始处理一个问题时,我不会只做一个简单的 Markdown 计划,而是构建一个 HTML 文件网络。例如,我可能先让 Claude Code 头脑风暴,创建几份不同选项的探索。然后让它深入其中一个,可能做出界面类型的模型或示例。最后,当我感觉良好时,我会让它写实施计划。对计划满意后,我会新建一个 session,把所有文件传进去供它实施。

验证时,我还会让验证 agent 读取这些文件,这样它就更清楚需要什么了。

示例提示词:

我不确定引导页该走哪个方向。生成 6 种截然不同的方案——在布局、语气、信息密度上变化——把它们排列在一个 HTML 文件的网格中,方便我并排比较。给每个方案标注它在做的取舍。

在 HTML 文件中创建详尽的实施计划,务必包含一些模型、展示数据流,并加入我可能需要审查的关键代码片段。让它易于阅读和消化。

适用场景:

探索代码实现的不同方式 同时实验多种视觉设计

§ 8

Code review and understanding

Code can be difficult to read in a Markdown file, but with HTML, we can render diffs, annotations, flowcharts, and modules. Use HTML to understand code that the agent has written, to review code, or to explain a PR to someone reviewing your code.

Example prompt:

Help me review this PR by creating an HTML artifact that describes it. I'm not very familiar with the streaming/backpressure logic, so focus on that. Render the actual diff with inline margin annotations, color-code findings by severity and whatever else might be needed to convey the concept well.

Use this for:

Creating a PR Reviewing a PR Understanding a topic in code

代码审查与理解

代码在 Markdown 文件中可能很难阅读,但利用 HTML,我们可以渲染 diff、注释、流程图和模块。用 HTML 来理解 agent 写的代码、审查代码,或者向审查你代码的人解释一个 PR。

示例提示词:

帮我审查这个 PR:创建一个描述它的 HTML artifact。我对流控/背压逻辑不太熟,所以请聚焦那部分。渲染实际 diff,加上行内边注,按严重程度给发现标色,并且用一切有助于清晰传达概念的手段。

适用场景:

创建 PR 审查 PR 理解代码中的某个主题

§ 9

Design and prototypes

Claude Design is based on HTML because HTML is incredibly expressive at design, even if your end surface is not HTML. Claude can sketch out a design in HTML and then write it in your language of choice, be it React, Swift, etc.

You can also prototype interactions, such as animations, actions, etc. Consider asking Claude to make sliders, knobs, etc. to tune in exactly what you’re looking for.

Example prompt:

I want to prototype a new checkout button, when clicked it does a play animation and then turns purple quickly. Create a HTML file with several sliders and options for me to try different options on this animation, give me a copy button to copy the parameters that worked well.

Use this for:

Creating design system artifacts Adjusting components Visualizing component libraries Prototyping animations

设计与原型

Claude Design 基于 HTML,因为 HTML 在设计方面表现力极强,即使你的最终呈现不是 HTML。Claude 可以用 HTML 草绘出设计,再用你选择的语言编写出来,无论是 React、Swift 等。

你也可以制作交互原型,比如动画、动作等。考虑让 Claude 制作滑块、旋钮等,以便精确调节你想要的效果。

示例提示词:

我想原型化一个新的结账按钮,点击后播放一段动画然后快速变成紫色。创建一个 HTML 文件,带有多个滑块和选项,让我能尝试该动画的不同参数,并提供一个“复制”按钮来复制效果好的参数。

适用场景:

创建设计系统 artifacts 调整组件 可视化组件库 原型化动画

§ 10

Reports, research, and learning

Claude Code is very effective at synthesizing information across multiple data sources and converting it into a report for readability. You can prompt Claude to search your Slack, your codebase, git history, or the internet and use it to generate easy to read reports..

You could assemble this in the form of a long HTML document, an interactive explainer or even a slideshow/deck. Ask Claude to use SVG for diagrams to help visualize it.

Example prompt:

I don't understand how our rate limiter actually works. Read the relevant code and produce a single HTML explainer page: a diagram of the token-bucket flow, the 3–4 key code snippets annotated, and a "gotchas" section at the bottom. Optimize it for someone reading it once.

Use this for:

Writing feature summarizations Generating explainers Drafting weekly status reports Creating incident reports Producing SVG illustrations, flowcharts, and technical diagrams

报告、研究与学习

Claude Code 非常擅长跨多个数据源综合信息,并将其转化为易于阅读的报告。你可以提示 Claude 搜索你的 Slack、代码仓库、git 历史或互联网,然后用它生成易读的报告。

你可以把它组装成一份长 HTML 文档、一个交互式解释工具甚至幻灯片。让 Claude 用 SVG 画图来可视化。

示例提示词:

我不明白我们的限流器到底是怎么工作的。阅读相关代码,生成一个单独的 HTML 解释页面:一张令牌桶流程图,3–4 个关键代码片段并附注释,底部加一个“坑点”小节。为只读一次的人优化。

适用场景:

撰写功能总结 生成解释材料 起草周报 创建事故报告 制作 SVG 插图、流程图和技术图表

§ 11

Custom editing interfaces

Sometimes it’s hard to describe what you want purely in a text box. For this use case, I'll often ask Claude to build me a throwaway editor for the exact thing I'm working on: not a product, or a reusable tool, but a single HTML file, purpose-built for this one piece of data.

The trick is always to end with an export: a "copy as JSON" or "copy as prompt" button that turns whatever I did in the UI back into something I can paste into Claude Code or commit to a file. You stay in the loop, but the loop gets much tighter.

Example prompts:

I need to reprioritize these 30 Linear tickets. Make me an HTML file with each ticket as a draggable card across Now / Next / Later / Cut columns. Pre-sort them by your best guess. Add a "copy as Markdown" button that exports the final ordering with a one-line rationale per bucket.

Here's our feature flag config. Build a form-based editor for it, group flags by area, show dependencies between them, warn me if I enable a flag whose prerequisite is off. Add a "copy diff" button that gives me just the changed keys.

I'm tuning this system prompt. Make a side-by-side editor: editable prompt on the left with the variable slots highlighted, three sample inputs on the right that re-render the filled template live. Add a character/token counter and a copy button.

Use this for:

Reordering, triaging, or bucketing anything (tickets, test cases, feedback) Editing structured config (feature flags, env vars, JSON/YAML with constraints) Tuning prompts, templates, or copy with live preview Curating datasets — approve/reject rows, tag examples, export the selection Annotating a document, transcript, or diff and exporting the annotations Picking values that are painful to express in text: colors, easing curves, crop regions, cron schedules, regexes

自定义编辑界面

有时,纯用文本框很难描述你想要的东西。对于这种用例,我经常会请 Claude 为我手头的具体任务构建一个一次性编辑器:不是产品,也不是可复用工具,而是一个单独的 HTML 文件,专为此项数据打造。

诀窍总是在结尾加上导出功能:一个“复制为 JSON”或“复制为提示词”的按钮,将我在 UI 中做的所有操作转换回可以粘贴进 Claude Code 或提交到文件的东西。你仍处于循环中,但这个循环变得更紧了。

示例提示词:

我需要给这 30 个 Linear 工单重新排优先级。帮我做一个 HTML 文件,每张工单是一个可拖拽的卡片,放置在 Now / Next / Later / Cut 列中。按你的最佳猜测预先排序。添加一个“复制为 Markdown”按钮,导出最终排序以及每个桶的一行理由。

这是我们的功能标志配置。为其构建一个基于表单的编辑器,按区域分组标志,显示它们之间的依赖关系,当我启用一个其前置条件处于关闭状态的标志时发出警告。添加一个“复制 diff”按钮,只输出改动了的键。

我在调优这个系统提示词。做一个并排编辑器:左侧是带高亮可变插槽的可编辑提示词,右侧是三个示例输入,实时渲染填充后的模板。加上字符/token 计数器和复制按钮。

适用场景:

重排、分类或分桶任何事物(工单、测试用例、反馈) 编辑结构化配置(功能标志、环境变量、带约束的 JSON/YAML) 调优提示词、模板或文案并实时预览 策展数据集 — 批准/拒绝行,标注示例,导出所选内容 标注文档、转写文本或 diff,并导出标注 选择用文字难以表达的值:颜色、缓动曲线、裁剪区域、cron 计划、正则表达式

§ 12

Frequently asked questions

These are the questions I get asked most often about using HTML with Claude Code, paired with the practical, day-to-day habits I've landed on:

Isn’t it less efficient?

While Markdown often uses fewer tokens, I’ve found that the added expressiveness of HTML and the much higher likelihood of me reading it means I get overall better output. With the 1MM context window in Opus 4.7, the increased token usage is not really noticeable in the context window.

常见问题

这些是我被问得最多的问题,关于用 Claude Code 生成 HTML,以及我由此形成的日常习惯:

这样效率不会更低吗?

虽然 Markdown 通常用更少的 token,但我发现 HTML 更强的表现力以及我阅读它的可能性大幅提高,意味着整体产出更好。在 Opus 4.7 的 1M 上下文窗口下,增加的 token 用量在上下文窗口中并不明显。

§ 13

When do you use Markdown for now?

I have honestly stopped using Markdown altogether for almost everything, but I’m probably far on the HTML maximalist side of things.

现在何时还用 Markdown?

说实话,我几乎在所有事情上都已完全停用 Markdown,但我可能位于 HTML 极端主义一侧。

§ 14

Is this how you’ve replaced planning?

I’ve found that instead of having a single plan, I tend to have a few different HTML files for different parts/stages of the plan. For example, I may make an implementation plan in HTML and then do another file for exploration of UIs, and then finally make a HTML component that lists every design. I tend to keep these files around as references for the future, as well for use in verification.

这样你就替代了计划吗?

我发现我不是只有一个计划,而是针对计划的不同部分/阶段准备几个不同的 HTML 文件。例如,我可能用 HTML 制作实施计划,再另外做一个文件用于 UI 探索,最后做一个列出所有设计的 HTML 组件。我倾向于保留这些文件作为未来参考,也用于验证。

§ 15

Staying in the loop with Claude

All of the above is to say that the real reason I use HTML instead of Markdown is that it helps me feel much more in the loop with Claude. As Claude takes on more, I'd noticed I was reading plans less closely, and I wanted a way to stay engaged with its choices rather than just hand them off. HTML turned out to be exactly that. I feel more in the loop now than I ever did before."

Get started with Claude Code.

This article was written by Thariq Shihipar, member of technical staff, and expresses his personal opinions – and affinity – for using HTML files with Claude Code.

与 Claude 保持同步

以上所有都说明,我用 HTML 而不是 Markdown 的真正原因是,它让我感觉与 Claude 的联系更紧密。随着 Claude 承担更多,我注意到自己不太仔细地阅读计划了,我希望找到一种方法,继续参与它的选择,而不是只是把任务丢出去。HTML 恰好就是答案。我现在感觉比以往任何时候都更处于循环之中。

开始使用 Claude Code。

本文由技术人员 Thariq Shihipar 撰写,表达了他个人对在 Claude Code 中使用 HTML 文件的看法与偏爱。

Open source ↗