code-review
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCode Review
代码审查
Context
上下文
Staged diff:
!
git diff --cachedRecent commits (for context):
!
git log --oneline -10暂存差异:
!
git diff --cached最近提交(用于上下文参考):
!
git log --oneline -10Arguments
参数
Raw arguments: $ARGUMENTS
Parse the arguments as follows:
- Agent (optional, first argument): The CLI command or agent name to delegate the review to. Recognized values:
- or
claudeor empty — perform the review directly in this context (default)self - Any other value — treated as a CLI command name (e.g. ,
codex,aider). The review will be delegated by invoking that command via Bash (see Delegation section).goose
- Feature (optional, remaining arguments after agent): A description of what part of the codebase to review (e.g. "voting functionality", "authentication", "API endpoints"). When provided, find and review all files related to this feature. When empty/omitted, review staged changes instead.
If only one argument is given and it does NOT match a known agent name (, ), treat it as the feature instead, with agent defaulting to .
claudeselfclaude原始参数:$ARGUMENTS
参数解析规则如下:
- Agent(可选,第一个参数):用于委托审查的CLI命令或Agent名称。认可的值包括:
- 或
claude或留空——直接在此上下文中执行审查(默认行为)self - 其他任意值——视为CLI命令名称(例如、
codex、aider)。审查将通过Bash调用该命令进行委托(详见委托部分)。goose
- 功能模块(可选,Agent之后的剩余参数):描述需要审查的代码库部分(例如“投票功能”、“身份验证”、“API端点”)。提供该参数时,查找并审查所有与该功能相关的文件。留空时,审查暂存的变更。
如果仅提供一个参数且该参数不匹配已知的Agent名称(、),则将其视为功能模块,Agent默认使用。
claudeselfclaudeInstructions
操作说明
Determine what to review
确定审查范围
- If a feature is specified — use Glob and Grep to find all files related to the described feature. Read those files and review them as existing code.
- If no feature is specified and there are staged changes — review the staged diff shown above.
- If no feature is specified and there are NO staged changes — tell the user: "Nothing to review. Either stage changes with or specify a feature to review, e.g.
git add." Then stop./code-review voting functionality
- 指定了功能模块时——使用Glob和Grep查找所有与描述的功能相关的文件。读取这些文件并作为现有代码进行审查。
- 未指定功能模块但存在暂存变更时——审查上方显示的暂存差异。
- 未指定功能模块且无暂存变更时——告知用户:“没有可审查的内容。请使用暂存变更,或指定要审查的功能模块,例如
git add。” 然后停止操作。/code-review voting functionality
Perform the review
执行审查
Read surrounding source files as needed to understand context. Organize findings by file, then by severity.
根据需要读取周边源文件以理解上下文。按文件分类,再按严重程度整理审查结果。
Severity levels
严重程度等级
- 🔴 Critical — Bugs, security vulnerabilities, data loss risks, or crashes. Must be fixed.
- 🟠 Error — Logic errors, missing error handling, broken edge cases. Very likely to cause problems.
- 🟡 Warning — Code smells, performance concerns, potential edge cases, maintainability issues.
- 🔵 Suggestion — Better approaches, readability improvements, idiomatic alternatives.
- ⚪ Nitpick — Style, naming, formatting, minor preferences. Totally optional.
- 🔴 关键——漏洞、安全隐患、数据丢失风险或崩溃问题。必须修复。
- 🟠 错误——逻辑错误、缺少错误处理、边缘场景失效。极有可能引发问题。
- 🟡 警告——代码异味、性能问题、潜在边缘场景、可维护性问题。
- 🔵 建议——更优实现方式、可读性提升、符合语言习惯的替代方案。
- ⚪ 细节优化——风格、命名、格式、次要偏好。完全可选。
Output format
输出格式
Group findings by severity. Each severity level that has findings should be its own heading (e.g. , , etc.). Within each severity heading, list the findings. For each finding, include:
## 🔴 Critical## 🟠 Error- The file and line reference
- A concise description of the issue
- A suggested fix or alternative (when applicable)
Omit severity headings that have no findings.
End with a section: overall assessment, whether changes look good to merge (or code looks healthy), and a count of findings per severity level.
## Summary按严重程度分组展示结果。每个有结果的严重程度等级应作为独立标题(例如、等)。每个严重程度标题下,列出审查发现。每个发现需包含:
## 🔴 关键## 🟠 错误- 文件和行号引用
- 问题的简洁描述
- 建议的修复方案或替代方案(如有)
省略没有发现的严重程度标题。
最后添加部分:整体评估、变更是否适合合并(或代码是否健康),以及各严重等级的发现数量统计。
## 总结Delegation
委托审查
If the agent is not //empty, it is treated as a CLI command name. Delegate the review by invoking that command via Bash:
claudeself- Build a prompt that includes the review instructions, severity levels, output format, and either the staged diff or the feature description
- Run: where
<agent> -q "<prompt>"is the CLI command the user specified (e.g.<agent>,codex,aider)goose - When the command returns, relay its findings to the user verbatim
如果Agent不是//留空,则将其视为CLI命令名称。通过Bash调用该命令进行委托审查:
claudeself- 构建包含审查说明、严重程度等级、输出格式以及暂存差异或功能模块描述的提示词
- 执行:,其中
<agent> -q "<prompt>"是用户指定的CLI命令(例如<agent>、codex、aider)goose - 命令返回结果后,将其内容原封不动地转发给用户