caveman-review 是一个面向代码审查场景的技能,核心目标是生成“超压缩”的审查评论:去掉噪音,保留可执行信号。每条评论一行,结构为位置、问题、修复建议。
用途
它用于撰写代码审查(code review)评论,尤其是 PR 反馈。它不负责写代码修复、不负责批准或请求更改、不运行 linter,只输出可直接粘贴到 PR 的评论内容。
主要能力
格式规则:使用 L<行号>: <问题>. <修复>. 的形式;审查多文件 diff 时使用 <文件>:L<行号>: ...。
严重级别前缀(可选,混合出现时使用):
- 🔴 bug: 行为损坏,会导致事故
- 🟡 risk: 能工作但脆弱(竞态、缺少空值检查、吞掉错误)
- 🔵 nit: 风格、命名、微优化,作者可以忽略
- ❓ q: 真实提问,不是建议
需要删除的内容:
- “I noticed that...”“It seems like...”“You might want to consider...”
- “This is just a suggestion but...” —— 改用 nit:
- “Great work!”“Looks good overall but...” —— 在顶部说一次,不要每条评论都说
- 复述该行代码在做什么 —— 审查者能读 diff
- 模糊措辞(“perhaps”“maybe”“I think”)—— 如果不确定就用 q:
需要保留的内容:
- 精确行号
- 反引号包裹的精确符号/函数/变量名
- 具体修复方案,而不是“consider refactoring this”
- 当修复方案从问题描述中不明显时,说明原因(why)
使用方式
直接按上述格式输出评论,准备粘贴到 PR。示例:
- 不推荐:“I noticed that on line 42 you're not checking if the user object is null before accessing the email property. This could potentially cause a crash if the user is not found in the database. You might want to add a null check here.”
- 推荐:L42: 🔴 bug: user can be null after .find(). Add guard before .email.
- 不推荐:“It looks like this function is doing a lot of things and might benefit from being broken up into smaller functions for readability.”
- 推荐:L88-140: 🔵 nit: 50-line fn does 4 things. Extract validate/normalize/persist.
- 不推荐:“Have you considered what happens if the API returns a 429? I think we should probably handle that case.”
- 推荐:L23: 🟡 risk: no retry on 429. Wrap in withBackoff(3).
自动切换完整说明(Auto-Clarity)
以下情况放弃精简模式:安全类发现(CVE 级 bug 需要完整解释和引用)、架构分歧(需要理由,而不只是一行结论)、以及作者是新成员需要理解“为什么”的上手场景。这些情况下写正常段落,然后对其余部分恢复精简模式。
适用场景
适用于日常 PR 审查、多文件 diff 审查,以及希望减少反馈噪音、提高可执行性的团队协作场景。
限制
仅用于审查评论,不写代码修复、不做批准或请求更改、不运行 linter。可通过“stop caveman-review”或“normal mode”恢复为冗长审查风格。