# /understand-diff: See what a change affects before you merge it

Source: https://trendhub.net/skills/egonex-ai-understand-anything/understand-diff
Skill folder: https://github.com/Egonex-AI/Understand-Anything/tree/main/understand-anything-plugin/skills/understand-diff
Pack: Understand Anything (https://trendhub.net/skills/egonex-ai-understand-anything)
Works with: Claude Code, Codex, Gemini CLI, OpenCode, Cline, Kiro, Trae and other agents (macOS/Linux), Windows (PowerShell), VS Code + GitHub Copilot, Copilot CLI, Devin

understand-diff compares your current changes or a pull request with the saved knowledge graph. It finds the nodes behind each changed file, follows their direct connections to list what might break, notes which architectural layers are crossed and gives a risk assessment. It also writes an overlay so the dashboard can highlight changed and affected parts.

## When to use it

- You are about to commit and want to know which callers a change could break.
- You are reviewing a pull request in a part of the codebase you do not know.
- You want a visual view of a change's reach in the dashboard.

## How it works

1. **Collect changed files**: The agent lists files from the working tree, the branch compared with main, or a named pull request before opening the graph.
2. **Check graph freshness**: It compares the graph's commit with HEAD for this project only and warns if recent changes may be missing from the graph.
3. **Find nodes and neighbours**: It greps the graph for nodes in the changed files, then follows one hop of edges to find upstream callers and downstream dependencies.
4. **Assess and overlay**: It reports changed and affected components, layers touched and risk from complexity and blast radius, then writes diff-overlay.json for the dashboard.

## What it steers the agent away from

- Loading the whole graph into context instead of searching it
- Trusting a stale graph without warning
- Reviewing a diff with no view of its dependents

## What it can touch

Runs read-only git commands, greps .ua/knowledge-graph.json and writes .ua/diff-overlay.json.

## Pairs well with

- `/understand-dashboard`
- `/understand-explain`
- `/understand`

## Questions

### Do I need to run /understand first?

Yes. Without a saved graph the skill stops and asks you to build one.

### Should the overlay file be committed?

No. The README lists diff-overlay.json as local scratch to keep out of version control.
