playbook/templates/prompts/coding/code-review.template.md

58 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Code Review 入口
## 触发场景
收到 MR/PR 需要评审时。
## 准备
切换到对应分支并获取变更内容:
```bash
# GitLab
glab mr checkout <MR_ID>
glab mr view <MR_ID> | cat
glab mr diff <MR_ID> | cat
# GitHub
gh pr checkout <PR_NUMBER>
gh pr view <PR_NUMBER>
gh pr diff <PR_NUMBER>
```
## 审查顺序
1. 先理解业务目标;目标不明确先要求补足上下文
2. 优先审查 bug、风险、回归和缺失测试
3. 再审查代码清晰度、KISS 和单一职责
4. 最后汇总剩余风险与待确认项
## 规则
- Findings 优先,按严重度排序
- 每条结论必须附文件路径、行号或可复现依据
- 没有证据的问题按待确认假设处理
- 评审不只看 diff需结合代码库整体上下文
## 输出协议
```markdown
## Findings
1. [severity] path - issue
## Open Questions
- ...
## Residual Risk
- ...
```
## 停止条件
- 目标不明时停止并要求补足上下文
- 缺少 diff 或无法读取关键上下文时停止并说明
---
**最后更新**{{DATE}}