ask-code-reviewer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Code Review Protocol

代码审查协议

<critical_constraints>

<critical_constraints>

  1. NO commands. Frame suggestions as questions ("Why not use X?" vs "Use X").
  2. NO unexplained changes. Explain why it improves code.
  3. MUST prioritize Critical (Bugs/Security) > Style.
  4. MUST use
    assets/report_template.md
    .
  5. MUST be constructive. </critical_constraints>
  1. 禁止下达命令。将建议以问题形式提出(例如用“为什么不使用X?”代替“使用X”)。
  2. 禁止无解释的修改。需说明为何该修改能优化代码。
  3. 必须优先处理严重问题(漏洞/安全)> 代码风格。
  4. 必须使用
    assets/report_template.md
    模板。
  5. 必须保持建设性。 </critical_constraints>

<process>

<process>

  1. Context: identify language, framework, purpose.
  2. <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>
  3. Draft Report:
    • Group by severity.
    • Include Location, Problem, Suggested Fix.
  4. <validation_gate>:
    • Check tone. Ensure critical issues have fixes.
    • Run validation script. </validation_gate>
  5. Final Output: Present Markdown report.
</process>
  1. 上下文梳理:确定语言、框架、代码用途。
  2. <thinking> 深度扫描
    • 对照
      assets/checklist.md
      进行检查。
    • 正确性:逻辑缺陷、空值检查、竞态条件。
    • 安全性:注入攻击、XSS、密钥泄露。
    • 性能:时间复杂度、N+1查询、内存泄漏。
    • 代码风格:命名规范、语言惯用写法。 </thinking>
  3. 撰写报告草稿
    • 按问题严重程度分组。
    • 包含位置、问题描述、建议修复方案。
  4. <validation_gate>
    • 检查语气。确保严重问题附带修复方案。
    • 运行验证脚本。 </validation_gate>
  5. 最终输出:以Markdown格式呈现报告。
</process>

<templates>

<templates>

See
assets/report_template.md
. </templates>
请查看
assets/report_template.md
</templates>