understand-diff
БесплатноБез исполняемых скриптовНе проверенWorks out what a branch, pull request or uncommitted change touches and who depends on it, using the knowledge graph built by the Understand-Anything plugin…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
/understand-diff: Impact of a Change with Understand-Anything
Overview
Understand-Anything is an open-source plugin for coding agents. Its /understand command analyses a repository and stores a knowledge graph as JSON; /understand-diff lays a set of changes over that graph. A plain diff shows which lines moved. The graph adds what a reviewer usually has to reconstruct by hand: which functions those lines belong to, which routes, jobs, tables, tests and documents are wired to them, and which architectural layers the change crosses.
This skill does that job in a checkable way. It maps the diff to graph nodes by line number, walks one relationship outward, turns the result into a short impact note with a risk level, and saves diff-overlay.json so the dashboard can colour the changed and affected nodes.
What it relies on in the graph file:
| Part | Used for |
|---|---|
project.gitCommitHash, project.analyzedAt |
deciding whether the graph still describes the code under review |
nodes[]: id, type, filePath, lineRange, complexity, summary |
mapping changed lines to files, functions, classes, tables, pipelines |
edges[]: source, target, type |
finding what leans on a changed node |
layers[]: name, nodeIds |
telling a local change from one that crosses a boundary |
No graph yet: install the plugin (/plugin marketplace add Egonex-AI/Understand-Anything, then /plugin install understand-anything in Claude Code) and run /understand once. The understand-chat skill has the full installation and analysis notes.
Instructions
1. Pin down the two ends of the comparison
Ask only what the request leaves open: which change (working tree, current branch, a named branch, a pull request number) and against which base. Then resolve both to commits:
G=.ua/knowledge-graph.json
[ -d .understand-anything ] && G=.understand-anything/knowledge-graph.json
BASE=$(git symbolic-ref --quiet --short refs/remotes/origin/HEAD || echo origin/main)
FORK=$(git merge-base "$BASE" HEAD)
SHA=$(jq -r '.project.gitCommitHash' "$G")
FORK is the commit where the branch left the base. Comparing against it, and not against the tip of the base, keeps other people's merged work out of the result. For a GitHub pull request that is not checked out, git fetch origin pull/482/head and use FETCH_HEAD in place of HEAD here and as a second commit in the next command.
A missing graph file ends the job with one sentence: the project needs /understand first. Inside a git worktree the graph is kept in the main checkout, so look there before giving up.
2. Capture the diff with zero context
git -c core.quotePath=false diff -U0 --no-color --no-ext-diff --no-renames \
--src-prefix=a/ --dst-prefix=b/ "$FORK" \
-- . ':(exclude).ua' ':(exclude).understand-anything' > /tmp/ua-change.diff
git ls-files --others --exclude-standard -- . ':(exclude).ua' ':(exclude).understand-anything' > /tmp/ua-untracked.txt
With a single commit argument git compares that commit with the working tree, so committed, staged and unstaged edits all land in one diff. -U0 makes every hunk header state exactly which old lines were replaced. --no-renames reports a moved file as a deletion plus an addition, which is what the graph needs: the old path is the one it knows. Brand-new files that were never added to git appear only in the second list.
3. Check that graph line numbers and diff line numbers agree
The graph's lineRange values describe the files as they were at SHA. The diff's old-side numbers describe them at FORK. They line up when the changed files did not move between those two commits:
git rev-parse --verify --quiet "$SHA^{commit}" >/dev/null &&
git diff --name-only "$SHA" "$FORK" -- $(grep -h '^+++ b/\|^--- a/' /tmp/ua-change.diff | cut -c7- | sort -u)
| Result | Meaning | Action |
|---|---|---|
| no output | ranges and hunks match | continue |
| some files listed | those files changed on the base after the analysis | pass them to the script as whole-file arguments, and say so in the note |
SHA does not resolve |
shallow clone or rewritten history | pass every changed file as a whole-file argument; label the result "file level only" |
| most of the diff is listed, or the graph is months old | the graph describes a different codebase | recommend /understand on the base branch first (incremental runs re-analyse only changed files) |
4. Map the change onto the graph
Save this as ua-impact.mjs outside the repository or in a scratch folder. It reads the diff on standard input; arguments are the graph, a label for the base, then any whole-file paths (untracked files and the drifted files from step 3).
import { readFileSync, writeFileSync } from "node:fs";
import { dirname, join } from "node:path";
const [graphPath, baseName, ...wholeFiles] = process.argv.slice(2);
const g = JSON.parse(readFileSync(graphPath, "utf8"));
Установить understand-diff в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл understand-diff?
Works out what a branch, pull request or uncommitted change touches and who depends on it, using the knowledge graph built by the Understand-Anything plugin, then writes the overlay file its dashboard highlights. Use when someone says "what does this diff affect", "review the impact of this PR", "what could this change break", "which tests should I run for this branch", "run /understand-diff", "show the blast radius", or wants a risk note on a change before review or merge.
Как установить скилл understand-diff?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл understand-diff запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic