How-to

Anthropic 工程师建议精简 CLAUDE.md:只写 Claude 无法从代码推断的内容

Your CLAUDE.md might be doing too much. @lydiahallie (@AnthropicAI): keep what Claude can't infer f...

Why we picked it

Anthropic 的 Lydia Hallie 分享了维护 CLAUDE.md 的经验:Claude 能从代码推断的就删掉,旧模型时代的指令也该清理。如果你用 Claude Code 又觉得指令文件越来越没效果,这篇能帮你做减法,把上下文留给真正重要的项目约定。

Anthropic 工程师 Lydia Hallie 在 X 上分享了对 CLAUDE.md 文件的维护建议。她提出两条核心原则:只保留 Claude 无法从代码本身推断出来的指令,并定期清理针对旧模型编写的过时说明。这条建议源自她维护 AnthropicAI 相关仓库的实际经验。

Image · AI Engineer
Body

CLAUDE.md 是 Claude Code 读取的项目级上下文文件,很多团队会往里堆积大量编码规范、命令列表和背景说明。Hallie 的观点是,随着模型推理能力增强,许多早期为旧版本模型写的指令已经冗余,模型看代码就能明白的东西不必再写,反而会稀释真正关键信息的权重。

对使用 Claude Code 的开发者来说,这意味着 CLAUDE.md 应该当作需要持续修剪的配置,而不是一次性写完的文档。定期问自己“哪些内容模型自己能推断出来”,可以让上下文窗口留给真正不能省略的项目约定。

Original · AI Engineer

Your CLAUDE.md might be doing too much. @lydiahallie (@AnthropicAI): keep what Claude can't infer f...

Your CLAUDE.md might be doing too much. @lydiahallie ( @AnthropicAI ): keep what Claude can't infer from the code. Revisit instructions written for older models. What would you remove from yours?

Industry Coordinates & Source Verification

This report is categorized under AITOP's "How-to" desk, focusing on US frontier AI labs and Silicon Valley technology leaders. Within our cross-regional analytical framework, it directly maps to AI developer toolchains, coding agents, and engineering workflows. Key entities and technical topics under continuous tracking include Claude Code, CLAUDE.md, prompt engineering, Anthropic.

Source attribution: curated from AI Engineer (@aiDotEngineer).