
Understand Diff
Install understand-diff to map git diffs and pull requests onto your Understand Anything knowledge graph so you see affected components and risks before merge or release.
Overview
understand-diff is an agent skill most often used in Ship review (also Operate iterate, Build integrations) that analyzes git diffs and pull requests against your knowledge graph to surface affected components and risks.
Install
npx skills add https://github.com/lum1104/understand-anything --skill understand-diffWhat is this skill?
- Analyzes current git diffs or PRs against `.understand-anything/knowledge-graph.json`
- Documents graph node types (file, function, class, endpoint, flow, etc.) and edge semantics
- Efficient read strategy: Grep the JSON first, avoid dumping the full graph into context
- Supports layers and tour metadata for scoped impact reasoning
- Keyed edge types: imports, calls, depends_on, deploys, triggers, and related relations
Adoption & trust: 752 installs on skills.sh; 54.9k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You have a git diff or PR but cannot quickly see which modules, services, or documented flows it touches or what might break downstream.
Who is it for?
Repos that already maintain `.understand-anything/knowledge-graph.json` and need structured PR or diff impact analysis before merge.
Skip if: Greenfield repos with no knowledge graph, or changes where you only need line-by-line style nits without architectural linkage.
When should I use this skill?
Use when you need to analyze git diffs or pull requests to understand what changed, affected components, and risks.
What do I get? / Deliverables
You get a graph-informed read of changed areas, related nodes and edges, and risk-focused context without loading the entire knowledge graph into the agent session.
- Impact-oriented summary of diff vs graph nodes and edges
- Risk and affected-component notes for review
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Canonical shelf is Ship review because the skill is triggered for diff and PR analysis—the core pre-merge quality gate. Review subphase matches explicit triggers for understanding what changed, impacted nodes, and risk in incoming changes.
Where it fits
Before merging a feature PR, trace diff-touched files to endpoint and service nodes for blast-radius notes.
After a production hotfix, compare the small diff against flow and deploy edges to see what still needs validation.
While integrating a third-party API, use the graph to see which modules and config nodes the diff actually rewires.
How it compares
Use instead of skimming file lists alone when you want diff review anchored to a persisted architecture graph.
Common Questions / FAQ
Who is understand-diff for?
understand-diff is for solo and indie builders who run Understand Anything and want agent-assisted PR and diff review tied to a knowledge graph.
When should I use understand-diff?
Use it in Ship review before merging PRs; in Operate iterate when assessing hotfix diffs; and in Build integrations when a large change touches many graph-linked services or endpoints.
Is understand-diff safe to install?
Review the Security Audits panel on this Prism page; the skill reads project git state and a local JSON graph—confirm repo contents and graph data before running in CI or shared environments.
SKILL.md
READMESKILL.md - Understand Diff
# /understand-diff Analyze the current code changes against the knowledge graph at `.understand-anything/knowledge-graph.json`. ## Graph Structure Reference The knowledge graph JSON has this structure: - `project` — {name, description, languages, frameworks, analyzedAt, gitCommitHash} - `nodes[]` — each has {id, type, name, filePath?, summary, tags[], complexity, languageNotes?} - Code node types: file, function, class, module, concept - Non-code node types: config, document, service, table, endpoint, pipeline, schema, resource - Domain/knowledge node types: domain, flow, step, article, entity, topic, claim, source - IDs use the node type as prefix, e.g. `file:path`, `function:path:name`, `config:path`, `article:path` - `edges[]` — each has {source, target, type, direction, weight} - Key types: imports, contains, calls, depends_on, configures, documents, deploys, triggers, contains_flow, flow_step, related, cites - `layers[]` — each has {id, name, description, nodeIds[]} - `tour[]` — each has {order, title, description, nodeIds[]} ## How to Read Efficiently 1. Use Grep to search within the JSON for relevant entries BEFORE reading the full file 2. Only read sections you need — don't dump the entire graph into context 3. Node names and summaries are the most useful fields for understanding 4. Edges tell you how components connect — follow imports and calls for dependency chains ## Instructions 1. Check that `.understand-anything/knowledge-graph.json` exists. If not, tell the user to run `/understand` first. 2. **Get the changed files list** (do NOT read the graph yet): - If on a branch with uncommitted changes: `git diff --name-only` - If on a feature branch: `git diff main...HEAD --name-only` (or the base branch) - If the user specifies a PR number: get the diff from that PR 3. **Read project metadata only** — use Grep or Read with a line limit to extract just the `"project"` section for context. 4. **Find nodes for changed files** — for each changed file path, use Grep to search the knowledge graph for: - Nodes with matching `"filePath"` values (e.g., `grep "changed/file/path"`) - This finds file-level nodes (including non-code types) AND function/class nodes defined in those files - Note the `id` values of all matched nodes 5. **Find connected edges (1-hop)** — for each matched node ID, Grep for that ID in the edges to find: - What imports or depends on the changed nodes (upstream callers) - What the changed nodes import or call (downstream dependencies) - These are the "affected components" — things that might break or need updating 6. **Identify affected layers** — Grep for the matched node IDs in the `"layers"` section to determine which architectural layers are touched. 7. **Provide structured analysis**: - **Changed Components**: What was directly modified (with summaries from matched nodes) - **Affected Components**: What might be impacted (from 1-hop edges) - **Affected Layers**: Which architectural layers are touched and cross-layer concerns - **Risk Assessment**: Based on node `complexity` values, number of cross-layer edges, and blast radius (number of affected components) - Suggest what to review carefully and any potential issues 8. **Write diff overlay for dashboard** — after producing the analysis, write the diff data to `.understand-anything/diff-overlay.json` so the dashboard can visualize changed and affected components. The file contains: ```json { "version": "1.0.0", "baseBranch": "<the base branch used>", "generatedAt": "<ISO timestamp>", "changedFiles": ["<list of changed file paths>"], "changedNodeIds": ["<node IDs from step 4>"], "affectedNodeIds": ["<node IDs from step 5, excluding changedNodeIds>"] } ``` After writing, tell the user the