Claude completes the code review within the current session. When no arguments are provided, it automatically reviews the current git changes; a git revision can also be passed to review a specified commit. During the review, the main thread coordinates and executes subtasks in parallel through subagents. The main thread first aggregates the results and writes them to a .claude/review/<功能名>.md Markdown review report; after the user confirms "what should be changed and what should not be changed," it then generates and writes a .claude/plan/review-<功能名>.md Markdown implementation plan.
Usage
/ac-review [代码|描述|git修订号]
- No arguments: automatically review
git diff HEAD - The argument is a git revision number: review the changes in that commit
- Other arguments: review the specified code or description
Role division
| Role | Responsibility |
|---|---|
| Claude (main thread) | Obtain the content to be reviewed, split subtasks, aggregate results, write to .claude/review/*.md, ask about the remediation scope, generate .claude/plan/review-*.md, output the final prompt |
| subagents | Retrieve context in parallel, perform itemized review, return the issue list |
Execution constraints
Working directory:
{{WORKDIR}}: use the absolute path of the current working directory as the review root directory- If the user has added multiple workspaces via
/add-dir, first use Glob/Grep to determine the workspace relevant to the task - If it cannot be determined, use
AskUserQuestionto ask the user to select the target workspace
Important:
- The review must be initiated by the Claude main thread, and the
Agenttool must be used to launch subagents to execute subtasks - If multiple independent subtasks can be run in parallel, multiple subagents must be launched in parallel in the same round
- For searches, reading, or review content already delegated to subagents, the main thread should not repeat the work
- Subagents only perform retrieval and review, do not modify code, and do not directly output final conclusions to the user
- All review opinions must be uniformly deduplicated and graded by the main thread and organized into a review report
- Product code must not be modified during the review phase; the only allowed write operation is generating
.claude/review/*.mdand.claude/plan/review-*.mdMarkdown files - A review report must be generated first, and then the user must be asked about the remediation scope; without user confirmation, an execution plan must not be generated directly
Execution workflow
🔍 Phase 1: Obtain the code to be reviewed
[模式:研究]
When no arguments are provided: execute git diff HEAD and git status --short
When the argument is a git revision number: execute git show --stat --patch <revision> to obtain the changes in that commit
For other arguments: use the specified code/description
Call {{MCP_SEARCH_TOOL}} to obtain relevant context.
🧩 Phase 2: Split review subtasks
[模式:规划]
The main thread first splits subtasks based on the change scope, then launches subagents in parallel. By default, split into at least the following two directions:
- Correctness and regression risk review
- Check logic errors, boundary conditions, null/exception paths, and potential regressions
- Maintainability and integration risk review
- Check naming and responsibilities, duplicated logic, test gaps, and cross-module/interface consistency
If the scope of changes is relatively large, you may continue to add subtasks by file group, module, or topic, but you must maintain "parallelizable, clear responsibilities, and aggregatable results."
🔬 Phase 3: Parallel execution of subagent reviews
[模式:审查]
- Use the
Agenttool inthe same roundto start multiple subagents in parallel - each subagent is only responsible for its own review scope
- Each subagent outputs:
- Issue level: Critical / Major / Minor / Suggestion
- Specific location:
file_path:line_number - Issue description, cause, and repair suggestions if necessary
- The main thread must wait for all subagents to return before proceeding to the next phase
🔀 Phase 4: The main thread consolidates feedback and archives review results
[模式:综合]
- Collect the review results of all subagents
- Merge duplicate issues and retain the most specific evidence and location
- Classify by severity: Critical / Major / Minor / Suggestion
- Provide an overall assessment: whether it can be merged, main risk points, and suggested priority
- Generate and write
.claude/review/<功能名>.mdreview report; the content must be Markdown, and the suggested structure is as follows:
## 📋 审查报告:<任务名称>
### 审查范围
- 变更文件:<数量> | 代码行数:+X / -Y
### 总体评价
- 代码质量:[优秀/良好/需改进]
- 是否可合并:[是/否/需修复后]
### 关键问题 (Critical)
> 必须修复才能合并
1. <问题描述>
### 主要问题 (Major)
1. <问题描述>
### 次要问题 (Minor)
1. <问题描述>
### 建议 (Suggestion)
1. <建议内容>
⛔ End of Phase 4: Review report delivery (non-execution)
/ac-review At this phase, the following actions must be performed:
-
Create and write
.claude/review/<功能名>.md -
Show the complete review report content to the user (directly output the Markdown body of the report; do not only give a summary, only indicate that it has been saved, or only let the user open the file themselves)
-
Usebold textto output the prompt (you must use the actual saved file path):
📋 The review report has been generated and saved to
.claude/review/实际功能名.mdPlease review the above report first and confirm the scope of remediation: tell me which issues need to be modified and which will not be modified for now.
- You can choose by issue level: for example, "only fix Critical and Major"
- You can also choose by specific item: for example, "fix items 1, 2, and 4, and leave the rest unchanged for now"
After confirmation, I will generate the execution plan file:
.claude/plan/review-实际功能名.mdLater, after the implementation plan is generated, please have the user review it and, once satisfied, manually execute:
/ac-execute .claude/plan/review-实际功能名.md
⚠️ Note: the above
实际功能名.mdmust be replaced with the actual file name you saved!** -
Immediately terminate the current reply(Stop here. No more tool calls.)
⚠️ Absolutely prohibited:
- ❌ Only printing the result in the conversation without writing it to disk
- ❌ Only indicating that the file has been written, without showing the body of the review report
- ❌ Directly generating an execution plan without user confirmation of the remediation scope
- ❌ Directly modifying product code
- ❌ Automatically calling
/ac-executeor any implementation action
After the remediation scope is confirmed
After the user clearly states "which issues should be changed and which should not be changed for now":
📌 Phase 5: Generate the remediation implementation plan
[模式:计划]
- Based only onthe scope of issues the user confirms to modifygenerate the plan
- For issues explicitly excluded by the user:
- do not include them in the implementation steps
- only record them in "items not handled for now"
- Generate and write
.claude/plan/review-<功能名>.md; the content must be Markdown, and the suggested structure is as follows:
## 📋 实施计划:review-<任务名称>
### 来源审查报告
- `.claude/review/<功能名>.md`
### 本次处理范围
- <要修的问题列表>
### 暂不处理项
- <本轮不修改的问题列表>
### 实施步骤
1. <步骤 1>
2. <步骤 2>
### 关键文件
| 文件 | 操作 | 说明 |
|------|------|------|
| path/to/file.ts:L10-L50 | 修改 | 描述 |
### 风险与验证
| 风险 | 缓解/验证方式 |
|------|---------------|
| <风险> | <验证方式> |
⛔ End of Phase 5: Implementation plan delivery (non-execution)
-
Create and write
.claude/plan/review-<功能名>.md -
Show the complete implementation plan to the user
-
inbold textoutput prompt (must use the actual saved file path):
📋 Implementation plan has been generated and saved to
.claude/plan/review-实际功能名.mdPlease review the above plan. You can:
- 🔧 Modify the plan: tell me the parts that need adjustment, and I will update the plan
- ▶️ Execute the plan: copy the following command to a new session to execute
/ac-execute .claude/plan/review-实际功能名.md
⚠️ Note: the above
实际功能名.mdmust be replaced with the filename you actually saved!** -
Immediately terminate the current reply(Stop here. No more tool calls.)
Result saving
- Review report:
.claude/review/<功能名>.md - Implementation plan:
.claude/plan/review-<功能名>.md - Iteration version:
.claude/review/<功能名>-v2.md、.claude/plan/review-<功能名>-v2.md...
Writing should be completed before showing the corresponding content to the user.
Result modification process
Modify the review report
If the user requests modification of the review conclusion:
- Adjust the content based on user feedback
- Update
.claude/review/<功能名>.md - Re-display the modified review report
- Prompt the user again to confirm the scope of remediation
Modify the implementation plan
If the user requests modification of the remediation plan:
- Adjust the content based on user feedback
- Update
.claude/plan/review-<功能名>.md - Re-display the modified implementation plan
- Prompt the user again to review or execute
Next steps
After the user first reviews the review report, confirms the scope of remediation, and is satisfied with the subsequent review implementation plan,manuallyexecute:
/ac-execute .claude/plan/review-<功能名>.md
Key rules
- No parameters = review git diff – automatically obtain the current changes
- git revision = review that commit – automatically obtain the patch content of the specified commit
- Claude main thread coordination + subagents parallel review – do not call external review models
- Archive the review report first, then generate the implementation plan – the responsibilities of the two types of artifacts must be separated
- The scope of remediation must be confirmed by the user – before confirmation, do not generate
.claude/plan/review-*.md - The review process is read-only – during the review phase, do not modify product code