r/ClaudeCoding • • 33m 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

12 comments sorted by

View all comments

Show parent comment

1

u/lgmarian 11m 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.

1

u/ChucksnTaylor 7m ago

Get your point for sure, but that’s kinda the beauty of AI, it never writes sloppy after thought comments. A jr dev may not fully understand what they’ve written or may not bother to be precise with the comment. Those issues don’t exist with AI.

1

u/lgmarian 5m ago

Bro, it was all done by AI.