mcpField
E
explain-diff

explain-diff

github.com/prathamdbyDevelopment6335 installsUpdated 1d ago
Repository

About explain-diff

explain-diff is a skill for developers who need to understand Git changes. It creates an evidence-linked HTML teaching page with themed explanations, a quiz, and source and output checks.

Key features

  1. 01Explains target, PR, staged, or unstaged diffs
  2. 02Groups changed paths into functional themes
  3. 03Builds an HTML page with code and quiz
  4. 04Tracks progress in a resumable ledger
  5. 05Checks evidence, page structure, and source drift

Use cases

  1. 01Reviewing a branch diff against main
  2. 02Explaining staged or worktree changes
  3. 03Creating a learning page for a pull request

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/prathamdby/skills --skill explain-diff

After installing, type/explain-diffin Claude Code to confirm it loaded.

Bundled filesREFERENCE.md

Details

From the project README

Explain diff

Flags

FlagDefaultEffect
--target <branch>mainExplain <branch>...HEAD
--pr <n|url>offExplain one PR diff and metadata
--stagedoffExplain the index
--unstagedoffExplain worktree changes
--output <path>/tmp/YYYY-MM-DD-explain-<slug>.htmlSet HTML path

The four source choices are mutually exclusive; conflicting or valueless flags are BLOCKED; bare --pr is the only value-less exception and may resolve the current branch PR. With no source flag, use the equivalent of --target main. Block when PR diff cannot be fetched. Missing optional PR metadata permits a diff-only page with no motive claims.

1. Lock source and output

Capture source identity, head SHA, exact diff, sorted paths, and SHA-256 diff hash. Empty diff is NO_CHANGES. Derive slug from sanitized branch name, PR number, or change-<head8>, capped at 40 characters.

Resolve output to an absolute path outside the repo; an explicit in-repo path is BLOCKED, never relocated. Create a missing parent. Block before overwriting a user-supplied existing file. A default output may replace only a prior artifact containing this skill's generator marker.

Record: source/hash | theme(name/paths/path-hash/gate) | evidence | output | gate | verification | terminal. Gate is lock, research, build, or verify. Persist beside the output as <output>.ledger after every gate and completed theme. Resume an active ledger only when output and source hash match; otherwise BLOCKED. Remove on success.

Done when source and safe output are immutable.

2. Group and research

Assign every changed path to a functional theme before reading surrounding code. For more than 50 paths, explain themes through representative hunks and include every sorted path without truncation. Represent a rename as old → new; list generated or binary paths under those themes and make no behavioral claim without text hunks. Give path-only inventory rows data-hunk="<path>:inventory". Use at most 12 themes, three surrounding files per theme, and 30 surrounding files total. Read direct definitions, callers, contracts, tests, and config only when a planned claim needs them.

Done when every path has a theme and each planned claim has a hunk or read-file pointer.

3. Build the teaching page

Load ./REFERENCE.md. Write one HTML file in this order: Background, Intuition, Code, Quiz. Include a table of contents, inline CSS and JavaScript, responsive layout, and only HTML or inline-SVG diagrams. Code sections group by theme, with the complete inventory for large diffs.

Every factual sentence about the change traces to a hunk. Every system claim traces to a surrounding file. Remove unsupported intent, motive, or PR claims.

Done when the file exists with all four non-empty sections and five grounded quiz questions.

4. Verify and report

Apply the reference checklist. Verify no external asset URL, all anchors, generator marker, code whitespace, evidence pointers, and quiz answer feedback. When a browser tool exists, load the file and test one correct and one incorrect answer for every question; otherwise parse JavaScript and HTML and disclose verification: static-only. A browser run reports verification: browser. Recompute the live source fingerprint before SUCCESS; drift is BLOCKED so the page never mixes snapshots.

After interruption, compare source hash and ledger. Restart changed themes; otherwise continue at the first incomplete gate.

Report absolute path, source, theme and file counts, quiz count, and verification level. Do not paste the HTML. Terminal values are SUCCESS, NO_CHANGES, and BLOCKED. Never commit, push, or mutate a PR.

Comments

Markdown supported