进行修复
- 作者仓库星标 0
- 作者仓库 skills-registry
- 领域
- 写作
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @tomevault-io · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 运行环境要求
- 未检出明确要求
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 命令执行
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
涉及相同文件的结果必须位于同一批次中(防止编辑冲突)。不重叠的批次可以作为并行代理运行。每批次:1-5 个结果。
在修复错误之前编写测试来证明错误的存在。范围:仅限可单元测试的 BLOCKER/ISSUE 结果。跳过:缓存行为、约定修复、死代码、样式。建议和 NIT 永远不需要测试。将测试写作外包给并行代理。每个代理:接收查找文本和相关源文件内容 指令:编写针对当前代码失败的重点测试 - 不要修复代码
您(协调员)不进行编辑。将所有编辑委托给代理。最大化并行性。查看步骤 1 中的批次。所有涉及非重叠文件的批次都可以(并且应该)同时生成为并行代理 - 具有多个代理工具调用的单个消息,而不是顺序生成。仅序列化共享文件的批次。对于跨不同文件的 3-7 个结果的典型审查,大多数或所有批次应并行运行。
阅读`~/.claude/skills/shared/references/finding-format.md`了解状态生命周期。当代理返回报告时更新审核文档: `[x]` -> `[fixed]` 编辑后,带有一行更改摘要 `[fixed]` -> `[verified]` 验证通过后(批量更新) 如果验证失败,保留为 `[fixed]` 并附加失败的内容 `[ ]` -> `[skipped]`未经检查的发现
在所有编辑代理返回报告之前不要运行验证。关键:在任何提交或推送之前必须进行验证。没有例外,没有捷径。阅读 CLAUDE.md 和 `.claude/rules/` 以查找存储库的验证命令和策略。如果存在`verification.md`规则,请严格遵循它——它可能需要运行完整的测试套件,而不仅仅是有针对性的测试。
在提交之前,扫描审核文档并确保每个检查的`[x]`发现已更新为最终状态。此时,任何发现都不应显示裸露的`[x]`。终端状态:`[fixed]` -> `[verified]`、`[skipped]`、`[will-not-do]`、`[deferred]`、`[already-resolved]`、`[could-not-prove]`。如果任何检查结果仍然是`[x]`:立即更新它们——如果故意不解决,则用注释标记`[skipped]`,如果超出范围,则标记`[deferred]`。
完整的顺序是:验证 -> 提交 -> 推送 -> 发布 PR 评论。所有四个步骤都是强制性的,并且必须按顺序进行。不要跳过任何步骤。未经核实请勿推送。请勿在未发布 PR 评论的情况下结束会话。自动继续:修复完成并通过验证后,立即继续执行第 2 阶段的所有内容 - 提交、推送,然后发布 PR 评论 - 无需停下来询问。用户
将审核文档`phase:`更新为`fixes-verified`。审查周期的所有修复都会进入一次提交 - 永远不会通过查找来拆分。将`phase:`更新为`committed`。
# Do Fixes: Apply Review Findings
You are applying fixes from a completed review. This skill detects the most recent review artifact
and applies the appropriate fixes.
**Arguments:** $ARGUMENTS
- No arguments: auto-discover the most recent review doc for this branch
- Path: use the specified review doc
### Context Detection
Scan `<work-folder>/reviews/` for the most recent review artifact:
- **`*.review.*.md`** (code-review output) → apply code fixes using the flow below
- *(Future: plan-review artifacts → apply plan improvements)*
The review document contains findings with checkboxes — checked `[x]` findings get fixed,
unchecked `[ ]` findings get skipped.
**Setup check:** If the pre-loaded `Work folder` shows `needs-setup`, stop: "Run `/setup-agent-skills` first to configure your work folder, then come back."
**Pre-loaded context:**
- Current branch: !`~/.claude/skills/shared/scripts/context.sh current-branch`
- Work folder: !`~/.claude/skills/shared/scripts/context.sh work-folder`
- Ticket ID: !`~/.claude/skills/shared/scripts/context.sh ticket-id`
- HEAD SHA: !`~/.claude/skills/shared/scripts/context.sh head-sha`
- Open PR: !`~/.claude/skills/shared/scripts/context.sh open-pr`
- Uncommitted changes: !`~/.claude/skills/shared/scripts/context.sh uncommitted-changes`
**PR number:** extract from "Open PR" above (the number before the colon). Use this everywhere `<pr-number>` appears.
---
## Phase 0: Orient
### Find the review document
If a path was provided as argument, use it. Otherwise, auto-discover:
1. Use the pre-loaded `Work folder`. If `none` (on main), ask the user which branch this review is for.
2. Look in `<work-folder>/reviews/` for review files (`*.review.*.md`).
3. Use the most recent one (by date in filename).
4. If no review doc found: "No review document found. Run `/code-review` first to generate one."
If still no review doc: "No review document found. Run `/code-review` first to generate one."
### Read the review document
Read the review doc. Note:
- The `phase:` in frontmatter — if already `committed` or `fixes-verified`, warn: "This review has already been applied. Run `/code-review full` for a new review cycle."
- The checked `[x]` findings — these are the ones to fix
- Any `**Instructions:**` fields — user instructions take priority over reviewer suggestions
- The `sha:` — the HEAD at review time
### Read project context
Read `CLAUDE.md` at the repo root — note verification commands (lint, typecheck, test, format) for use in Phase 1.
### Check for uncommitted changes
If there are uncommitted changes (from pre-loaded context): "There are uncommitted changes. Want to stash them before proceeding, or continue as-is?" Wait for their answer.
**Create progress tasks:**
1. Fix findings
2. Verify fixes
3. Finalize — update review doc, commit, push
4. Post PR summary comment
Update the review doc's `phase:` to `fixes-in-progress`.
---
## Phase 1: Fix
### Step 1: Group findings into fix batches
Findings touching the same file(s) MUST be in the same batch (prevents edit conflicts). Non-overlapping batches can run as parallel agents. Each batch: 1-5 findings.
### Step 2: Regression tests (BLOCKER/ISSUE only)
Write tests that **prove the bug exists** before fixing it. Scope: only unit-testable BLOCKER/ISSUE findings. Skip: cache behavior, convention fixes, dead code, styling. SUGGESTIONs and NITs never need tests.
1. Farm out test writing to parallel agents. Each agent:
- Receives the finding text and relevant source file content
- Instruction: write a **focused test that fails against current code** — do NOT fix the code
- **EDITS ONLY** — no running tests
- **Budget: 3 edit rounds**
2. Run all new tests centrally — they should **fail** (proving the bug exists).
3. If a test passes (doesn't prove the bug): retry up to 3x with a fresh agent. After 3 failures, mark: `Regression test: could not write a proof test for F<n>, proceeding without`.
### Step 3: Farm out edits to agents
**YOU (the coordinator) do NOT make edits. Delegate ALL edits to agents.**
**Maximize parallelism.** Look at the batches from Step 1. All batches that touch non-overlapping files can (and should) be spawned as parallel agents simultaneously — a single message with multiple Agent tool calls, not sequential spawns. Only serialize batches that share files. For a typical review with 3-7 findings across different files, most or all batches should run in parallel.
Each agent receives:
- The specific finding(s) to address (full finding text including user Instructions)
- Relevant file content (read and pass — don't assume agents can find things)
- Clear acceptance criteria
- **User instructions** from `**Instructions:**` field take priority over reviewer suggestions
- Instruction to follow all CLAUDE.md guidelines
- **EDITS ONLY — no running tests, typecheck, lint, format, starting any processes, or committing.** The coordinator runs verification after all agents complete. Parallel agents each spinning up their own processes will thrash the machine.
- **Budget: 5 edit rounds**
If an agent discovers a finding is incorrect (e.g., would break types, code is actually fine): agent skips and reports why. Mark with a note rather than forcing a bad change.
### Step 4: Track progress
Read `~/.claude/skills/shared/references/finding-format.md` for the status lifecycle. Update the review doc as agents report back:
- `[x]` -> `[fixed]` after editing, with one-line change summary
- `[fixed]` -> `[verified]` after verification passes (batch-update)
- If verification fails, leave as `[fixed]` and append what failed
- `[ ]` -> `[skipped]` for unchecked findings
### Step 5: Verify (centrally, after ALL edits complete)
**Do not run verification until all edit agents have reported back.**
**CRITICAL: Verification is mandatory before any commit or push. No exceptions, no shortcuts.**
1. **Read CLAUDE.md and `.claude/rules/`** to find the repo's verification commands and policies.
If a `verification.md` rule exists, follow it exactly — it may require running the full test
suite, not just targeted tests.
2. **Format** changed files only (runs first — it modifies files):
- Get changed files: `git diff $(git merge-base HEAD main)...HEAD --name-only`
- Use repo-appropriate formatter from CLAUDE.md
3. **Run the repo's verification suite.** Follow whatever CLAUDE.md or `.claude/rules/verification.md`
specifies. If neither prescribes a scope, default to:
- Typecheck (full — types are global)
- Tests related to changes (filename pattern filters)
If the repo's rules say to run the full suite, run the full suite.
4. **All checks must pass.** If verification fails, fix the issue and re-verify. Do not commit
or push with failing checks. If you cannot fix a failure after 2 attempts, stop and report
to the user.
If verification fails, fix issues (spawn new agents if needed), then re-verify.
### Step 6: Resolve all findings
Before committing, scan the review document and ensure every checked `[x]` finding has been updated to a terminal status. No finding should still show bare `[x]` at this point.
Terminal statuses: `[fixed]` -> `[verified]`, `[skipped]`, `[will-not-do]`, `[deferred]`, `[already-resolved]`, `[could-not-prove]`.
If any checked findings are still `[x]`: update them now — mark `[skipped]` with a note if they were intentionally not addressed, or `[deferred]` if out of scope.
---
## Phase 2: Finalize
**The full sequence is: verify -> commit -> push -> post PR comment. All four steps are mandatory
and must happen in order. Do not skip any step. Do not push without verifying. Do not end the
session without posting the PR comment.**
**Auto-proceed:** Once fixes are complete and verification passes, immediately continue through
all of Phase 2 — commit, push, then post the PR comment — without stopping to ask. The user
invoked this skill to apply fixes; that authorizes the full cycle through commit, push, and
publish. Only pause if: (a) verification still fails after fix attempts, (b) a finding requires
a judgment call not covered by the user's instructions, or (c) an unanswered question came up
that needs a decision before proceeding.
### Step 7: Commit
Update review doc `phase:` to `fixes-verified`. **All fixes for a review cycle go into a single commit** — never split by finding. Update `phase:` to `committed`.
### Step 8: Push + update PR checklist
Push the branch:
```bash
git push
```
**Mark code review complete on the PR.** Read the PR body:
```bash
gh pr view <pr-number> --json body -q .body
```
- If it contains an unchecked `- [ ] Ran \`/code-review\`` item, check it off (`- [x]`)
- If it has no such item, append `- [x] Ran \`/code-review\`` to the checklist section (or the end of the body if no checklist exists)
Update with `gh pr edit <pr-number> --body "<updated-body>"`.
### Step 9: Post the PR comment — THIS STEP IS MANDATORY. DO NOT SKIP.
**You have just finished a code review cycle. The team cannot see the outcome unless you post this comment. It is the only artifact that surfaces the review on the PR. Do it now.**
First, re-read the review document from disk — your in-context copy may be stale after parallel fix agents updated it:
```bash
cat <work-folder>/reviews/<review-filename>.md
```
Then spawn a sub-agent (`model: sonnet`) with the following:
> "Read `~/.claude/skills/shared/references/code-review-summary-format.md` for the exact comment format — follow it precisely, do not invent a different layout.
>
> Post or update a PR comment summarizing this code review cycle.
>
> **PR number:** <pr-number>
> **Fix commit SHA:** <sha> (omit the fix commit link if no fixes were made)
> **Review SHA:** <7-char short SHA from the review doc filename>
> **Review doc contents:**
> <paste full contents of the review doc as just read from disk>
>
> **Human feedback suppression:** if the review doc contains a `## Human Feedback Cross-Reference`
> section listing dropped findings, include the suppression line after the findings table per the
> format reference: `> N findings suppressed — already raised by PR reviewers` (where N is the
> count of dropped findings). Omit this line if N = 0. Do NOT include the cross-reference table
> itself in the PR comment.
>
> **Comment identity:** each review round gets its own comment, keyed by a `<!-- code-review: <review-sha> -->` marker (the SHA from the review doc filename, not the fix commit).
> 1. Search existing PR comments for a marker matching this review SHA: `gh api repos/<owner>/<repo>/issues/<pr-number>/comments --jq '.[] | select(.body | contains("<!-- code-review: <review-sha> -->")) | .id'`
> 2. If found -> update that comment with `gh api repos/<owner>/<repo>/issues/comments/<id> -X PATCH --field body="<formatted>"` (this is a resumed partial post)
> 3. If not found -> post a new comment with `gh pr comment <pr-number> --body "<formatted>"`
>
> Extract the comment ID from the gh output (the numeric ID at the end of the comment URL, e.g. `4155206998` from `...#issuecomment-4155206998`) and return it."
If no PR exists, skip this step — the review doc stays local.
---
## Phase 3: Retrospective
After the fixes are complete:
1. **Ensure the PR comment is current.** Check whether a PR summary comment has been posted covering this review cycle. If a comment was posted but findings changed after it (e.g., additional fixes were pushed), post an updated comment using the Step 9 sub-agent.
2. Summarize what was found, fixed, and deferred.
3. Ask the user if any review agents or the code-review skill should be updated based on what was missed or noisy.
4. With user approval, suggest edits to the relevant `.claude/agents/reviewers/` files.
**Next step:** If the PR has reviewer feedback to address, handle it before merging. Otherwise, merge the PR.
---
## Agent Budgets
Agents can get stuck. Include budget instructions in every agent prompt.
| Agent type | Budget | On budget hit |
|------------------------|----------------|--------------------------------------------------|
| Regression test writer | 3 edit rounds | Report back with best attempt + what's blocking |
| Fix agent | 5 edit rounds | Report back with partial progress + what's stuck |
| Retry agent | 2 edit rounds | Flag as "could not prove" and move on |
**Include in every agent prompt:** "You have a budget of N edit rounds. If you haven't succeeded after N edits to the same file, stop and report back with what you've tried and what's blocking you. Do not keep retrying the same approach."
When an agent hits budget: (1) accept partial work if close enough, (2) spawn fresh agent with different instructions, or (3) escalate to user. Max 2 fresh-agent retries per finding before escalating.
---
## Important Guidelines
- **YOUR JOB IS CONTEXT.** Ensure each agent has everything it needs. Don't assume agents can find project conventions — pass them the relevant content.
- **Speed is not the goal.** Correctness and verifiability are.
- **When stuck, STOP and ask.** If you or any agent is spinning, escalate to the user immediately.
- **Session continuity:** Before ending, ensure the review document is saved with current `phase:` and findings state.
### Non-Negotiable Invariants
These are hard requirements. Violating any of them is a bug in execution, not a judgment call.
1. **Verify before pushing.** Run the repo's full verification suite (from CLAUDE.md / `.claude/rules/verification.md`) and confirm all checks pass before any `git push`. A push without green checks wastes CI and the reviewer's time.
2. **PR comment after pushing.** Every push that includes review fixes MUST be followed by a PR summary comment (Phase 2 Step 9). The PR comment is the only artifact that surfaces the review outcome to the team. If the session ends without it, the review is invisible.
3. **PR comment is keyed by review SHA.** Each review round gets its own comment, keyed by a `<!-- code-review: <review-sha> -->` marker (the SHA from the review doc filename). Phase 2 Step 9 handles this in the formal fix flow. Phase 3 is the catch-all. The comment must exist and be current before the session ends.
---
> Source: [ambroselittle/agent-skills](https://github.com/ambroselittle/agent-skills) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-05-22 -->
按说明文件中的顺序排列。
上下文检测
查找审核文档
阅读审查文件
阅读项目背景
检查未提交的更改
文件/命令 -> <work-folder>/reviews/ · *.review.*.md · [x] · [ ] · Work folder · needs-setup · /setup-agent-skills · ~/.claude/skills/shared/scripts/context.sh current-branch
内容校验值 -> 9ffa1e92bdec
当前原文的自动摘译,尚未人工审校。
上下文检测
扫描
<work-folder>/reviews/以获取最新的审核工件:*.review.*.md(代码审核输出)→使用以下流程应用代码修复*(未来:计划审核工件→应用计划改进)*审核文档包含带有复选框的结果 - 选中的[x]结果得到修复,未选中的[ ]结果被跳过。查找审核文档
如果提供路径作为参数,请使用它。否则,自动发现:使用预加载的
Work folder。如果none(在主线上),询问用户此评论针对哪个分支。在<work-folder>/reviews/中查找审核文件 (*.review.*.md)。使用最新的一个(按文件名中的日期)。如果未找到审核文档:“未找到审核文档。先运行/code-review生成一个。”阅读审查文件
阅读评论文档。注意:前面的
phase:- 如果已经有committed或fixes-verified,则警告:“此审核已被应用。运行/code-review full以进行新的审核周期。”检查的[x]结果 - 这些是修复任何Instructions:字段的结果 - 用户指令优先于审阅者建议sha:- 审阅时的HEAD阅读项目背景
阅读存储库根目录中的
CLAUDE.md— 注意在阶段 1 中使用的验证命令(lint、类型检查、测试、格式)。检查未提交的更改
如果存在未提交的更改(来自预加载的上下文):“存在未提交的更改。想要在继续之前隐藏它们,还是按原样继续?”等待他们的答复。创建进度任务: 修复结果 验证修复 完成 - 更新审核文档、提交、推送