errors
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseError Pattern Analysis
错误模式分析
Analyze errors captured from Claude Code sessions to identify patterns and get actionable insights.
分析从Claude Code会话中捕获的错误,识别模式并获取可执行的洞察。
Quick Start
快速开始
bash
/errors # Batch analysis of historical error patterns
/debug # CC 2.1.30 real-time debug for current sessionbash
/errors # 批量分析历史错误模式
/debug # 当前会话的CC 2.1.30实时调试When to Use Which
场景选择指南
| Command | Purpose | Scope |
|---|---|---|
| Batch analysis of error patterns (last 24h/7d) | Historical patterns |
| Real-time debug of current session state | Current session |
| Full RCA workflow for specific bug | Single issue |
| 命令 | 用途 | 范围 |
|---|---|---|
| 批量分析错误模式(最近24小时/7天) | 历史模式 |
| 当前会话状态的实时调试 | 当前会话 |
| 特定bug的完整RCA(根本原因分析)流程 | 单个问题 |
Quick Analysis
快速分析
bash
undefinedbash
undefinedRun batch analysis on last 24h of errors
对最近24小时的错误进行批量分析
python .claude/scripts/analyze_errors.py
python .claude/scripts/analyze_errors.py
Analyze last 7 days
分析最近7天的错误
python .claude/scripts/analyze_errors.py --days 7
python .claude/scripts/analyze_errors.py --days 7
Generate markdown report
生成Markdown报告
python .claude/scripts/analyze_errors.py --report
undefinedpython .claude/scripts/analyze_errors.py --report
undefinedWhat Gets Captured
捕获内容
The error collector hook captures:
- Tool name (Bash, mcp__memory__search_nodes, etc.)
- Error message (first 500 chars)
- Tool input (command/query that failed)
- Timestamp and session ID
Location:
.claude/logs/errors.jsonl错误收集钩子会捕获以下信息:
- 工具名称(Bash、mcp__memory__search_nodes等)
- 错误信息(前500个字符)
- 工具输入(执行失败的命令/查询)
- 时间戳和会话ID
存储位置:
.claude/logs/errors.jsonlCurrent Error Rules
当前错误规则
Check learned patterns that trigger warnings:
bash
cat .claude/rules/error_rules.json | jq '.rules[] | {id, signature, count: .occurrence_count}'查看触发警告的已学习模式:
bash
cat .claude/rules/error_rules.json | jq '.rules[] | {id, signature, count: .occurrence_count}'Files
文件说明
| File | Purpose |
|---|---|
| Captures errors to JSONL |
| Warns before risky commands |
| Batch pattern analysis |
| Learned error patterns |
| Raw error log |
| 文件 | 用途 |
|---|---|
| 将错误捕获至JSONL文件 |
| 在执行高风险命令前发出警告 |
| 批量模式分析 |
| 已学习的错误模式 |
| 原始错误日志 |
Common Patterns
常见模式
PostgreSQL Connection Errors
PostgreSQL连接错误
pattern: role "X" does not exist
fix: Use Docker connection: docker exec -it orchestkit-postgres-dev psql -U orchestkit_user -d orchestkit_dev
pattern: relation "X" does not exist
fix: Check MCP postgres server connection string - may be connected to wrong database模式:role "X" does not exist
修复方案:使用Docker连接:docker exec -it orchestkit-postgres-dev psql -U orchestkit_user -d orchestkit_dev
模式:relation "X" does not exist
修复方案:检查MCP PostgreSQL服务器连接字符串 - 可能连接到了错误的数据库Related Skills
相关技能
- fix-issue: Fix identified errors
- debug-investigator: Debug error root causes
- fix-issue:修复已识别的错误
- debug-investigator:调试错误根本原因
Adding New Rules
添加新规则
Rules are auto-generated by when patterns repeat 2+ times.
For manual rules, edit :
analyze_errors.py.claude/rules/error_rules.jsonjson
{
"id": "custom-001",
"pattern": "your regex pattern",
"signature": "human readable signature",
"tool": "Bash",
"occurrence_count": 1,
"fix_suggestion": "How to fix this"
}当错误模式重复出现2次及以上时,会自动生成规则。
如需手动添加规则,请编辑 :
analyze_errors.py.claude/rules/error_rules.jsonjson
{
"id": "custom-001",
"pattern": "your regex pattern",
"signature": "human readable signature",
"tool": "Bash",
"occurrence_count": 1,
"fix_suggestion": "How to fix this"
}