r/ClaudeCoding • • 49m 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/EntertainerOk4774 44m ago

As the changes produced by the Claude are in 60% in docs/comments/rest and real change affects less. I'm not sure if this not burning tokens just for sake of writing all those comments in code.

2

u/qzjul 41m ago

May burn tokens now, but saves massively on tokens when it changes something that breaks everything and you have to bug hunt

2

u/CounterAttack-Studio 23m ago

I would not optimize for tokens. Optimize for good code. You don't need comments for good code. Good code is self documenting. Sometimes it's not easy to make code self-documenting so you sprinkle comments there, but in general the world mostly switched from "copious comments" to "self-documenting code" around 20 years ago. You will of course find folks that disagree.

If you are commenting for your LLM, I suggest create a glossary or design document nearby and have instructions for the LLM to understand where to find them. I use mattpocock/skills like grill-with-docs for this kind of documentation, which helps prevent the LLM from inventing jargon and gives it a place to check against when writing code.

2

u/lgmarian 23m ago

Tokens shouldn't be the driving force for this, especially if you're not sure where your token costs lie.

1

u/CorpT 24m ago

I guess if you’re sure you’re going to get it right the first time every time and will never make a change. I’m more concerned with quality and reliability than saving a few tokens.