大模型
x.com ·
@bcherny
Anthropic 的 Boris Cherny:Claude 生成代码的质量分层与护栏实践
Boris Cherny 认为一次性原型代码可当作黑盒处理,而 Claude 编写的生产代码应比人类代码有更高标准。他提到 Anthropic 内部通过大量 lint 规则、测试、Claude 驱动的端到端测试、每日运行的 Claude 模糊测试、自动代码审查与安全审查、自动重构等护栏来保证质量,否则会积累难以维护的债务。若代码不达标,可尝试使用最新前沿模型(Opus 5 或 Fable 5.1)、提高 effort 到 high 或 xhigh、投入 CLAUDE.md 和 skills 教会 Claude 适配代码库,或更多人工引导、让 Claude 偿还技术债并重写代码库。
AI推荐理由 Anthropic 的 Boris Cherny 给出 Claude 生成代码质量分层的实践观点:一次性原型可当黑盒,生产代码标准应高于人类代码,并列举 lint、测试、Claude 驱动的端到端测试与模糊测试、自动代码审查与安全审查、自动重构等护栏,以及提升模型版本、effort、CLAUDE.md/skills 等具体手段。属于一线从业者的经验性观点而非可验证数据,无量化证据,但信息密度较高、对使用 AI 编码的团队有直接参考价值。
72
浏览 103,161
点赞 1,631
评论 100
转发 66
正文
Hey ████,
I think there is room for both.
1. Prototypes and other throw-away code can be treated as totally black box. If you’re going to throw it away anyway, and if the blast radius of it breaking is low, it doesn’t need to be perfect.
2. Production code written by Claude should have a higher bar than if it was written by a human. At Anthropic, we have many guardrails in place to make sure this is happening: lots of lint rules, lots of tests, Claude-driven end to end tests, Claude-powered fuzzers running daily, automated code reviews and security reviews, automated code refactoring, and so on. Without these, you can end up with a mess that is hard to maintain down the line. Luckily, the model makes it increasingly easy to do these well — run a few daily routines, use Claude Code Review, etc.
Your job is to hold the bar on code quality. If Claude’s code doesn’t meet the bar, try:
- Using the latest frontier model (Opus 5 or Fable 5.1)
- Increase effort to high or xhigh
- Invest in your CLAUDE.md and skills to succinctly teach Claude how to work in your codebase
If all else fails, steer Claude more when you work with it, or have Claude fix accumulated debt and rewrite your codebase to make it easier to work with. Or, wait for the next model.
Best,
Boris