К основному содержанию
скилл Claude Code CX Codex Cursor GitHub Copilot

understand-diff — скилл для Claude Code: что делает и как установить

Скилл сопоставляет изменения в Git с графом знаний проекта, чтобы оценить затронутые компоненты и радиус поломки. Пригодится перед ревью пуллреквестов.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add Egonex-AI/Understand-Anything --skill understand-diff -a claude-code
Открыть на GitHub

Что делает understand-diff

Скилл анализирует вывод git diff против графа знаний из директории .ua/ или устаревшей .understand-anything/. Сначала агент проверяет свежесть графа по коммиту gitCommitHash. Если в рабочей копии есть новые правки исходников, скилл предупредит о возможном расхождении данных.

Через поиск по файлу knowledge-graph.json скилл находит узлы изменённых файлов, их функции и классы, а затем ищет входящие и исходящие связи на один шаг. Это позволяет увидеть вызывающий код и зависимости, которые могут сломаться. Результат делится на изменённые компоненты, затронутые слои архитектуры и расчёт риска по сложности узлов.

Без предварительно собранного графа скилл бесполезен: он сразу потребует сначала запустить команду /understand. В конце анализа инструмент сохраняет файл $UA_DIR/diff-overlay.json, чтобы изменения можно было открыть в визуальном дашборде.

Какие задачи решает

  • оценить риски и радиус поломки перед слиянием ветки
  • найти зависимые компоненты и вызовы первого уровня для изменённых файлов
  • проверить влияние правок на архитектурные слои проекта
  • выгрузить оверлей изменений для визуального дашборда

Примеры запросов агенту

  • /understand-diff
  • Покажи, какие компоненты затронуты изменениями в ветке
  • Оцени риски правок в текущем диффе через граф знаний

Как установить understand-diff

1Через Skills CLI (Vercel)

npx skills add Egonex-AI/Understand-Anything --skill understand-diff -a claude-code

2Вручную: положить файлы

~/.claude/skills/understand-diff/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/understand-diff/

Из того же набора8

Весь набор →
understand Egonex-AI Анализирует кодовую базу и создаёт интерактивный граф знаний об архитектуре, компонентах и связях между ними. Пригодится, чтобы разобраться в существующем проекте. Claude Code CX Codex Cursor +1 5 200установок understand-dashboard Egonex-AI Запускает веб-дашборд с графом знаний кодовой базы. Нужен, когда структуру проекта удобнее изучать визуально. Claude Code CX Codex Cursor +1 3 800установок understand-explain Egonex-AI Скилл объясняет файл, функцию или модуль по графу знаний проекта: связи, слои, поток данных. Пригодится, когда нужно разобраться в чужом коде. Claude Code CX Codex Cursor +1 3 800установок understand-onboard Egonex-AI Скилл генерирует руководство по онбордингу новых разработчиков в проект на основе графа знаний. Пригодится при подключении новичков к кодовой базе. Claude Code CX Codex Cursor +1 3 700установок understand-chat Egonex-AI Скилл отвечает на вопросы о структуре и связях в коде, используя граф знаний проекта. Нужен, если вы разбираетесь в чужом коде или ищете, где что лежит. Claude Code CX Codex Cursor +1 3 700установок understand-domain Egonex-AI Изучает кодовую базу и строит интерактивную схему бизнес-доменов и процессов. Пригодится, чтобы увидеть, как части проекта связаны между собой. Claude Code CX Codex Cursor +1 3 500установок understand-knowledge Egonex-AI Анализирует wiki-базу знаний в стиле Karpathy и строит интерактивный граф сущностей, связей и тем. Подходит для разборки структурированных заметок. Claude Code CX Codex Cursor +1 3 400установок

Похожие

