Agent诊断
- 作者仓库星标 430
- 作者更新于 实时读取
- 作者仓库 aeon
- 领域
- 通用 · meta · dev
- 兼容 Agent
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- 信任分
- 94 / 100 · 已通过审计
- 作者 / 版本 / 许可
- @aaronjmars · 未声明 license
- Token 消耗评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部 API Key
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 底层运行要求
- 无特殊要求
- 文件与系统权限
-
- 只读
- 允许写入 / 修改
- Shell 执行
- 网络行为
- 允许外网请求
- 安装命令数
- 26 条
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
---
name: Skill Repair
description: Diagnose and fix failing or degraded skills automatically — systemic-first triage, per-category…
category: 通用
runtime: 无特殊运行时
---
# Skill Repair 输出预览
## PART A: 任务判断
- 适用问题:通用任务拆解、检查和交付。
- 输入要求:目标材料、限制条件、期望输出和验收方式。
- 证据边界:围绕“Phases / Exit taxonomy / 1. PREFLIGHT”读取原文规则,不把推断写成作者承诺。
## PART B: 执行结果
- **01** 任务判断:确认你的需求是否属于通用任务拆解、检查和交付,并标出输入、限制和预期结果。
- **02** 执行计划:优先按“Phases / Exit taxonomy / 1. PREFLIGHT”拆成步骤,说明每一步会读取什么、修改什么、产出什么。
- **03** 交付结果:给出可复制的命令、文件改动、检查清单或内容草稿,并说明如何继续迭代。
- **04** 风险边界:结合 读取文件、写入/修改文件、执行终端命令、会按任务需要访问外部网络、通常不需要额外 API Key 给出执行前确认项。
## Running Rules
- 读取文件、写入/修改文件、执行终端命令;会按任务需要访问外部网络;通常不需要额外 API Key。
- 先小样例验证,再放大到真实任务。
- 交付时同时给结果、检查口径和下一步迭代建议。 原文没有稳定的斜杠命令要求。安装验证后通常全局生效,直接在对话里点名这个 Skill 并描述任务即可。
告诉 Agent 目标文件或材料、期望结果、不可改范围、是否允许联网或执行命令。本 Skill 的权限画像是:读取文件、写入/修改文件、执行终端命令。
先用一个小任务确认它会围绕“Phases / Exit taxonomy / 1. PREFLIGHT”工作;涉及文件或命令时,先看 diff、日志、预览或测试结果。
检查最终产物是否包含明确结果、必要证据和下一步动作;如果输出泛泛而谈,就补充输入、边界和验收标准后重跑。
---
name: Skill Repair
description: Diagnose and fix failing or degraded skills automatically — systemic-first triage, per-category…
category: 通用
source: aaronjmars/aeon
---
# Skill Repair
## 什么时候使用
- 把通用方向的常用动作沉淀成 Agent 可调用的技能 适合处理通用任务拆解、检查、交付和复盘,核心价值是把输入、判断、执行、验证和交付边界固定下来,避免 Agent 泛泛回答。 围绕 meta、dev 组织上下文、步骤和验收口径;通常不…
- 面向通用任务拆解、检查和交付,优先处理能明确输入、步骤和验收标准的工作。
## 需要提供什么
- 目标材料、目录范围、期望结果和不可改动内容。
- 是否允许联网、执行命令、读写文件或调用外部服务。
## 执行规则
- 围绕「Phases / Exit taxonomy / 1. PREFLIGHT」组织步骤,不把推断写成作者事实。
- 读取文件、写入/修改文件、执行终端命令;会按任务需要访问外部网络;通常不需要额外 API Key。
- 先跑小样例,确认结果可检查后再扩大任务范围。
## 输出要求
- 给出最终产物、关键证据、验证方式和下一步动作。
- 信息不足时标记 unknown,不编造命令、平台或依赖。 作者原文负责流程事实;仓库文件负责来源和命令;流狐只补充适用场景、限制和质量判断。
skill "Skill Repair" {
输入层 -> 用户目标 + 目标文件 + 禁止范围 + 验收标准
上下文层 -> Phases / Exit taxonomy / 1. PREFLIGHT
规则层 -> SKILL.md 触发条件 / 执行顺序 / 输出格式
运行层 -> 无特殊运行时 | 读取文件、写入/修改文件、执行终端命令 | 会按任务需要访问外部网络
安全层 -> 通常不需要额外 API Key + 小任务验证 + diff / 日志复核
输出层 -> 可复制结果 + 检查清单 + 下一步迭代
} ${var} — Skill name to repair. If empty, runs systemic triage and picks the worst fixable target.
${var}modifiers: prefixdry-run:to diagnose only without writing a PR (e.g.dry-run:digest).
Today is ${today}. Your task is to diagnose and repair the worst-impact failing or degraded skill — preferring a single shared fix over N per-skill patches when failures cluster.
Phases
PREFLIGHT → TRIAGE → DIAGNOSE → REPAIR → VERIFY → LOG
Stop early at the appropriate exit code if any phase finds nothing actionable.
Exit taxonomy
Pick exactly one before notifying.
| Code | Meaning |
|---|---|
REPAIR_OK_FIXED |
Per-skill fix applied, PR opened |
REPAIR_OK_SYSTEMIC |
Shared root cause across N skills — single shared fix or shared issue filed |
REPAIR_DIAGNOSED_NO_FIX |
Root cause known but requires operator action (e.g. missing secret, upstream API down). Issue updated, no PR |
REPAIR_NO_TARGETS |
All tracked skills healthy and no open fixable issues |
REPAIR_DRY_RUN |
var=dry-run:NAME — diagnostic only, no PR |
REPAIR_BLOCKED |
Preflight failed (gh auth, missing files) or cooldown active |
1. PREFLIGHT
Bail early with REPAIR_BLOCKED (and notify with the reason) if any of these fails:
gh auth statussucceeds.memory/cron-state.jsonexists and parses as JSON.memory/issues/INDEX.mdexists. If absent, bootstrap a minimal one (Open + Resolved tables, no rows).memory/state/skill-repair-history.jsonexists. If absent, create{}.
Cooldown / idempotency (skip target with REPAIR_BLOCKED if any matches; don't loop on a fix that didn't take):
- The chosen target appears in
memory/state/skill-repair-history.jsonwithlast_repair_atwithin 24h. (Operator can override by deleting the entry.) - An open PR already exists matching
fix/skill-repair-{name}-*—gh pr list --state open --search "head:fix/skill-repair-{name}". - More than 3 skill-repair PRs already opened in the current UTC day — rate-limit our own PRs.
If ${var} starts with dry-run:, strip the prefix to get the target name and skip the cooldown.
2. TRIAGE
Identify the target. Two paths:
Path A — ${var} set explicitly: repair that skill. Skip step 2's clustering.
Path B — ${var} empty (auto-select):
- Read
memory/issues/INDEX.md. Extract open issues. Skippermanent-limitation. - Read
memory/cron-state.json. Compute candidates where any of:consecutive_failures >= 2, ORsuccess_rate < 0.5ANDtotal_runs >= 3, ORlast_status == "failed"ANDlast_failedwithin 48h, ORlast_quality_score <= 2(degraded output even when "successful").
- Cluster by error signature. Group candidates by normalized
last_error(lowercase, strip timestamps/ids/digits) AND by issuecategory. If 2+ skills share a signature OR a non-trivial category (api-change,rate-limit,missing-secret,sandbox-limitation):- This is systemic. Switch to systemic mode:
- File or update a single shared issue (
affected_skills: [list]) instead of N per-skill issues. - If the shared root cause is fixable in one place (e.g., a shared script under
scripts/, a CLAUDE.md pattern, a shared config), open one PR addressing that. Otherwise emitREPAIR_DIAGNOSED_NO_FIXwith the systemic finding. - Exit with
REPAIR_OK_SYSTEMICafter step 5.
- File or update a single shared issue (
- This is systemic. Switch to systemic mode:
- Pick worst single target. Sort: critical issue > high issue > consecutive_failures desc > lowest success_rate > stalest
last_success. Skippermanent-limitationand any target whose preflight cooldown blocks it. If nothing remains:REPAIR_NO_TARGETS.
3. DIAGNOSE
Build a diagnostic dossier for the target before touching any file. Sources are independent — each one's status feeds the source-status footer (ok/empty/fail).
a. Skill file: read skills/{name}/SKILL.md. Note frontmatter, declared data sources, env-var references.
b. Cron-state entry: extract last_error, last_failed, last_success, success_rate, consecutive_failures, last_quality_score.
c. Regression hunter: if last_success exists, run
git log --oneline --since="$LAST_SUCCESS" -- skills/{name}/SKILL.md aeon.yml scripts/
Any commit listed is a candidate regression source. If exactly one commit touched the skill file in this window, it is the prime suspect — record its SHA + subject in the dossier.
d. Recent failed runs (last 5, not just 1):
gh run list --workflow=aeon.yml --limit 50 --json databaseId,name,conclusion,createdAt \
| jq -r '[.[] | select(.name | contains("{name}")) | select(.conclusion=="failure")] | .[0:5]'
For each, prefer gh run view "$RUN_ID" --log-failed (already filtered to failed steps) over the full log; fall back to gh run view "$RUN_ID" --log only if --log-failed returns nothing. Then:
gh api "repos/{owner}/{repo}/actions/runs/$RUN_ID/check-runs" \
| jq -r '.check_runs[].output.annotations[]? | "\(.path):\(.start_line) \(.annotation_level): \(.message)"'
Annotations give clean error rows; logs give context. Distinguish consistent (same signature 4-5/5 runs → likely deterministic bug, secret, API change) from intermittent (1-2/5 → rate limit, flaky upstream).
e. Logs: search last 3 days of memory/logs/*.md for {name} mentions. Surface any prior diagnoses.
f. Quality history: if memory/skill-health/{name}.json exists, note avg_score trend.
g. Output expectations: if skills/skill-evals/evals.json has an entry for {name}, extract its min_words, required_patterns, forbidden_patterns. A passing run that fails these is quality-regression.
h. Issue: if memory/issues/INDEX.md lists an open issue for this skill, read the file — its category and root_cause short-circuit the playbook lookup below.
4. REPAIR — per-category playbook
Categories follow CLAUDE.md. Pick the most specific category that fits the diagnostic dossier (issue category if present > error-signature pattern match > best inference). Apply the matching playbook.
| Category | Playbook |
|---|---|
api-change |
WebFetch the live API spec / status page / release notes. Update endpoints, payload shape, headers, error codes in the skill. Cite the spec URL in the PR body. Never guess — if WebFetch fails, drop to REPAIR_DIAGNOSED_NO_FIX. |
rate-limit |
Add backoff (sleep), reduce request count, or add a fallback endpoint. Never raise the limit from the skill side. If the skill's schedule is too aggressive, propose a less-frequent cron in the PR body but don't edit aeon.yml unless the issue file already authorizes it. |
timeout |
Split work into stages, add early-return on partial success, downgrade model: to claude-sonnet-4-6 or claude-haiku-4-5-20251001 for the skill that doesn't need Opus. |
sandbox-limitation |
Convert auth-required curls to the prefetch (scripts/prefetch-{name}.sh) or postprocess (.pending-{name}/ + scripts/postprocess-{name}.sh) pattern from CLAUDE.md. Add a "Sandbox note" section to the skill. |
prompt-bug |
Minimum-edit specificity insertion. Don't rewrite — add the missing constraint, a forbidden phrase, a required output structure, or a clarifying example. Diff should be < 30 added/removed lines. |
output-format / quality-regression |
Cross-reference skills/skill-evals/evals.json for the failing assertion. Edit the skill so the next run satisfies that exact pattern. Cite the assertion in the PR body. |
missing-secret |
Do not modify aeon.yml or the workflow. File or update the issue with status: open, category: missing-secret, naming the secret. Notify operator with the env-var name. Exit REPAIR_DIAGNOSED_NO_FIX. |
config |
Reversible aeon.yml edits only — schedule, var, model, enabled: false. Never add or remove top-level structure or chains. Keep diff < 5 lines in aeon.yml. |
permanent-limitation |
Skip — should not have reached repair. Update issue, exit REPAIR_DIAGNOSED_NO_FIX. |
unknown |
Do not edit blindly. Append the full diagnostic dossier (regression candidates, top error lines, source-status) to the issue file as a ## Diagnosis Notes section, exit REPAIR_DIAGNOSED_NO_FIX. Operator triages. |
Risk classification (pick one, gate the PR):
- LOW — clarifying prompt, adding fallback, comment-only changes, single-section edit (< 30 lines diff).
- MED — changes a data source, adds a new env-var reference (must already be in workflow), or modifies output format.
- HIGH — touches
aeon.yml, removes existing features, disables a skill, modifies ascripts/*.shfile. HIGH risk PRs must add the labelmanual-reviewand must NOT be auto-mergeable (skipauto-merge-friendly framing in the PR body).
Frontmatter integrity check: after editing skills/{name}/SKILL.md, re-read it. Confirm the YAML frontmatter still has name, description, var, tags. If broken, abort the edit and exit REPAIR_BLOCKED.
5. VERIFY — append a verification plan to the PR
Every PR (except REPAIR_DIAGNOSED_NO_FIX) must include a Verification section the operator can execute. Use this template:
## Verification
**Manual trigger:** [Run skill](https://github.com/{owner}/{repo}/actions/workflows/aeon.yml) with `skill={name}` and `var={var}`.
**Expected result:**
- Workflow conclusion: `success`
- Output file matches `{evals.json output_pattern or "memory/logs/${today}.md mentions {name}"}`
- {category-specific signal — e.g. "no `rate limit` strings in run logs" / "produces ≥ {min_words} words" / "annotation count ≤ 0"}
**If still failing after this PR:** delete `memory/state/skill-repair-history.json[{name}]` to remove the cooldown, then re-dispatch `skill-repair` with `var={name}` for a second pass.
Record the chosen verification command in the issue file's ## Repair Attempt section so the next skill-repair run can read prior outcomes.
6. Branch, commit, PR
TODAY="${today}"
BRANCH="fix/skill-repair-{name}-${TODAY}"
git checkout -b "$BRANCH"
git add skills/{name}/SKILL.md # plus aeon.yml or scripts/* iff in playbook
git commit -m "fix({name}): [one-line root cause → fix]"
git push -u origin "$BRANCH"
gh pr create --title "fix({name}): [short]" --body "$(cat <<'EOF'
## Symptom
[what failed — error signature, run URL]
## Diagnosis
[dossier summary: regression commit if any, consistent vs intermittent, category]
## Root cause
[one paragraph]
## Fix
[what changed and why]
## Risk
LOW | MED | HIGH — [rationale]
## Verification
[copy from step 5]
## Source status
cron_state=ok | issues_index=ok | gh_runs=ok | gh_logs=ok | git_log=ok | check_runs=ok
EOF
)"
If risk is HIGH, also: gh pr edit "$PR_URL" --add-label manual-review.
7. Update issue tracker (memory/issues/)
- If an open issue for this skill exists:
- Fix applied → set
status: resolved,resolved_at: ${today},fix_pr: <url>. Move row from Open → Resolved inINDEX.md. - No fix possible → append
## Repair Attempt — ${today}with the dossier and reason.
- Fix applied → set
- If no issue exists but a real problem was found and fixed → create
memory/issues/ISS-{NNN}.mdwith status alreadyresolved(NNN = next free number from INDEX.md). - If systemic clustering fired in step 2 → ensure
affected_skills:lists every skill matched by the signature.
8. Persist cooldown
Update memory/state/skill-repair-history.json:
{
"{name}": {
"last_repair_at": "${today}T...Z",
"exit_code": "REPAIR_OK_FIXED",
"fix_pr": "https://github.com/.../pull/N",
"issue": "ISS-NNN"
}
}
9. Notify
Send via ./notify (one-paragraph max — verdict line first):
*skill-repair — {EXIT_CODE}*
Target: {name} (or systemic: skill-a, skill-b, ...)
Root cause: [one line]
Fix: [one line] (risk: LOW|MED|HIGH)
PR: {url} Issue: {ISS-NNN}
Verify: workflow_dispatch skill={name}
10. Log
Append to memory/logs/${today}.md:
### skill-repair
- Exit: {EXIT_CODE}
- Target: {name} (or systemic group)
- Category: {category}
- Diagnosis: [root cause]
- Fix: [what changed] (risk: {LOW|MED|HIGH})
- Regression suspect: {commit SHA or "none in window"}
- Failures observed: {N}/5 recent runs ({consistent|intermittent})
- PR: {url or "—"}
- Issue: {ISS-NNN created|updated|resolved or "—"}
- Source status: cron_state | issues_index | gh_runs | gh_logs | git_log | check_runs
Sandbox note
gh and git work inside the sandbox. The diagnostic curls go through gh api (auth handled). For any external API spec lookup in the api-change playbook, prefer WebFetch over curl — see CLAUDE.md.
Constraints
- One target per run (or one systemic cluster). Never bundle unrelated repairs.
- Minimum-edit principle: keep diffs as small as possible. The original failure mode is rarely "the skill needs a rewrite".
- Never modify secrets, the workflow file (
.github/workflows/aeon.yml), ormessages.yml. - Never push to
main. Always branch + PR. - Never auto-merge HIGH-risk PRs. They carry the
manual-reviewlabel. - If a skill has been failing > 7 days with no clear root cause and the category is
unknown, recommend (in the issue and notify)enabled: falseinaeon.yml— but do not apply that change without an explicit operator-approved issue. - Skip when
${var}matches a skill that has been repaired in the last 24h unless operator clears the cooldown entry. This prevents repair loops on fixes that didn't take.
先判断是否适合
作者设计意图
作者的方法与取舍
边界和复核