Install
openclaw skills install @carolz1/code-reviewConduct thorough multi-axis code reviews assessing correctness, readability, architecture, security, and performance before merging any changes, with severit...
openclaw skills install @carolz1/code-reviewMulti-dimensional review for any change before merge. Every change gets reviewed. No exceptions. / 合并前对任何变更做多维度审查。每个变更都要被审查,没有例外。
Approve a change when it definitely improves overall code health, even if it isn't perfect. Perfect code doesn't exist. Don't block a change because it isn't exactly how you would have written it. If it improves the codebase and follows project conventions, approve it. / 当变更确实提升了整体代码健康度时通过,即使它不完美。完美代码不存在。不要因为不是你的写法就阻塞。如果变更提升了代码库并遵循项目约定,通过它。
Every review evaluates code across these dimensions: / 每个审查都跨这些维度评估代码:
Does the code do what it claims to do? / 代码是否做了它声称要做的事?
Can another engineer understand this without the author explaining? / 另一个工程师能否不需要作者解释就看懂?
temp, data, result without context) / 命名有意义、与项目约定一致?// removed comments. / 死代码:无用变量、向后兼容壳、// removed 注释。Does the change fit the system's design? / 变更是否符合系统设计?
any/unknown/optional/casts and silent fallbacks. / 类型边界是否显式?质疑无端 any/unknown/optional/cast 和静默回退。Does the change introduce vulnerabilities? / 变更是否引入漏洞?
Quick security scan (run if available): / 快速安全扫描(可用就跑):
# dependency audit / 依赖审计
npm audit # Node
pip-audit # Python
go mod tidy && go list -m -u all # Go
# secret scan / 密钥扫描
grep -rE "(api[_-]?key|secret|password|token)\s*[:=]" --include="*.{js,ts,py,go,java,rb}" .
Does the change introduce performance problems? / 变更是否引入性能问题?
When you flag a structural problem, propose the move — not just the problem. A review that only says "this is complex" leaves the author guessing. / 当你标记结构问题时,给出修复动作——不要只说问题。只说「这复杂」的审查让作者瞎猜。
Reach for a named restructuring: / 使用命名的重构动作:
Prefer the remedy that removes moving pieces over one that spreads the same complexity around. / 优先选消除移动部件的修复,而不是把同样复杂度摊开。
Small focused changes are easier to review, faster to merge, safer to deploy. / 小而聚焦的变更更易审查、更快合并、更安全部署。
~100 lines changed → Good. Reviewable in one sitting.
好。一次性能审完。
~300 lines changed → Acceptable if single logical change.
可接受(如果是一个逻辑变更)。
~1000 lines changed → Too large. Split it.
太大。拆开。
Watch file size, not just diff size. Around 1000 total lines in a single file is a common inspection signal. When a change grows an already-large file, ask whether to extract helpers, subcomponents, or modules first. / 看文件大小,不只看 diff 大小。单文件 ~1000 行总行数是常见检查信号。变更让已大文件更大时,先问要不要先拆。
Splitting strategies / 拆分策略:
| Strategy | How | When |
|---|---|---|
| Stack 堆叠 | Submit small change, start next based on it / 提交小变更,下一个基于它 | Sequential dependencies / 顺序依赖 |
| By file group 按文件分组 | Separate changes for groups needing different reviewers / 分组给不同审查者 | Cross-cutting concerns / 横切关注点 |
| Horizontal 横向 | Create shared code/stubs first, then consumers / 先建共享代码/桩,再用 | Layered architecture / 分层架构 |
| Vertical 纵向 | Break into smaller full-stack slices / 拆为更小的全栈切片 | Feature work / 功能工作 |
Separate refactoring from feature work. Refactor + new behavior = two changes. Submit separately. / 重构与功能变更分离提交。
Label every comment so the author knows what's required vs optional. / 给每个评论打标,让作者知道哪些必改哪些可选。
| Prefix | Meaning | Author Action |
|---|---|---|
| (no prefix) / 无前缀 | Required change / 必改 | Must address before merge / 合并前必须处理 |
| Critical: / 严重 | Blocks merge / 阻塞合并 | Security vulnerability, data loss, broken functionality / 安全漏洞、数据丢失、功能损坏 |
| Required: / 必改 | Must fix before merge / 合并前必改 | Logic bug, missed requirement, broken test / 逻辑 Bug、漏需求、测试坏 |
| Optional: / 建议 | Suggestion / 建议 | Worth considering but not required / 值得考虑但不强制 |
| Nit: / 细节 | Minor, optional / 小问题可选 | Formatting, naming preferences / 格式、命名偏好 |
| FYI / 备忘 | Informational only / 仅作备忘 | Context for future reference / 留作日后参考 |
Lead with what matters. Order findings by leverage: correctness + security first, then structural regressions + missed simplifications, then everything else. Don't bury a real issue under cosmetic nits. A few high-conviction comments beat a long list. / 把重要的放前面。按影响力排序:正确性+安全优先,然后结构性回归+可简化点,然后其他。不要把真问题埋在细节下。
- What is this change trying to accomplish? / 变更要达成什么?
- What spec or task does it implement? / 它实现哪个规范/任务?
- What is the expected behavior change? / 期望的行为变更是什么?
Tests reveal intent and coverage: / 测试揭示意图和覆盖度:
- Do tests exist? / 有测试吗?
- Do they test behavior (not implementation details)? / 测的是行为(不是实现细节)?
- Are edge cases covered? / 边界覆盖了吗?
- Do tests have descriptive names? / 测试名有意义吗?
- Would tests catch a regression if code changed? / 代码改了测试能抓到吗?
Walk through with five axes in mind. See the Five-Axis Review above. / 用五维走查。见上。
Apply severity labels. Lead with what matters. / 打严重程度标签。把重要的放前面。
Check the author's verification story: / 检查作者的验证故事:
- What tests were run? / 跑了哪些测试?
- Did the build pass? / 构建通过吗?
- Was the change tested manually? / 手动测了吗?
- Screenshots for UI changes? / UI 变更截图了吗?
- Before/after comparison? / 前后对比了吗?
Output format (use this template): / 输出格式(用这个模板):
## Review: [PR/Change title]
### Context
- [ ] I understand what this change does and why / 我理解变更做什么、为什么
### Correctness / 正确性
- [ ] Change matches spec / 符合规范
- [ ] Edge cases handled / 边界处理
- [ ] Error paths handled / 错误路径处理
- [ ] Tests adequate / 测试充分
### Readability / 可读性
- [ ] Names clear / 命名清晰
- [ ] Logic straightforward / 逻辑直接
- [ ] No unnecessary complexity / 无不必要复杂度
### Architecture / 架构
- [ ] Follows existing patterns / 遵循模式
- [ ] No unnecessary coupling / 无多余耦合
- [ ] Appropriate abstraction / 抽象合适
- [ ] Refactors reduce complexity / 重构降复杂度
### Security / 安全
- [ ] No secrets in code / 代码无密钥
- [ ] Input validated / 输入验证
- [ ] No injection vulnerabilities / 无注入漏洞
- [ ] Auth checks / 鉴权检查
- [ ] External data treated as untrusted / 外部数据不可信
### Performance / 性能
- [ ] No N+1 / 无 N+1
- [ ] No unbounded operations / 无无限操作
- [ ] Pagination on lists / 列表分页
### Verification / 验证
- [ ] Tests pass / 测试过
- [ ] Build succeeds / 构建成
- [ ] Manual verification / 手动验证
### Findings / 发现
**Critical:** [list] / 严重:[列出]
**Required:** [list] / 必改:[列出]
**Optional:** [list] / 建议:[列出]
**Nit:** [list] / 细节:[列出]
**FYI:** [list] / 备忘:[列出]
### Verdict / 结论
- [ ] **Approve** — Ready to merge / 通过——可合并
- [ ] **Request changes** — Issues must be addressed / 请求变更——必须处理
| Rationalization / 借口 | Reality / 真相 |
|---|---|
| "It works, that's good enough" / 「能跑就行」 | Working code that's unreadable, insecure, or architecturally wrong creates compounding debt. / 能跑但难读、不安全、架构错的代码会产生复合债务。 |
| "I wrote it, so I know it's correct" / 「我写的,我肯定对」 | Authors are blind to their own assumptions. Every change benefits from another set of eyes. / 作者对自己的假设盲。 |
| "We'll clean it up later" / 「之后清理」 | Later never comes. Require cleanup before merge, not after. / 之后永远不会来。合并前要求清理,不是合并后。 |
| "AI-generated code is probably fine" / 「AI 生成的应该没问题」 | AI code needs MORE scrutiny, not less. It's confident and plausible, even when wrong. / AI 代码需要更多审查,不是更少。 |
| "The tests pass, so it's good" / 「测试过就行」 | Tests are necessary but not sufficient. They don't catch architecture, security, readability issues. / 测试必要但不充分。 |
| "The refactor makes it cleaner" / 「重构更干净」 | Relocating complexity isn't reducing it. Count concepts reader holds. / 搬位置不是降复杂度。 |
| "It's only a small addition to this file" / 「只是给这个文件小加一点」 | Small diffs still push files past healthy size. Judge resulting structure, not diff size. / 小 diff 也让文件超出健康大小。看结果结构,不看 diff 大小。 |
| "It's just a version bump" / 「只是版本号 bump」 | A bump is a behavior change you didn't write. Read the changelog. / Bump 是你没写的行为变更。读 changelog。 |
After any refactoring or implementation change, check for orphaned code: / 任何重构或实现变更后,检查孤儿代码:
Don't silently delete things you're not sure about. When in doubt, ask. / 没把握不要默默删。不确定就问。