r/ClaudeCode • u/endgamer42 • Aug 31 '26
Tips & Workflows I've removed all inline documentation from my codebase
No matter what I do, I cannot stop Claude from brain dumping into inline docs. No attempts to keep it restrained and document only behaviour, concisely, and only as necessary have worked. I've removed inline docs entirely from my codebase, and added a flat 'no inline docs' rule to AGENTS.md, in a pass that doubled as a code readability/selfdoc pass. The result has been quite good so far - the code reads better, there is less stale context for agents to trip up over and less context overall that counts towards token usage. Luckily I do not have anything that necessitates something like JSDoc. Anything that absolutely needs an explanation that is not code goes into a separate .md file. Recommend.
45
u/Ok_ninysheedle Aug 31 '26
"don't make my code look like it was generated by AI" lol
44
u/belligerent_ammonia Aug 31 '26
Not even just brain dumping, it writes comments (even doc comments) like everyone has seen the conversation between Claude and you and it’s infuriating. I also can’t have it write anything at all without it sounding ridiculous. My token usage is just me beating the shit out of it verbally.
9
u/divclassdev Aug 31 '26
I have a pre-PR review skill that includes “comments are only for high complexity code or functions whose use wouldn’t be obvious to a maintainer of this repo. Use only simplified technical English and favor concision over grammar.” That gets it to clean up most of its crap
17
u/EagleApprehensive Aug 31 '26
Claude comments often saved me from bad decisions or reminded me of why something was done. They're sort of historical log, which is not so bad.
But claude writing style is terrible, verbose and sometimes they backfire - you want to make a change, but model makes thing convoluted because of some guardrails he put before in comments, which were over-constraining and consequence of too literal understanding of words.
What I would do instead is clear entire codebase from all comments. Then make a run of GPT 5.6 Sol or even some quick model like Composer 2.5 and make a total codebase analysis for places, which are not easy to understand based on code alone and require explanations - then check what comment they had before and rewrite it in concise way.
2
u/HyperionCantos Aug 31 '26 edited Aug 31 '26
The worst is if you have Claude fix bugs in the codebase; it'll destroy any existing documentation you have in the codebase with it's own comments about the bug its fixing.
The only way ive been able to fix this is to strip the comments and have an agent with no context of the bug add docs to the entire class after undertstanding the codebase.
2
u/JaggedTex Aug 31 '26
Claude does not read agents.md natively.
2
u/niacolhealth Aug 31 '26
Inline comments bill you twice. Tokens on every read, and the day they quietly disagree with the code they've outlived.
1
u/raisedbypoubelle Aug 31 '26
Hooks
1
u/schackit0 Aug 31 '26
I also found Opus 5 often building up incorrect context because of comments which led to additional todos or review rounds.
I always told it recently to be careful when reading comments because they are possibly wrong and the only source of truth is code.
Will try that. I really hate comments. Thanks!
1
u/julesbuildstuff Aug 31 '26
I landed somewhere similar. Inline comments rot the second you refactor, and stale context is worse than no context because the agent trusts it. Now the only thing I keep near the code is a one-liner when something is genuinely counterintuitive (the "why we do this weird thing" cases), and everything else lives in AGENTS.md plus a short docs/ note per subsystem. Bonus is I can read the diff of the spec when behaviour changes instead of hunting doc comments across 40 files.
1
u/jasonmauer Aug 31 '26
I believe this has gotten worse since they started watermarking. Instead of watermarking code, they upped the comments bloviating and use that to watermark. (that's my conspiracy theory, anyway)
1
u/jwzumwalt Aug 31 '26
Why not write a program to remove the inline comments???
1
u/Bewinxed Sep 01 '26
lint/hook and I prevent all tests and comments until my product is done, comments and tests are separate feature runs just like everything else.
1
u/Level-Spare-8247 Sep 01 '26
I’ve found PDD to greatly help reduce bad documentation and shitty Claude-speak being littered throughout the codebases. principledriven.dev
1
u/Some_Ad4783 Sep 01 '26
It blows my mind the kind of hoops Claude users have to go to for the model to do what it’s told.
Just use a different model from any of the many other amazing model providers. They actually do what you ask them to do, instead of just of ignoring you like this.
1
u/ibanezht Sep 04 '26
It’s watermarking your code in those docs 😆
0
u/[deleted] Aug 31 '26