AGENT SKILL

错误恢复与自适应处理

error-recovery

适用于所有 squad agent 的标准恢复模式。当出现失败时,要自适应处理——而不是仅仅报告失败。

适用职业AI 工程师
License 许可
MIT
最近更新
2026-11-12
Stars
★ 3
Forks
0

01 前言 Front Matter

name
error-recovery
domain
reliability, agent-coordination
license
MIT
confidence
high
description
Standard recovery patterns for all squad agents. When something fails, adapt — don't just report the failure.

02 资源文件 1

03 SKILL.md 正文

Error Recovery Patterns

Standard recovery patterns for all squad agents. When something fails, adapt — don't just report the failure.


1. Retry with Backoff

When: Transient failures — API timeouts, rate limits, network errors, temporary service unavailability.

Pattern:

  1. Wait briefly, then retry (start at 2s, double each attempt)
  2. Maximum 3 retries before escalating
  3. Log each attempt with the error received

Example: API call returns 429 Too Many Requests → wait 2s → retry → wait 4s → retry → wait 8s → retry → escalate if still failing.


2. Fallback Alternatives

When: Primary tool or approach fails and an alternative exists.

Pattern:

  1. Attempt primary approach
  2. On failure, identify alternative tool/method
  3. Try the alternative with the same intent
  4. Document which alternative was used and why

Example: Primary CLI tool fails → fall back to direct API call for the same operation.


3. Diagnose-and-Fix

When: Build failures, test failures, linting errors — structured errors with actionable output.

Pattern:

  1. Read the full error output carefully
  2. Identify the root cause from error messages
  3. Attempt a targeted fix
  4. Re-run to verify the fix
  5. Maximum 3 fix-retry cycles before escalating

Example: Build fails with a type error → check for missing import → add it → rebuild.


4. Escalate with Context

When: Recovery attempts have been exhausted, or the failure requires human judgment.

Pattern:

  1. Summarize what was attempted and what failed
  2. Include the exact error messages
  3. State what you believe the root cause is
  4. Suggest next steps or who might be able to help
  5. Hand off to the coordinator or the appropriate specialist

Example: After 3 failed build attempts → "Build fails on line 42 with null reference. Tried X, Y, Z. Likely a design issue in the Foo module. Recommend the code owner review."


5. Graceful Degradation

When: A non-critical step fails but the overall task can still deliver value.

Pattern:

  1. Determine if the failed step is critical to the task outcome
  2. If non-critical, log the failure and continue
  3. Deliver partial results with a clear note of what was skipped
  4. Offer to retry the skipped step separately

Example: Generating a report with 5 sections — section 3 data source is unavailable → produce the report with 4 sections, note that section 3 was skipped and why.


Applying These Patterns

Each agent should reference these patterns in their charter's ## Error Recovery section, tailored to their domain. The charter should list the agent's most common failure modes and map each to the appropriate pattern above.

Selection guide:

Failure Type Primary Pattern Fallback Pattern
Network/API transient Retry with Backoff Escalate with Context
Tool/dependency missing Fallback Alternatives Escalate with Context
Build/test error Diagnose-and-Fix Escalate with Context
Auth/permissions Retry with Backoff Escalate with Context
Non-critical data missing Graceful Degradation —
Unknown/novel error Escalate with Context —

04 同仓库更多 Skills

microsoft
microsoft/github-vteam-industry-demos

对话经验学习与沉淀

reflect

学习捕获系统,从对话中提取高/中/低置信度的模式,以避免重复犯错。在用户纠正(「不」「错了」)、赞扬(「完美」「就是这样」)或发现边缘情况时使用。补充 .squad/agents/{agent}/history.md 和 .squad/decisions.md。

AI 工程师知识管理与沉淀
★ 3
microsoft
microsoft/github-vteam-industry-demos

子智能体迭代检索协议

iterative-retrieval

针对智能体子任务的最多 3 轮循环协议,带有 WHY 上下文和协调器验证。在派生子智能体来完成限定范围的工作时使用。

AI 工程师编码任务委派
★ 3
microsoft
microsoft/github-vteam-industry-demos

对话经验沉淀

reflect

一种学习捕获系统,从对话中提取高/中/低置信度模式,以避免重复犯错。在用户纠正(“no”、“wrong”)、表扬(“perfect”、“exactly”)或发现边界情况时使用。作为 .squad/agents/{agent}/history.md 和 .squad/decisions.md 的补充。

AI 工程师知识管理与沉淀
★ 3
microsoft
microsoft/github-vteam-industry-demos

智能体子任务迭代检索

iterative-retrieval

针对智能体子任务的最多 3 轮循环协议,附带 WHY(原因)上下文和协调器验证。在派生子代理以完成范围限定的工作时使用。

AI 工程师智能体开发
★ 3
microsoft
microsoft/github-vteam-industry-demos

事实核查与验证

fact-checking

使用反假设检验审查并验证各类声明。适用于验证技术内容、检查引用、校验 API 端点,或对交付物进行质量保障。

测试工程师回答复核
★ 3
microsoft
microsoft/github-vteam-industry-demos

错误恢复策略

error-recovery

面向所有 squad agents 的标准恢复模式。当某些操作失败时,应自适应处理,而不只是报告失败。

AI 工程师智能体开发
★ 3