Using Claude Code: The Unreasonable Effectiveness of HTML
Simon Willison··作者 Simon Willison
资讯摘要
<p><strong><a href="https://twitter.com/trq212/status/2052809885763747935">Using Claude Code: The Unreasonable Effectiveness of HTML</a></strong></p> Thought-provoking piece by Thariq Shihipar (on the Claude Code team at Anthropic) advocating for HTML over Markdown as an output format to request from Claude.</p> <p>The article is crammed with interesting examples (collected on <a href="https://thariqs.github.io/html-effectiveness/">this site</a>) and prompt suggestions like this one:</p> <blockquote> <p><code>Help me review this PR by creating an HTML artifact that describes it.

资讯正文
<p><strong><a href="https://twitter.com/trq212/status/2052809885763747935">使用 Claude Code:HTML 的非理性高效性</a></strong></p>
Thariq Shihipar(Anthropic 的 Claude Code 团队成员)写了一篇发人深省的文章,主张在向 Claude 请求输出时使用 HTML 而不是 Markdown。</p>
<p>这篇文章塞满了有趣的示例(收集在<a href="https://thariqs.github.io/html-effectiveness/">这个网站</a>上),以及类似下面这样的提示建议:</p>
<blockquote>
<p><code>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.</code></p>
</blockquote>
<p>自 GPT-4 时代以来,我一直默认用 Markdown 来请求大多数内容;那时 8,192 token 的限制意味着,Markdown 相比 HTML 在 token 效率上的优势非常值得利用。</p>
<p>Thariq 这篇文章让我重新考虑了这一点,尤其是在输出方面。让 Claude 以 HTML 形式给出解释,意味着它可以嵌入 SVG 图表、交互式小部件、页内导航,以及各种其他让信息更易于浏览的巧妙方式。</p>
<p>我去年 12 月写过<a href="https://simonwillison.net/2025/Dec/10/html-tools/">构建 HTML 工具的实用模式</a>,但那时主要聚焦于交互式工具,比如我在 <a href="https://tools.simonwillison.net/">tools.simonwillison.net</a> 网站上提供的那些。我很兴奋能开始更多地尝试,用富 HTML 的方式来回应临时性的提示,并生成解释内容。</p>
<h4 id="trying-this-out">在 copy.fail 上试试这个</h4>
<p><a href="https://copy.fail/">copy.fail</a> 描述了一个最近发现的 Linux 安全漏洞利用,包含一个以混淆 Python 分发的概念验证。</p>
<p>我尝试让 GPT-5.5 生成一个关于这个漏洞利用的 HTML 解释,提示如下:</p>
<blockquote>
<p><code>curl https://copy.fail/exp | llm -m gpt-5.5 -s 'Explain this code in detail. Reformat it, expand out any confusing bits and go deep into what it does and how it works. Output HTML, neatly styled and using capabilities of HTML and CSS and JavaScript to make the explanation rich and interactive and as clear as possible'</code></p>
</blockquote>
<p>这是<a href="https://gisthost.github.io/?ae53e3461ffdbfd0826156aacf025c7e">生成的 HTML 页面</a>。效果相当不错,不过我本该更强调对漏洞利用本身的解释,而不是它周围的 Python 脚手架。
[图像说明:一张深色主题技术文档的截图,标题为“这个 Python 脚本做什么”。正文写道:“这是一个紧凑、刻意混淆的、仅适用于 Linux 的本地权限提升概念验证。它表面上的目标是篡改 /usr/bin/su 的内存映像/页缓存,然后执行 su 以获得更高权限。” 一个黄边提示框写着:“安全提示:本说明仅用于代码理解、逆向工程和防御性分析。不要在你不拥有或不管理的系统上运行它。在存在漏洞的内核上,这类代码可以改变一个特权可执行文件的行为。” 左栏标题“High-level summary”写着:“脚本以只读方式打开 /usr/bin/su,解压一个嵌入的二进制载荷,然后以 4 字节为单位处理该载荷。对每个块,它都会执行一套精心安排的操作,涉及 Linux 内核加密套接字接口、AF_ALG、管道以及 splice()。关键点在于,这并不是普通的文件写入。它从未对 /usr/bin/su 调用 write()。相反,它似乎依赖一个与被 splice 的文件页和加密 API 有关的内核漏洞/原语,把受控字节放入一个特权可执行文件的页缓存表示中。” 后面列出的编号步骤包括:“1. 打开目标可执行文件——以只读方式打开 /usr/bin/su。2. 解码隐藏载荷——将一个 zlib 压缩的十六进制 blob 解压为字节。3. 以 4 字节块打补丁——辅助函数会以偏移量 0、4、8……重复调用。” 右栏标题“Why it looks strange”包含一个表格,列为 Pattern 和 Purpose:“import os as g——使用短别名让脚本更紧凑,也更难阅读。socket(38, 5, 0)——使用原始的数字型 Linux 常量,而不是可读的名称。Compressed hex blob——隐藏二进制载荷字节,并让脚本保持小体积。splice()——在不经过正常用户空间拷贝的情况下,通过管道搬运文件支持的页。try: recv(...) except: 0——触发内核操作并忽略预期错误。”]
标签:html、security、markdown、ai、prompt-engineering、generative-ai、llms、llm、claude-code
来源与参考
收录于 2026-05-09