返回顶部
d

debugging调试助手

Debugging assistant. Analyzes error logs, suggests breakpoints, traces execution flow, and helps identify root causes of issues.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
112
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

debugging

调试助手

调试助手,分析错误日志、建议断点、追踪执行流程、帮助识别问题根因。

版本: 1.0
功能: 错误分析、断点建议、执行追踪、根因分析



快速开始

1. 分析错误日志

bash

分析 Python 错误


python3 scripts/main.py analyze-error 回溯 (最近一次调用):...

从文件分析

python3 scripts/main.py analyze-error --file error.log

2. 建议断点

bash

为代码建议断点位置


python3 scripts/main.py suggest-breakpoints --file src/main.py

针对特定函数

python3 scripts/main.py suggest-breakpoints --function process_data

3. 追踪执行

bash

追踪函数调用


python3 scripts/main.py trace --file src/app.py --function handle_request


命令


命令说明示例
analyze-error分析错误analyze-error 回溯...
suggest-breakpoints
建议断点 | suggest-breakpoints --file src.py |
| trace | 追踪执行 | trace --file src.py --function foo |


错误分析

Python 回溯分析

bash
$ python3 scripts/main.py analyze-error 回溯 (最近一次调用):
文件 src/auth.py, 第 45 行, 在 login
user = db.get_user(username)
文件 src/db.py, 第 23 行, 在 get_user
cursor.execute(query, (username,))
psycopg2.OperationalError: 连接已关闭

🔍 错误分析
=================

类型: 数据库连接错误
严重程度: 🔴 高

根因:
在执行查询之前,数据库连接已关闭。

可能原因:

  1. 1. 连接池耗尽
  2. 连接超时
  3. 数据库服务器重启

建议修复:

  1. 1. 检查连接池设置
  2. 实现连接重试逻辑
  3. 添加连接健康检查

文件: src/db.py:23
函数: get_user

常见错误模式

自动识别:

  • - ImportError / ModuleNotFoundError - 导入问题
  • AttributeError - 属性访问错误
  • KeyError / IndexError - 数据访问错误
  • TypeError - 类型错误
  • ConnectionError - 网络/连接错误
  • TimeoutError - 超时错误



断点建议

bash
$ python3 scripts/main.py suggest-breakpoints --file src/payment.py

🔍 断点建议
=========================

高优先级:
第 45 行: process_payment() - 入口点
第 67 行: validate_card() - 验证逻辑
第 89 行: charge_customer() - 外部 API 调用

中优先级:
第 34 行: calculate_total() - 业务逻辑
第 56 行: apply_discount() - 条件逻辑

提示:

  • - 在外部 API 调用前设置断点
  • 监视变量: amount, currency, customer_id



执行追踪

bash
$ python3 scripts/main.py trace --file src/api.py --function handle_request

🔍 执行追踪
==================

函数: handle_request
文件: src/api.py:23

调用图:
handle_request
├── authenticate_user
│ └── verify_token
├── validate_request
│ └── check_schema
├── process_data
│ ├── fetchfromdb
│ └── cache_result
└── format_response

潜在问题:

  • - processdata 中缺少错误处理
  • 外部调用 fetchfrom_db (第 67 行)



配置

.debugging.json:

json
{
breakpoints: {
beforeexternalcalls: true,
before_conditionals: true,
inerrorhandlers: true
},
error_patterns: {
ignore: [DeprecationWarning],
highlight: [SecurityError, DataLossError]
}
}



示例

场景 1:排查崩溃问题

bash

1. 复制错误信息


python3 main.py analyze-error $(cat error.log)

2. 根据分析设置断点

python3 main.py suggest-breakpoints --file src/crash_point.py

3. 追踪相关函数

python3 main.py trace --function problematic_function

场景 2:性能问题排查

bash

追踪执行路径


python3 main.py trace --file src/slow_endpoint.py --function handler

识别冗余调用

场景 3:API 错误调试

bash

分析 API 错误响应


python3 main.py analyze-error HTTP 500: 内部服务器错误

检查 API 处理代码

python3 main.py suggest-breakpoints --file src/api/handlers.py

文件

skills/debugging/
├── SKILL.md # 本文件
└── scripts/
├── main.py # ⭐ 统一入口
├── error_analyzer.py # 错误分析器
└── tracer.py # 执行追踪器



路线图

  • - [x] Python 错误分析
  • [ ] JavaScript 错误分析
  • [ ] 交互式调试器集成
  • [ ] 日志文件监控

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 openclaw-debugger-1775888897 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 openclaw-debugger-1775888897 技能

通过命令行安装

skillhub install openclaw-debugger-1775888897

下载

⬇ 下载 debugging v1.0.0(免费)

文件大小: 5.54 KB | 发布时间: 2026-4-12 10:49

v1.0.0 最新 2026-4-12 10:49
Debugging assistant with error analysis, breakpoint suggestions, and execution tracing

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部