본문으로 건너뛰기
Skillpedia
일반 코딩87k · #1366

understand-diff

하는 일

코드 변경을 분석해 무엇이 바뀌었는지, 어떤 프로젝트 부분이 영향을 받는지, 위험이 무엇인지 이해하도록 돕습니다.

사용하는 경우

  • ✓다른 사람의 코드를 검토할 때.
  • ✓내 변경 사항을 주 프로젝트에 합치기 전.
  • ✓변경이 미치는 영향을 이해하고 싶을 때.

스킬 링크

https://github.com/Egonex-AI/Understand-Anything/blob/main/understand-anything-plugin/skills/understand-diff/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/Egonex-AI/Understand-Anything/blob/main/understand-anything-plugin/skills/understand-diff/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“이 코드의 변경 사항을 분석하고, 무엇이 영향을 받을 수 있는지 알려 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

도구는 코드 변경을 프로젝트의 '지도'(지식 그래프)와 비교합니다. 이 지도는 코드 부분들이 어떻게 연결되는지 보여 줍니다. 그다음 직접 바뀐 것과 이 변경에 영향을 받을 수 있는 것을 찾아냅니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

/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:
      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:

…

자주 묻는 질문

'지식 그래프'는 무엇인가요?

파일과 다른 구성 요소 사이의 연결을 보여 주는, 프로젝트의 자세한 지도와 같습니다.

'위험(risks)'은 무엇을 뜻하나요?

변경이 프로젝트의 다른 부분에 문제를 일으킬 가능성입니다. 도구는 이런 연결을 찾아 잠재적 문제를 경고하려고 합니다.

'지식 그래프'를 미리 준비해야 하나요?

네, 이 도구는 프로젝트 지도가 있어야 작동합니다. 지도가 없다면 이를 만드는 이전 명령을 먼저 실행해야 합니다.

상세 정보

작성자의 원본 설명

Use when you need to analyze git diffs or pull requests to understand what changed, affected components, and risks

repo: Egonex-AI/Understand-Anything

인기도

GitHub 스타
87k
순위
#1366
라이선스
MIT
업데이트
2026. 10. 12.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