一键导入
explain-diff-html
Use when the user asks for a rich explanation of a code change, diff, branch, or PR and wants an interactive HTML document as output
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when the user asks for a rich explanation of a code change, diff, branch, or PR and wants an interactive HTML document as output
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | explain-diff-html |
| description | Use when the user asks for a rich explanation of a code change, diff, branch, or PR and wants an interactive HTML document as output |
Produce a self-contained HTML file that explains a code change — a diff, a branch, or a PR — with the clarity and flow of Martin Kleppmann. The reader should come away with genuine understanding, not just a summary.
Write a single self-contained HTML file (no external dependencies) to /tmp/ with a filename starting with today's date: /tmp/YYYY-MM-DD-explanation-<slug>.html.
The file must include embedded CSS and JavaScript for interactive features. No external stylesheets or scripts.
The HTML page is one long page with a table of contents at the top.
Two parts:
Deep background (skippable). Explain the existing system broadly. Assume a capable engineer who may not know this particular codebase. Context from surrounding modules, the problem domain, and relevant history.
Narrow background. Focus on the specific area the change touches. What was the state of the code before this diff? What pain points or limitations existed?
The core idea of the change, explained with concrete examples and toy data. Use HTML-based diagrams throughout — never ASCII art.
Good diagram types:
Use callout boxes for key concepts, definitions, and important edge cases. Mark them visually distinct from the main text.
Group changes in a logical order (not file-by-file or line-by-line). For each group:
Use <pre> tags for code blocks. Every <pre> element must have white-space: pre-wrap or white-space: pre in its CSS — scan the output to confirm this before saving.
Five interactive multiple-choice questions that test genuine understanding of the diff. Each question:
prefers-color-schemesystem-ui, -apple-system, sans-serifwhite-space: pre-wrap on all <pre> code blocks (verify before saving)Write in classic style — as if you are showing the reader something they can see for themselves. Be direct, concrete, and confident. Use the flow and clarity of Martin Kleppmann: start with what the reader already knows, bridge to what's new, and make each step feel inevitable.
git diff, git log, surrounding files, related testswhite-space is set on every <pre>