/explain-diff:explain-difffrom explain-diff
Turn a raw code diff, commit, branch, or pull request into a personalized learning document — a single self-contained HTML "textbook" that explains the background first, gives the core intuition in plain words, adds interactive diagrams only where they reveal cause-and-effect, then walks through the code as a literate diff ordered by logical steps instead of file order, and ends with a short recall quiz that checks real understanding. Use this skill whenever the user wants to understand, learn from, study, onboard onto, or "explain" a diff, PR, commit, patch, or change set — e.g. "explain this PR to me", "help me understand what changed in this branch", "turn this diff into something I can read", "I need to review this but don't know the rendering code", "make a study doc from commit abc123", "이 PR 설명해줘", "이 변경 이해하게 도와줘" — even if they don't say "explain-diff". Prefer it over a plain code review whenever the goal is understanding rather than finding bugs.
Ships in explain-diff. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Turn a diff into a document a person can learn from — something they could print and read in a café, not a wall of red and green lines.
A normal code review starts at the changed lines. That works only when the reader already knows the system. This skill reverses the order:
The running example in this file: a Zen-garden drawing game whose view changed from top-down to isometric.
Accept any of: a pasted diff, a patch file, git diff <range>, a commit SHA (git show), a branch (git diff main...HEAD), or a PR (gh pr diff <n> and gh pr view <n> for the title and description).
Then read beyond the hunks. A hunk only shows what changed; to explain why, you need the code it touches: the full functions, the callers, the types, the config, the engine or framework it runs on. Read the PR description and commit messages too — they often state the motive. If you can only see the diff (no repo), say so in the document and infer carefully; mark guesses as guesses.
Write these down for yourself first (a scratch note is fine). The document is built from them.
z that changes draw order but not draw position), and do copies of the same constant stay in sync? A reader who understands a change should also know where it can break — and this pass is where most of the real insight comes from. Results feed section 6, and an old-vs-new table often feeds section 3.The background section is the personalized part. Its depth depends on what this reader already knows.
Apply the answer: concepts the reader knows well get one line ("You know isometric projection; here it's the 2:1 variant"). Concepts that are new get a real explanation with a small example. Put the deeper background inside <details> blocks so an expert can skip them and a beginner can open them.
Use the HTML skeleton in assets/template.html (copy it, then fill it in). It already has the diff styling, light/dark themes, print styles, section layout, and the quiz script — don't rewrite those.
Write in the language of the user's prompt (Korean prompt → Korean document). Keep code, identifiers, and file paths as they are. In Korean documents, write "review" as 리뷰 (코드 리뷰, 리뷰 메모, "리뷰를 요청한다"), not 검토 — it is the word developers actually use, and 검토 reads as a vaguer "look over".
The document has these sections, in this order:
0. Header — title (what the change does, in reader terms, not the PR title verbatim), source (PR/commit/branch), size (files, +/−), and the reader assumption from Step 3.
1. Background: what you need to know first — the prerequisite concepts and the "before" picture. Explain how the old system worked, how the relevant subsystem fits in, and any foundational concept. Prefer small concrete examples and simple static diagrams (inline SVG) over abstract definitions. End with a sentence that sets up the problem the change solves.
2. The idea in one picture — the one-sentence intuition, then a short paragraph (3–6 sentences) that expands it in plain words, like a good math teacher giving the meaning before the formula. Often a single before/after diagram belongs here. After this section the reader should be able to predict roughly what the code will do.
3. Explore it (only if it earns its place) — interactive widgets. See Step 5. If no widget passes the test, omit this section entirely; do not leave an empty heading.
4. The change, step by step — the literate diff. For each logical step:
renderer.ts owns the per-frame draw loop"). Then the relevant hunk(s), rendered as a diff block. Trim long hunks to the meaningful lines and note what you trimmed (… 12 unchanged lines …).5. Other changes — the mechanical hunks from the coverage map, one line each.
6. Review notes — 3–8 bullets from the edge-case pass: concrete failure scenarios ("the new cache key omits locale → a German user can receive the page cached for an English user"), behavior changes that look like a pure refactor but aren't, missing tests, and questions for the author. Give each one an input and a consequence, and mark confirmed vs. guessed. Skip only if the pass genuinely found nothing.
7. Check your understanding — a recall quiz. People confuse the familiarity of well-written sentences with understanding; a reader can finish this document, feel fine, and then fail a colleague's basic question. The quiz exposes those gaps while the document is still open, and sends the reader back to the right section. It is a speed governor, not an exam: it holds the workflow to the pace of human understanding, and a sensible rule for the reader is "I don't ask for review of this change until I pass." Say that purpose in one line above the questions.
screenToGrid were left unchanged, what would the player notice?", "Which of these inputs behaves differently after this change?". Bad: "What is the value of TILE_W?", "Which file contains depthKey?" — those are answered by Ctrl-F, and knowing them proves nothing.Interactive elements are valuable only when they let the reader explore a causal relationship that static text or a picture cannot show well. A decorative slider is AI-generated ornament, and it costs the reader attention.
Before adding a widget, it must pass all three checks:
Zen garden passes: drag a stone and watch, live, its grid coordinates, its projected screen coordinates, its depth key, and the resulting draw order. Show before vs. after projection side by side if that helps.
Small diffs can still earn a small widget: when a change alters behavior on some inputs (a new null guard, a .trim(), a changed default), an old-vs-new runner — pick a sample input, see the old and new code's output side by side, differences highlighted — teaches faster than prose, because the reader discovers which inputs changed. It passes the gate when it runs both versions of the real code. A pure rename or move with no behavior change gets no widget.
Read references/widgets.md for widget patterns and implementation rules before writing one.
Before handing over, verify:
<link>s in the template are the only other external requests; keep them, and keep the design tokens in :root as they are — they are this skill's default style (Pretendard + JetBrains Mono, paper/ink/accent palette). Widgets and SVGs take colors from these tokens, never hard-coded hex.<details> content is readable.data-answer matches the option you explain as correct.Save the file in the current working directory as explain-diff-<short-slug>.html (or where the user asked), and give the user the path. Offer in one line to publish it as a shareable page if the environment supports that.
worldPos and you call it "grid coordinates", say once that they are the same thing, then stay consistent.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub ohdowon064/dstack --plugin explain-diff2 plugins ship this exact skill · first indexed Nov 20, 2026