gsd-code-review
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese<objective>
Review source files changed during a phase for bugs, security vulnerabilities, and code quality problems.
Spawns the gsd-code-reviewer agent to analyze code at the specified depth level. Produces REVIEW.md artifact in the phase directory with severity-classified findings.
Arguments:
- Phase number (required) — which phase's changes to review (e.g., "2" or "02")
- (optional) — review depth level, overrides workflow.code_review_depth config
--depth=quick|standard|deep- quick: Pattern-matching only (~2 min)
- standard: Per-file analysis with language-specific checks (~5-15 min, default)
- deep: Cross-file analysis including import graphs and call chains (~15-30 min)
- (optional) — explicit comma-separated file list, skips SUMMARY/git scoping (highest precedence for scoping)
--files file1,file2,... - (optional) — after review completes (or if REVIEW.md already exists), auto-apply fixes found. Spawns gsd-code-fixer agent. Accepts sub-flags:
--fix- — include Info findings in fix scope (default: Critical + Warning only)
--all - — enable fix + re-review iteration loop, capped at 3 iterations
--auto
Output: {padded_phase}-REVIEW.md in phase directory + inline summary of findings
</objective>
<execution_context>
@~/.claude/gsd-core/workflows/code-review.md
</execution_context>
<context>
Phase: $ARGUMENTS (first positional argument is phase number)
Optional flags parsed from $ARGUMENTS:
- — Depth override (quick|standard|deep). If provided, overrides workflow.code_review_depth config.
--depth=VALUE - — Explicit file list override. Has highest precedence for file scoping per D-08. When provided, workflow skips SUMMARY.md extraction and git diff fallback entirely.
--files=file1,file2,...
Context files (CLAUDE.md, SUMMARY.md, phase state) are resolved inside the workflow via and delegated to agent via blocks.
</context>
<process>
This command is a thin dispatch layer. It parses arguments and delegates to the workflow.
gsd-tools query init.phase-op<required_reading>Execute end-to-end.
The workflow (not this command) enforces these gates:
- Phase validation (before config gate)
- Config gate check (workflow.code_review)
- File scoping (--files override > SUMMARY.md > git diff fallback)
- Empty scope check (skip if no files)
- Agent spawning (gsd-code-reviewer)
- Result presentation (inline summary + next steps)
<objective>
审查某阶段中变更的源文件,查找漏洞、安全漏洞和代码质量问题。
启动gsd-code-reviewer Agent,按照指定的深度级别分析代码。在阶段目录中生成REVIEW.md工件,其中包含按严重程度分类的检查结果。
参数:
- 阶段编号(必填)—— 要审查哪个阶段的变更(例如:"2"或"02")
- (可选)—— 审查深度级别,覆盖workflow.code_review_depth配置
--depth=quick|standard|deep- quick:仅模式匹配(约2分钟)
- standard:针对每个文件进行语言特定检查(约5-15分钟,默认值)
- deep:跨文件分析,包括导入图和调用链(约15-30分钟)
- (可选)—— 明确的逗号分隔文件列表,跳过SUMMARY/git范围限定(范围限定优先级最高)
--files file1,file2,... - (可选)—— 审查完成后(或如果REVIEW.md已存在),自动应用发现的修复。启动gsd-code-fixer Agent。接受子标志:
--fix- —— 将Info级别的检查结果纳入修复范围(默认:仅Critical + Warning级别)
--all - —— 启用修复+重新审查的迭代循环,最多3次迭代
--auto
输出:阶段目录中的{padded_phase}-REVIEW.md文件 + 检查结果的内联摘要
</objective>
<execution_context>
@~/.claude/gsd-core/workflows/code-review.md
</execution_context>
<context>
阶段:$ARGUMENTS(第一个位置参数为阶段编号)
从$ARGUMENTS解析的可选标志:
- —— 深度覆盖(quick|standard|deep)。如果提供,将覆盖workflow.code_review_depth配置。
--depth=VALUE - —— 明确的文件列表覆盖。根据D-08,文件范围限定优先级最高。提供此参数时,工作流将完全跳过SUMMARY.md提取和git diff回退逻辑。
--files=file1,file2,...
上下文文件(CLAUDE.md、SUMMARY.md、阶段状态)通过在工作流中解析,并通过块委托给Agent。
</context>
<process>
此命令是一个轻量调度层。它解析参数并委托给工作流。
gsd-tools query init.phase-op<required_reading>执行端到端流程。
工作流(而非此命令)执行以下检查:
- 阶段验证(配置检查之前)
- 配置门检查(workflow.code_review)
- 文件范围限定(--files覆盖 > SUMMARY.md > git diff回退)
- 空范围检查(无文件则跳过)
- Agent启动(gsd-code-reviewer)
- 结果展示(内联摘要 + 下一步操作)