gitnexus-impact-analysis
它能做什么
这个技能指导你的智能体在编辑之前梳理依赖某个部分的代码。适合希望避免破坏项目其他部分的开发者。
适用场景
- ✓当你即将修改某个函数,想知道有哪些代码依赖它的时候。
- ✓当你想在提交前查看改动的影响范围的时候。
- ✓当你询问某项改动是否可以安全进行的时候。
技能链接
https://github.com/abhigyanpatwari/GitNexus/blob/main/.claude/skills/gitnexus-impact-analysis/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我修改这个函数的参数安全吗?还有哪些地方在使用它?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会先确认代码仓库,然后查找调用或依赖目标的代码,并报告风险。它还会检查本地改动,让你了解这些改动会影响什么。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Impact Analysis with GitNexus
When to Use
- "Is it safe to change this function?"
- "What will break if I modify X?"
- "Show me the blast radius"
- "Who uses this code?"
- Before making non-trivial code changes
- Before committing — to understand what your changes affect
Bind the repository first
Impact analysis is the gate that authorizes an edit, so it must answer for the repository you are about to edit.
Call list_repos {} before the first tool call. With one indexed repository,
use the examples below as written. With more than one, pass repo on every
call: an omitted repo normally errors, but under an MCP policy with a
configured default it resolves to that default silently. If you cannot tell
which repository is meant, stop and ask — every result below an ambiguous
identity inherits the ambiguity. list_repos is paginated, so page with
offset: pagination.nextOffset until hasMore is false before concluding a
repository is absent.
detect_changes takes worktree when your changes are in a linked worktree
the MCP server was not launched from. The server auto-detects a worktree only
when it was launched from inside one; otherwise git diff runs in the wrong
checkout and reports zero changed symbols — a false clean check that carries
none of the degradation flags described below. In the CLI fallbacks, --repo .
means the current checkout; pass the intended repository path instead when you
are not standing in it.
State the bound identity with your risk report:
Repository: <name> (<path>) Worktree: <path> Index: <commit>, <n> behind HEAD
Workflow
0. list_repos {} → Bind repo (and worktree)
1. impact({target: "X", direction: "upstream"}) or `node .gitnexus/run.cjs impact "X" --direction upstream --repo .`
2. READ gitnexus://repo/{name}/processes → Check affected execution flows
3. detect_changes({scope: "all"}) or `node .gitnexus/run.cjs detect-changes --scope all --repo .`
4. Assess risk and report to user, echoing repo/worktree/index identity
If "Index is stale" → run
node .gitnexus/run.cjs analyzein terminal. Hot-toolstalenessnames which index answered (branch/lastCommit) and how fresh it is (status). Re-analyze only forbehindordiverged—currentis identity,unknownis unmeasurable. If.gitnexus/run.cjsis missing, replacenode .gitnexus/run.cjswithnpx gitnexusin the fallback commands.
Checklist
- [ ] list_repos {} — bind repo; explicit repo when >1 indexed, ask if ambiguous
- [ ] impact({target, direction: "upstream"}) or CLI fallback to find dependents
- [ ] Review d=1 items first (these WILL BREAK)
- [ ] Check high-confidence (>0.8) dependencies
- [ ] READ processes to check affected execution flows
- [ ] detect_changes({scope: "all"}) or CLI fallback for pre-commit check
- [ ] Confirm the checkout you edited is the checkout that was diffed
- [ ] Assess risk level and report, stating repo/worktree/index identity
Understanding Output
| Depth | Risk Level | Meaning |
|---|---|---|
| d=1 | WILL BREAK | Direct callers/importers |
| d=2 | LIKELY AFFECTED | Indirect dependencies |
| d=3 | MAY NEED TESTING | Transitive effects |
Risk Assessment
| Affected | Risk |
|---|---|
| <5 symbols, few processes | LOW |
| 5-15 symbols, 2-5 processes | MEDIUM |
| >15 symbols or many processes | HIGH |
| Critical path (auth, payments) | CRITICAL |
| Zero callers found | UNKNOWN |
UNKNOWN is not a low rung on this scale — it means the walk could not answer.
An empty caller set is equally consistent with "genuinely unused" and "the
callers are not resolvable by the index" (plain-object property access, dynamic
dispatch, cross-language calls), so few-callers ⇒ LOW does not apply. The
result carries a riskNote saying so. Confirm with a text search before
treating the symbol as safe to change or delete.
risk is the edit gate: warn on HIGH/CRITICAL and stop on UNKNOWN until the
uncertainty is resolved. Within single-repo mode, compare File and symbol
targets with local riskSharedAxes (direct/total only). Within group mode,
compare only group results: their riskSharedAxes overlays resolved
cross-repo crossings on that local value. Never use either field to waive the
常见问题
它会修改代码吗?
它的用途是在编辑前进行分析。它为改动提供依据,而不是直接进行修改。
为什么要确认代码仓库?
该技能说明,描述错误仓库的结果具有误导性,因此目标不明确时它会询问。
它能检查某个分支中的改动吗?
可以。当你指定路径时,它也可以检查关联的 git worktree 中的本地改动。
详情
作者的原始描述
Use when the user wants to know what will break if they change something, or needs safety analysis before editing code. Examples: \"Is it safe to change X?\", \"What depends on this?\", \"What will break?\"
repo: abhigyanpatwari/GitNexus
热度
- GitHub 星标
- 48k
- 排名
- #3609
- 许可证
- —
- 更新时间
- 2026/11/2
评论
- …