Tokencito Game of the day Play

What is a diff and how do you read it?

A diff is the list of differences between two versions of a file or a project: which lines were added, which were removed and where. Added lines are usually marked with a plus sign and removed ones with a minus sign. Tools like git use it to show what really changed, without relying on anyone's summary.

📝You ask for a change✏️The agent edits🔍You read the diff✂️You cut the extras

Put it to the test

A question from the app. Pick an answer.

You ask to rename a function and the diff touches many files. What do you do first?

Start playing on the web

How to read one

With made up amounts, in USD: an online store raises the minimum for free shipping. The diff shows "- freeShippingFrom = 50" and right below "+ freeShippingFrom = 60". There are not two new lines: changing a line shows up as removing the old one and adding the new one.

Around it you see a few lines with no sign: they did not change, they are there so you can place the change. Each block starts with a line saying where in the file it is, and many tools color added lines green and removed ones red.

Why read it when an agent writes the code

A coding agent finishes with a summary: "I translated the error messages". The summary is what it says it did; the diff is what it did. Checking the red lines in the tests is a good habit: if a test was failing, the agent may have deleted or loosened it so it passes.

A rule in your CLAUDE.md like "do not delete tests to make them pass" helps, but the agent can forget it. The diff does not forget: if a test was removed, there it is.

Big diffs

A big diff is not a bad diff: updating a library or running a formatter can touch dozens of files. The risk is a real change hiding among 2,000 lines of spaces and commas. Start with the file list: if one shows up that has nothing to do with the request, like the payments config, open it first.

Two tricks: ask the agent to keep formatting in a separate change, and use the hide whitespace option that many tools have. That way what stays visible is what matters.

Common mistakes

"If the tests pass, I do not need to read it." Tests do not warn you about a change nobody asked for. "The diff tells me it works." No: it tells you what changed. "Everything is in the diff." Almost: a new file git does not track yet may not show up, and a binary one, like an image, shows up with no detail.