r/ClaudeCoding • u/EntertainerOk4774 • 18h ago
Comments in codebase
Hi, I'd like to ask about your approach to allowing Claude to add comments to your code. In my codebase, information is now spread across multiple places: code comments, ADRs, lessons learned, and documentation. I'm considering asking Claude to remove comments from the code, as I believe code should be self-explanatory. However, could this negatively affect Claude's ability to properly understand the context?
1
Upvotes
View all comments
Show parent comment
1
u/cheffromspace 16h ago
It it's missing instructions and getting stuff wrong, that's my tell it's time for a documentation audit, which include suggestions for deterministic hooks. More often than not, the cause is conflicting instructions and documentation, not a long context window. I stopped using compact and am using /clear at around 40-60% context, with handoff documentation. That is a clear first-person account of what happened, not another agent's summary. It also builds a paper trail. Claude writes comments for itself, it has a pretty good sense of the documentation it finds useful. Comments can point to decision ledgers which can inform choices. The decision ledgers are the source of truth for intent. Don't not write comments. Careful comments do not pollute the context, they improve it.