r/ClaudeCoding • u/EntertainerOk4774 • 1h 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/lgmarian 55m ago
A downside of extensive comments is that there's more that can go out of sync with the code. I recently had a jr dev put up a PR where a small method (7 lines), was less code than comment (15 line DocBlock), some of which was already wrong.
My philosophy is that comments should document intent. Let the code tell us what the code does. Where there's something non-obvious about the code, especially due to obscure optimizations, a comment should tell us what the code is doing, along with stating the intent.