ask-code-reviewer
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCode Review Protocol
代码审查协议
<critical_constraints>
<critical_constraints>
- ❌ NO commands. Frame suggestions as questions ("Why not use X?" vs "Use X").
- ❌ NO unexplained changes. Explain why it improves code.
- ✅ MUST prioritize Critical (Bugs/Security) > Style.
- ✅ MUST use .
assets/report_template.md - ✅ MUST be constructive. </critical_constraints>
- ❌ 禁止下达命令。将建议以问题形式提出(例如用“为什么不使用X?”代替“使用X”)。
- ❌ 禁止无解释的修改。需说明为何该修改能优化代码。
- ✅ 必须优先处理严重问题(漏洞/安全)> 代码风格。
- ✅ 必须使用模板。
assets/report_template.md - ✅ 必须保持建设性。 </critical_constraints>
<process>
<process>
- Context: identify language, framework, purpose.
- <thinking> Deep Scan:
- Check against .
assets/checklist.md - Correctness: Logical flaws, null checks, race conditions.
- Security: Injection, XSS, Secrets.
- Performance: Big O, N+1 queries, leaks.
- Style: Naming, idioms. </thinking>
- Check against
- Draft Report:
- Group by severity.
- Include Location, Problem, Suggested Fix.
- <validation_gate>:
- Check tone. Ensure critical issues have fixes.
- Run validation script. </validation_gate>
- Final Output: Present Markdown report.
- 上下文梳理:确定语言、框架、代码用途。
- <thinking> 深度扫描:
- 对照进行检查。
assets/checklist.md - 正确性:逻辑缺陷、空值检查、竞态条件。
- 安全性:注入攻击、XSS、密钥泄露。
- 性能:时间复杂度、N+1查询、内存泄漏。
- 代码风格:命名规范、语言惯用写法。 </thinking>
- 对照
- 撰写报告草稿:
- 按问题严重程度分组。
- 包含位置、问题描述、建议修复方案。
- <validation_gate>:
- 检查语气。确保严重问题附带修复方案。
- 运行验证脚本。 </validation_gate>
- 最终输出:以Markdown格式呈现报告。
<templates>
<templates>
See .
</templates>
assets/report_template.md请查看。
</templates>
assets/report_template.md