mcpField
D
debug

debug

github.com/parcadei开发3.9k509 次安装39 周前更新
代码仓库

关于 debug

debug 是用于排查手动测试或开发问题的 Agent 技能,不会修改文件。它通过检查日志、数据库状态、Git 历史和服务状态来指导诊断。

主要功能

  1. 01检查应用日志
  2. 02查看 SQLite 数据库状态
  3. 03检查 Git 更改与历史
  4. 04查看进程和监听端口
  5. 05整理基于证据的发现

适用场景

  1. 01排查手动测试中的错误
  2. 02追查近期代码更改后的问题

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/parcadei/continuous-claude-v3 --skill debug

安装后在 Claude Code 中输入/debug确认已加载。

详细介绍

调试

你的任务是在手动测试或实现过程中协助调试问题。此命令允许你检查日志、数据库状态和 git 历史记录来调查问题,而不会编辑文件。你可以把它看作一种启动调试会话的方式,无需占用主窗口的上下文。

初始响应

调用时带有计划/工单文件:

I'll help debug issues with [file name]. Let me understand the current state.

What specific problem are you encountering?
- What were you trying to test/implement?
- What went wrong?
- Any error messages?

I'll investigate the logs, database, and git state to help figure out what's happening.

调用时不带参数:

I'll help debug your current issue.

Please describe what's going wrong:
- What are you working on?
- What specific problem occurred?
- When did it last work?

I can investigate logs, database state, and recent changes to help identify the issue.

环境信息

你可以访问以下关键位置和工具:

日志:

  • 应用程序日志(检查项目特定的位置)
  • 常见位置:./logs/、~/.local/share/{app}/、/var/log/

数据库(如适用):

  • 可以使用 sqlite3 查询 SQLite 数据库
  • 检查项目配置以确定数据库位置

Git 状态:

  • 检查当前分支、近期提交和未提交的更改
  • 类似于 commit 和 describe_pr 命令的工作方式

服务状态:

  • 检查运行中的进程:ps aux | grep {service}
  • 检查监听端口:lsof -i :{port}

处理步骤

第 1 步:了解问题

用户描述问题后:

  1. 阅读提供的上下文(计划或工单文件):

    • 了解他们正在实现/测试的内容
    • 记录当前所处的阶段或步骤
    • 确定预期行为与实际行为
  2. 快速检查状态:

    • 当前 git 分支和近期提交
    • 是否存在未提交的更改
    • 问题从何时开始出现
第 2 步:调查问题

并行启动 Task Agent,以高效开展调查:

Task 1 - Check Recent Logs:
Find and analyze the most recent logs for errors:
1. Find latest logs: ls -t ./logs/*.log | head -1 (or project-specific location)
2. Search for errors, warnings, or issues around the problem timeframe
3. Note the working directory if shown
4. Look for stack traces or repeated errors
Return: Key errors/warnings with timestamps
Task 2 - Database State (if applicable):
Check the current database state:
1. Locate database file (check project config)
2. Connect: sqlite3 {database_path}
3. Check schema: .tables and .schema for relevant tables
4. Query recent data based on the issue
5. Look for stuck states or anomalies
Return: Relevant database findings
Task 3 - Git and File State:
Understand what changed recently:
1. Check git status and current branch
2. Look at recent commits: git log --oneline -10
3. Check uncommitted changes: git diff
4. Verify expected files exist
5. Look for any file permission issues
Return: Git state and any file issues
第 3 步:呈现调查结果

根据调查情况,提供重点明确的调试报告:

## Debug Report

### What's Wrong
[Clear statement of the issue based on evidence]

### Evidence Found

**From Logs**:
- [Error/warning with timestamp]
- [Pattern or repeated issue]

**From Database** (if applicable):
```sql
-- Relevant query and result
[Finding from database]

Git/文件方面:

  • [可能相关的近期更改]
  • [文件状态问题]
根本原因

[根据证据得出的最可能解释]

后续步骤
  1. 先尝试此方法:

    [Specific command or action]
    
  2. 如果不起作用:

    • 重启相关服务
    • 检查浏览器控制台中的前端错误
    • 启用调试标志运行
无法访问?

有些问题可能超出我的能力范围:

  • 浏览器控制台错误(在浏览器中按 F12)
  • MCP 服务内部状态
  • 系统级问题

你还希望我进一步调查某个具体问题吗?


## Important Notes

- **Focus on manual testing scenarios** - This is for debugging during implementation
- **Always require problem description** - Can't debug without knowing what's wrong
- **Read files completely** - No limit/offset when reading context
- **Think like `commit` or `describe_pr`** - Understand git state and changes
- **Guide back to user** - Some issues (browser console, MCP internals) are outside reach
- **No file editing** - Pure investigation only

## Quick Reference

**Find Latest Logs**:
```bash
ls -t ./logs/*.log | head -1
# Or check project-specific log locations

数据库查询(SQLite):

sqlite3 {database_path} ".tables"
sqlite3 {database_path} ".schema {table}"
sqlite3 {database_path} "SELECT * FROM {table} ORDER BY created_at DESC LIMIT 5;"

服务检查:

ps aux | grep {service_name}
lsof -i :{port}

Git 状态:

git status
git log --oneline -10
git diff

请记住:此命令可帮助你调查问题,而不会占用主窗口的上下文。在手动测试时遇到问题,需要深入检查日志、数据库或 git 状态时,它尤其有用。

评论

支持 Markdown