defect-first-review
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDefect-First Review
缺陷优先审查
Repo-owned successor to the Codex-bundled . That one lives under
and is replaced on every Codex update, so edits to it do not survive;
this one is canonical in and ships through . The rename is
deliberate — two skills named would be indistinguishable at the call site.
review-agent~/.codex/skills/.system/ohyeh/agent-scriptsskills-lock.jsonreview-agentInspect the requested target directly and return every finding that the author would likely fix.
Do not modify files, create commits, push branches, post review comments, or delegate the review
to another agent.
作为Codex内置的仓库专属替代工具,原内置工具位于,每次Codex更新都会被替换,因此对其的修改无法保留;本工具是中的标准实现,通过分发。更名是有意为之——两个同名的技能在调用时无法区分。
review-agent~/.codex/skills/.system/ohyeh/agent-scriptsskills-lock.jsonreview-agent直接检查请求的目标对象,返回所有作者可能会修复的问题。请勿修改文件、创建提交、推送分支、发布审查评论或将审查委托给其他Agent。
Order of work — read before you run
工作顺序——先阅读再运行
Reading the diff IS the work. Until the semantic pass over the whole diff is finished and the
findings are written down, do not run builds, test suites, linters, formatters, or static
analysis. A suite result says nothing about whether this change introduced a defect — it reports
what the author's tests already cover — and any failure it does surface will pull the review onto
that failure instead of the diff you were asked to read. Measured 2026-08-28: a review that
started a full test run 2.4 minutes in made 5 test/analyze calls, never finished the semantic
pass, and reported on the wrong thing.
Verification is scoped to findings, not to the repository. Once a finding is written down you may
run the narrowest command that reproduces that specific finding — one test, one file, one
analyzer path. "Run the whole suite and see what breaks" is not verification; it is a substitute
for the review. If the requester explicitly asks for a test run, say what the review still owes
before running it, then run it.
Read with ranged reads: to for the changed hunks, and line ranges
(, ) for the surrounding code. Never dump a whole source file — a review
that has read eight whole files has spent its context on the 95% that did not change, and every
later turn re-carries it.
git diff -U5-U10sed -nnl -ba | sed -n阅读差异内容就是核心工作。在完成对整个差异的语义分析并记录所有问题之前,请勿运行构建、测试套件、代码检查器、格式化工具或静态分析。测试套件的结果无法说明本次变更是否引入缺陷——它仅反映作者的测试已覆盖的范围——而测试中出现的任何失败都会让审查偏离原本要阅读的差异内容。2026年8月28日的测试数据显示:在2.4分钟时启动完整测试运行的审查,共进行了5次测试/分析调用,从未完成语义分析,且报告了无关内容。
验证仅针对已发现的问题,而非整个仓库。记录问题后,你可以运行能复现该特定问题的最窄范围命令——比如单个测试、单个文件、单个分析路径。"运行整个套件看看哪里出错"不属于验证,而是审查的替代方式。如果请求者明确要求运行测试,请先说明审查尚未完成的内容,再执行测试。
使用范围读取方式:对变更代码块使用至,对周边代码使用行范围(、)。切勿输出整个源文件——阅读了八个完整文件的审查,会把精力浪费在95%未变更的内容上,后续每次操作都会重复加载这些无关内容。
git diff -U5-U10sed -nnl -ba | sed -nReview the change
审查变更
- Read the applicable instructions.
AGENTS.md - Inspect the complete diff for the requested target and enough surrounding code to understand each changed path.
- Identify concrete regressions introduced by the change. Continue through the whole diff after finding the first issue.
- Check the relevant tests and call sites to confirm that each finding is real and actionable.
For a base-branch review, compare the changes that would actually merge rather than diffing
directly against the branch tip. Resolve the comparison ref to the branch's upstream when that
upstream exists and is ahead of the local branch; otherwise use the local branch. Run
, then inspect . If the local
branch cannot be resolved, try its configured upstream explicitly before reporting that the target
is unavailable.
git merge-base HEAD <comparison-ref>git diff <merge-base-sha>Flag an issue only when all of these are true:
- It affects correctness, security, performance, or maintainability in a meaningful way.
- It is discrete and actionable.
- It was introduced by the reviewed change.
- The affected scenario or call path can be demonstrated from the code.
- The author would probably fix it if they knew about it.
Do not flag speculative concerns, pre-existing problems, intentional behavior changes, or style
nits that do not obscure the code.
- 阅读适用的指令。
AGENTS.md - 检查请求目标的完整差异,以及足够的周边代码以理解每个变更路径。
- 识别变更引入的具体回归问题。找到第一个问题后继续完成整个差异的审查。
- 检查相关测试和调用点,确认每个问题真实存在且可修复。
对于基础分支审查,请比较实际会合并的变更,而非直接与分支尖端进行差异对比。当分支的上游存在且领先于本地分支时,将对比引用解析为分支的上游;否则使用本地分支。运行,然后检查。如果本地分支无法解析,请先尝试显式使用其配置的上游,再报告目标不可用。
git merge-base HEAD <comparison-ref>git diff <merge-base-sha>仅当满足以下所有条件时才标记问题:
- 对正确性、安全性、性能或可维护性有实质性影响。
- 问题明确且可修复。
- 由本次审查的变更引入。
- 受影响的场景或调用路径可通过代码演示。
- 如果作者知晓该问题,很可能会修复它。
请勿标记推测性问题、预先存在的问题、有意的行为变更或不影响代码可读性的风格问题。
Write the result
撰写结果
Present findings first, ordered by severity. Use one entry per issue in this form:
[P1] Imperative finding title — path/to/file.rs:lineFollow the title with one short paragraph explaining the affected scenario and why the behavior is
wrong. Keep the cited range as small as possible and make sure it overlaps the reviewed diff.
Use these priorities:
- : universal release blocker or critical failure.
P0 - : urgent defect that should be fixed next.
P1 - : ordinary defect that should be fixed.
P2 - : low-impact issue that is still worth fixing.
P3
If there are no qualifying findings, say Do not invent a finding to fill the result.
After the findings, add a brief overall assessment and mention any material test gaps or residual
risks.
No findings.先呈现问题,按严重程度排序。每个问题使用以下格式:
[P1] 命令式问题标题 — path/to/file.rs:line标题后用一段简短的文字解释受影响的场景以及行为错误的原因。尽量缩小引用范围,并确保其与审查的差异内容重叠。
使用以下优先级:
- :通用发布阻塞问题或严重故障。
P0 - :需优先修复的紧急缺陷。
P1 - :应修复的普通缺陷。
P2 - :影响较小但仍值得修复的问题。
P3
如果没有符合条件的问题,请说明 请勿为了填充结果而编造问题。问题列表之后,添加简短的整体评估,并提及任何重大测试缺口或剩余风险。
无问题。