关于 gitnexus-debugging
gitnexus-debugging 是面向开发者和编码 Agent 的 GitNexus 调试流程技能,用于调查错误或异常行为。它指导搜索代码、检查符号上下文和追踪执行过程,以定位故障发生处。
主要功能
- 01搜索代码与执行流程
- 02检查符号的调用方和被调用方
- 03追踪仓库流程
- 04构建自定义调用链查询
- 05查找符号间最短路径
适用场景
- 01调查错误信息或失败函数
- 02追踪端点的执行路径
- 03定位调用链中断位置
- 04检查近期变更是否引入回归
MCP 相关
该技能使用 query、context、cypher 和 trace 等 GitNexus MCP 工具,并读取流程资源来追踪代码执行。
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ arenukvern/ mcp_flutter --skill gitnexus-debugging安装后在 Claude Code 中输入/gitnexus-debugging确认已加载。
详细介绍
使用 GitNexus 调试
适用场景
- “为什么这个函数会失败?”
- “追踪此错误的来源”
- “谁调用了此方法?”
- “此端点返回 500”
- 调查 Bug、错误或意外行为
工作流
1. query({search_query: "<error or symptom>"}) → Find related execution flows
2. context({name: "<suspect>"}) → See callers/callees/processes
3. READ gitnexus://repo/{name}/process/{name} → Trace execution flow
4. cypher({statement: "MATCH path..."}) → Custom traces if needed
如果出现“索引已过期”,请在终端中运行
node .gitnexus/run.cjs analyze。
检查清单
- [ ] Understand the symptom (error message, unexpected behavior)
- [ ] query for error text or related code
- [ ] Identify the suspect function from returned processes
- [ ] context to see callers and callees
- [ ] Trace execution flow via process resource if applicable
- [ ] cypher for custom call chain traces if needed
- [ ] Read source files to confirm root cause
调试模式
| 症状 | GitNexus 方法 |
|---|---|
| 错误消息 | 使用 query 搜索错误文本 → 对抛出错误的位置使用 context |
| 返回值错误 | 对函数使用 context → 追踪被调用函数,了解数据流 |
| 间歇性故障 | 使用 context → 查找外部调用、异步依赖 |
| 性能问题 | 使用 context → 找出调用者较多的符号(热点路径) |
| 最近出现回归 | 使用 detect_changes 查看更改影响的内容 |
| “A 如何到达 B?” | 使用 trace 追踪两个符号之间的路径——一次调用即可找到最短调用链 |
工具
query — 查找与错误相关的代码:
query({search_query: "payment validation error"})
→ Processes: CheckoutFlow, ErrorHandling
→ Symbols: validatePayment, handlePaymentError, PaymentException
context — 获取可疑代码的完整上下文:
context({name: "validatePayment"})
→ Incoming calls: processCheckout, webhookHandler
→ Outgoing calls: verifyCard, fetchRates (external API!)
→ Processes: CheckoutFlow (step 3/7)
cypher — 自定义调用链追踪:
MATCH path = (a)-[:CodeRelation {type: 'CALLS'}*1..2]->(b:Function {name: "validatePayment"})
RETURN [n IN nodes(path) | n.name] AS chain
trace — 查找两个符号之间的最短调用链(“A 如何到达 B?”),只需调用一次,无需串联多个 context 跳转:
trace({ from: "processCheckout", to: "fetchRates" })
→ status: ok, hopCount: 3
→ hops: processCheckout → validatePayment → verifyCard → fetchRates
→ edges: CALLS (1.0), CALLS (0.95), CALLS (1.0)
如果不存在路径,trace 会报告最远的可达节点,也就是调用链中断的确切位置(动态分派、反射或外部边界)。
示例:“支付端点间歇性返回 500”
1. query({search_query: "payment error handling"})
→ Processes: CheckoutFlow, ErrorHandling
→ Symbols: validatePayment, handlePaymentError
2. context({name: "validatePayment"})
→ Outgoing calls: verifyCard, fetchRates (external API!)
3. READ gitnexus://repo/my-app/process/CheckoutFlow
→ Step 3: validatePayment → calls fetchRates (external)
4. Root cause: fetchRates calls external API without proper timeout
评论
支持 Markdown