AI has definitely made writing code faster, but understanding that code is a different story.
You open a pull request and see changes across controllers, services, utilities, tests, and configuration files. Git lists them file by file, which is rarely the order in which the code runs.
Take jsdom v30.1.0. Its release notes read like a list of small fixes, yet the release changed 417 files, 127 of them under lib/. Behind those fixes, jsdom had stopped storing its document tree in a general-purpose library and written its own. Where would you start if you wanted to understand that release?
I've always found reviewing PRs a good way to learn a codebase. You can follow the changes, understand the decisions, and slowly build a mental model of how things work. I didn't want to lose that as AI-generated changes became more common.
Why not just ask an agent to summarize the PR? You can. But I wanted something more structured: a walkthrough that follows the code as it runs, with each claim easy to check against the source. So I built explain-diff-html, an agent skill that writes that kind of walkthrough as a single HTML page.
Generating the page turned out to be the easy part. Most of what I learned came from making its claims checkable.
What the skill does
The skill takes a pull request, branch, or commit range and writes a single HTML page. It reads the diff and the code around it to follow the path the change takes, for example:
request → handler → service → transformation → result The page has four sections. Background introduces the concepts the change depends on. Intuition explains the main idea, sometimes with a diagram or a small example. The code walkthrough follows the code paths, with references back to the source. The quiz checks whether you understood the reasoning behind the change.
That format isn't my invention. The project started from Geoffrey Litt's explain-diff gist, which introduced the four sections, the closing quiz, and the single HTML page. The name came from his work too. I also adapted some question patterns from Cat Hicks' learning-opportunities skill.
Here's a small example from TanStack Query PR #11305. The fix removes seven characters, ?.error, from one line. That check tested whether the error was truthy. So an error with a falsy value, such as Promise.reject() with no reason, never reached React's error boundary. The explanation walks through why. Each file:line reference in it links to the exact commit, so you can open the source and check it yourself.
You can browse the nine published samples without installing anything. Setup is at the end.
A polished page can still be wrong
I used AI while building and maintaining the skill. It helped me write code, explore changes, and compare approaches. That made checking the output more important, because I couldn't assume something was correct just because an agent produced it. A generated page can look polished and still contain broken links, misleading statements, or wrong references.
Over time, I added several layers of checks. Some validate the generated page. Others test whether those checks work. Each arrow names what one layer can miss and the next one can catch:
Link every claim to the exact code
Early versions of the skill wrote references such as fastapi/routing.py:1551 with no link. To check one, a reader had to open the repository, find the commit, navigate to the file, and find the line. When I checked the published samples, I found 34 of these references across eight pages, and none of them linked anywhere.
Now each reference links to GitHub at the commit the page explains. A link to a branch would drift, because a branch keeps moving and the explanation doesn't.
Markdown files needed one more fix. GitHub shows a Markdown file rendered by default, and the rendered view ignores a line anchor. A link to line 109 of FastAPI's docs/en/docs/tutorial/frontend.md opened at the top of the page. During one run, the agent added ?plain=1 to its Markdown links on its own, which opens the source view at the right line. A model that stumbles on the right fix once may not stumble on it again. So I made ?plain=1 a rule and added a check for it to the validator.
Check what a link carries before you share it
A contributor found this problem. The skill builds GitHub links from the local repository's remote URL, and in some CI environments that URL carries an access token:
https://x-access-token:<token>@github.com/owner/repo.git If the skill copied that URL into the generated links, it could expose the token when someone shared the page.
The contributor fixed it. The link builder now strips credentials from the remote, names the full commit hash in every link, and links only to github.com.
A source link looks harmless. It carries whatever it was built from, so anything that publishes links has to check what's inside first.
Prove that each check can fail
A validator that passes every page may not be checking anything. The first validator used grep, sed, and awk to inspect the generated HTML. It checked source references, links, and the quiz. Every sample passed, and CI was green.
Then a contributor tested it against pages built to break it. Some invalid pages passed and some valid pages failed. An unlinked file reference could pass if another source link appeared elsewhere on the page. Moving an attribute earlier in a tag could make a valid page fail. Text patterns can't read HTML the way a browser does.
Before the replacement started, I asked for one more thing: tests that prove each check can fail. Each check gets a deliberately broken page. A page with a short commit hash should fail the commit check, and a Markdown link without ?plain=1 should fail the Markdown check. The same goes for a quiz that names an option by position. Each broken page fails its own check and no other, and one clean page passes everything.
The contributor's replacement delivered both. The new validator parses the page into a tree and queries the real elements, and the regression suite has a failing page for each check. A green run means more now, because we have seen each check catch the problem it claims to catch.
While reviewing the replacement, I found that the bundled validator failed to load in a project whose package.json says "type": "commonjs". The bundle uses JavaScript modules, and an installed copy took its module type from the user's project. So the skill could work in one project and fail in another, and the error would have looked like a missing Node install. The contributor fixed it by giving the bundle its own module setting and added a test that runs it inside a CommonJS project. A tool that installs into other people's projects needs a test inside one of them. We didn't catch everything. Each bug we did catch changed how we tested the next one.
Decide what a generated page may publish
A validator can check structure, links, and some output rules. It can't decide whether a page makes a fair claim about someone else's work. That takes rules about what a page may publish.
One of the published uPortal samples said it couldn't verify some details about earlier pull requests and branches, but it didn't name them. A reader learned that something was unverified and got nothing to go and check. I wrote this up as an issue. Now, when a page says it couldn't verify something, it names the public artifact. A pull request number, a branch, or a commit gives the reader somewhere to go.
The same page also questioned whether a real uPortal contributor had been credited correctly for some work. It was careful about its uncertainty, but it couldn't settle what had happened, and the question had nothing to do with the code change. I didn't think a generated page should publish unresolved questions about a person's contribution or credit, however carefully it hedged them.
A contributor wrote both rules into the skill. They couldn't run the skill to regenerate the sample, so I regenerated it under the new rules. The rules apply to every page, because the agent writing a page doesn't know whether the user will publish it.
One run can't tell you whether a prompt change helped
A prompt doesn't produce the same result twice the way a program does. Give it the same pull request and the same instructions, and you get a different explanation each time. Six runs on one PR produced pages from 2,245 to 2,552 words. With that much spread, the difference between one run before a change and one run after it may be noise.
So I judge each change on several things at once. Did the page get shorter? Did it still cover the important behavior? Did the background run longer than the code walkthrough? Did the quiz test understanding, or only whether you remembered a sentence?
Different readers also need different depths. Someone new to a codebase needs an introduction to its concepts. Someone who maintains that code doesn't need three paragraphs on an API they already know. That led to work, still in progress, on shorter, more structured pages and separate beginner and familiar levels.
The measurements weren't always flattering. When I regenerated the nine samples under the new structure, six got shorter and three got longer. The longer ones covered more core changes. A short page that skips the important reasoning is worse than a longer one that helps the reader understand the change.
I also test when the skill should stay out of the way. Someone who asks an agent to fix a failing test hasn't asked for an HTML lesson. A request to review a PR is a different job from explaining it. My evals include requests like these and check that the skill doesn't run.
Another experiment, also in progress, gives a separate model a copy of the page without the quiz answers and asks it to take the quiz. If it can't answer from the page, the explanation may have a gap. If the page gives the answer away, the question isn't testing much.
These checks can't prove an explanation is correct. They help me tell whether a change made things better, worse, or only different.
Judge a contribution by its evidence
Contributions from people I hadn't met were one of the most unexpected parts of this project. The token fix, the new validator, and other checks came from outside contributors. That added a second job to building the tool: reviewing contributions, giving feedback, and deciding what belonged in the project.
Several contributors used AI tools to help write their pull requests. Should a maintainer treat those differently? I've settled on a simpler standard. I care whether the contributor understands the change, whether it solves the stated problem, and whether the evidence supports merging it. Whether AI helped write the code matters less. A passing test helps, and I still read the diff.
So I rerun what a PR claims. I've tested changes in throwaway repositories and run the validator script with GNU, BSD, and busybox tools. To prove a new ShellCheck step worked, I planted a warning in a script and watched it fail. I also mark each review comment as blocking or as a suggestion. If every comment sounds equally important, a contributor has to guess what must change before the PR can merge.
I'm still learning what it means to maintain an open-source project. A good review finds the problems and explains each decision, so the contributor understands it and feels comfortable contributing again.
What's next
When you explain a pull request without cloning its repository, the skill still drops the host from a GitHub Enterprise URL. Its commands can then reach the wrong GitHub server. I'd also like reports on languages the samples don't cover, Rust most of all. Both the Enterprise fix and a Rust or Go report are open to contributors. The contributing guide explains how to start, and some newcomer issues don't require changing code at all.
I don't expect every explanation to be perfect. No validator can promise that. The goal is to keep improving the checks and make failures visible, so readers can verify each explanation themselves.
I started this project to make PR reviews a better way to learn. Along the way I learned more than I expected.
How do you verify AI-generated explanations of code you didn't write? I'd love to hear how others approach this. You can tell me in an issue on GitHub.
Try it on your own PR
Install the skill:
npx skills add malav2110/explain-diff-html Then ask your coding agent to explain PR 1234. The skill works with Claude Code, Codex, Cursor, and other agents that read the skill format. To explain a pull request, you need the GitHub CLI, gh, signed in. You also need Node.js 22.18 or later, which the skill uses to check the finished page. The result is a standalone HTML page that opens in any browser.
You can also browse the samples or look through the repository. Open an issue to tell me what works, what doesn't, and where the explanations fall short.
