docs/zh-CN/skills/agent-introspection-debugging/SKILL.md
针对AI代理故障的结构化自调试工作流程,包括捕获、诊断、受限恢复和内省报告。
npx skillsauth add affaan-m/everything-claude-code agent-introspection-debuggingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
当智能体运行反复失败、消耗令牌却无进展、在相同工具上循环或偏离预期任务时,使用此技能。
这是一个工作流技能,而非隐藏运行时。它教会智能体在升级给人类之前,系统性地自我调试。
激活此技能用于:
请勿将此技能作为以下情况的主要来源:
verification-loop在尝试恢复之前,精确记录失败信息。
捕获内容:
最小捕获模板:
## 失败捕获
- 会话/任务:
- 进行中的目标:
- 错误:
- 最后成功的步骤:
- 最后失败的工具/命令:
- 观察到的重复模式:
- 需验证的环境假设:
在更改任何内容之前,将失败与已知模式匹配。
| 模式 | 可能原因 | 检查 |
| --- | --- | --- |
| 最大工具调用/重复相同命令 | 循环或无退出观察路径 | 检查最后 N 次工具调用是否存在重复 |
| 上下文溢出/推理能力下降 | 无界笔记、重复计划、过大日志 | 检查近期上下文是否存在重复和低信号批量内容 |
| ECONNREFUSED / 超时 | 服务不可用或端口错误 | 验证服务健康状态、URL 和端口假设 |
| 429 / 配额耗尽 | 重试风暴或缺少退避 | 统计重复调用次数并检查重试间隔 |
| 写入后文件缺失/差异过时 | 竞态、工作目录错误或分支漂移 | 重新检查路径、工作目录、git 状态和实际文件是否存在 |
| “修复”后测试仍然失败 | 假设错误 | 隔离确切失败的测试并重新推导错误 |
诊断问题:
使用改变诊断面的最小操作进行恢复。
安全恢复操作:
不要声称不支持的自动修复操作,如“重置智能体状态”或“更新框架配置”,除非你正在当前环境中通过真实工具实际执行这些操作。
受限恢复检查清单:
## 恢复操作
- 选择的诊断方式:
- 采取的最小操作:
- 为何此操作安全:
- 哪些证据能证明修复生效:
以一份使恢复过程对下一个智能体或人类清晰可读的报告结束。
## 代理自调试报告
- 会话/任务:
- 失败原因:
- 根本原因:
- 恢复措施:
- 结果:成功 | 部分成功 | 受阻
- Token/时间消耗风险:
- 是否需要后续跟进:
- 后续需编码的预防性变更:
按顺序优先选择以下干预措施:
错误模式:
正确模式:
verification-loop。continuous-learning-v2。council。workspace-surface-audit。当此技能激活时,不要仅以“我已修复”结束。
始终提供:
data-ai
Design task-local harnesses, eval gates, and reusable skill extraction for Claude dynamic workflow mode and other adaptive agent harnesses.
development
React component testing with React Testing Library, Vitest/Jest, MSW for network mocking, accessibility assertions with axe, and the decision boundary between component tests and Playwright/Cypress end-to-end runs. Use when writing or fixing tests for React components, hooks, or pages.
tools
React and Next.js performance optimization patterns adapted from Vercel Engineering's React Best Practices (https://github.com/vercel-labs/agent-skills). Organizes 70+ rules across 8 priority categories — waterfalls, bundle size, server-side, client fetching, re-render, rendering, JS micro-perf, advanced. Use when writing, reviewing, or refactoring React/Next.js code for performance.
tools
React 18/19 patterns including hooks discipline, server/client component boundaries, Suspense + error boundaries, form actions, data fetching, state management decision trees, and accessibility-first composition. Use when writing or reviewing React components.