terminal-ops affaan-m Скилл для работы с репозиторием через терминал: запускает команды, читает состояние git, разбирает падения CI и делает точечные правки с доказательством того, что проверено. Claude Code CX Codex Cursor +1 4 400установок safety-guard affaan-m Перехватывает опасные команды и ограничивает запись выбранной директорией. Пригодится для автономной работы агента и чувствительных изменений в проекте. Claude Code CX Codex Cursor +1 4 400установок project-graveyard Shubham Saboo Скилл сканирует локальные папки с пет-проектами, находит причины остановки по истории git и выбирает один репозиторий для завершения. Claude Code CX Codex Cursor +1 2 000установок create-agentsmd официальный github Создаёт AGENTS.md с контекстом и инструкциями для кодинговых агентов. Подойдёт, если проекту нужны понятные правила разработки в одном файле. GitHub Copilot 13 104установок agentmemory-hooks rohitg00 Скилл объясняет, как хуки agentmemory записывают наблюдения по ходу сессии. Пригодится, если нужно понять, что сохраняется, или разобраться, почему наблюдения пропускаются. Claude Code CX Codex Cursor +1 10 700установок security-ownership-map официальный openai Строит карту «люди — файлы» из git-истории, считает bus factor и находит чувствительный код, за который отвечает слишком мало людей. Claude Code CX Codex Cursor +1 3 800установок triage Matt Pocock Скилл проводит issue и внешние PR через роли триажа, проверку и подготовку брифа для агента. Подойдёт мейнтейнеру, который разбирает очередь задач. Claude Code 990 453установок code-review Matt Pocock Проверяет изменения от выбранной точки по стандартам репозитория и требованиям задачи. Нужен для ревью ветки, PR или незавершённой работы. Claude Code 789 521установок

Вопросы о understand-diff

Как установить understand-diff в Claude Code?

Выполните команду npx skills add Egonex-AI/Understand-Anything --skill understand-diff -a claude-code. Файл скилла запишется в проект или глобальный каталог агента.

Что делает understand-diff?

Скилл берёт изменённые файлы из git diff, сопоставляет их с файлом knowledge-graph.json и определяет прямые зависимости и архитектурные слои, попавшие под удар. В конце он формирует отчёт об оценке рисков и создаёт файл оверлея.

Что делать, если файл knowledge-graph.json отсутствует?

Скилл остановит проверку и попросит сначала вызвать команду /understand. Граф необходим для поиска связей между узлами проекта.

Исходный текст

SKILL.md · MIT
---
name: understand-diff
description: Use when you need to analyze git diffs or pull requests to understand what changed, affected components, and risks
---

# /understand-diff

Analyze the current code changes against the knowledge graph in the project's data directory (`.ua/knowledge-graph.json`, or the legacy `.understand-anything/knowledge-graph.json` when that directory is present).

## 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. **Resolve the data directory `$UA_DIR`.** Run `UA_DIR=$([ -d .understand-anything ] && echo .understand-anything || echo .ua)` — this is the legacy `.understand-anything/` when it already exists, otherwise the new `.ua/`. Check that `$UA_DIR/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 and check graph freshness** — use Grep or Read with a line limit to extract the `"project"` section, including `gitCommitHash` as `GRAPH_COMMIT_RAW`, then:
   - Resolve it as a commit before using it in any Git diff. From the project root, compare the resolved commit with `git rev-parse HEAD` and inspect project-scoped committed and working-tree changes:
     ```bash
     GRAPH_COMMIT=$(git rev-parse --verify --end-of-options "${GRAPH_COMMIT_RAW}^{commit}" 2>/dev/null)
     git rev-parse HEAD
     git diff --name-only "$GRAPH_COMMIT" HEAD -- .
     git diff --cached --name-only -- .
     git diff --name-only -- .
     git ls-files --others --exclude-standard -- .
     ```
   - The `-- .` pathspec is required: commits that only touch a sibling monorepo project must not make this graph stale. A hash mismatch alone is not stale when the project diff is empty.
   - Ignore the selected data directory (`.ua/` or legacy `.understand-anything/`) in every command's output because it contains generated graph artifacts, not project source drift.
   - If the committed diff or any working-tree command reports project files, warn before impact analysis that the graph may omit those changes. Suggest: Run `/understand` to refresh the graph.
   - Run the commit diff only when `GRAPH_COMMIT_RAW` resolves successfully. If the graph commit or Git metadata is missing, invalid, or unavailable, give a brief best-effort warning and continue instead of blocking.

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 `$UA_DIR/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 they can run `/understand-anything:understand-dashboard` to see the diff overlay visually.

© Egonex-AI · MIT · Egonex-AI/Understand-Anything

Смотрите также

Спонсоры проекта

Компании, которые помогают держать аналитику открытой