Dongxi 东锡 NLP· @dongxi_nlp · X·· 12 小时前AI 评分65
AI 导读
Anthropic 分享了其 code review 实践:Claude 约 90% 的 Claude Code 代码,6 月至 9 月合并 PR 翻倍以上,revert 占比下降超 40%。
正文
推荐阅读,Anthropic 如何做 Code Review!
1. 保留 code review,但大部分审核交给机器,人的时间只花在高风险判断上,同时让出错后能快速回滚。
2. 提 PR 前:Claude 自己跑测试和构建,再由一个新开的 agent 审一遍 diff。
3. 每个 PR:AI 多 agent 找 bug,投票过滤掉误报,再加一轮安全审查和 CI。每条发现都必须处理,否则不能合并。
4. 人工审批按风险分级:低风险 0 人,中风险 1 人,高风险 2 人,由分类器判定。bot 的批准不能替代人,驱动 agent 的人对改动负责。
5. 上线:合并队列、feature flag、先内部使用再灰度发布,出问题一键回滚。
6. 持续改进:历史事故整理成每日 eval,用来评估 reviewer。审查轮数设上限,避免 agent 之间无限互审。
Claude writes about 90% of Claude Code's code. From June to September, merged PRs more than doubled while the share reverted fell by more than 40%. We wrote about how we changed code review to get there, and how to adopt it: https://claude.dev/blog/solving-code-review-at-anthropic/在 X 查看被引用的帖子
来源:Dongxi 东锡 NLP · x.com