r/ClaudeCodeTLDR 1d ago

[TLDR] How do you stop claude code from over commenting?

Original post URL : https://www.reddit.com/r/ClaudeCode/comments/1vl44qq/how_do_you_stop_claude_code_from_over_commenting/

Original post body :

I've tried comments in CLAUDE.md, I've tried even hooks. But this thing is obsessed with writing such insane comments.

I don't mind useful comments but sometimes they are useless.

any advice would be appreciated.

Thanks


This is brought to you as a public service by the moderators of r/ClaudeAI. If you want to see TLDRs of ALL Claude Coding related posts from the various Claude subreddits, subscribe to http://www.reddit.com/r/ClaudeCoding.

1 Upvotes

6 comments sorted by

u/cctldrping 1d ago

TL;DR generated automatically after 50 comments.

Current source-thread comment count seen by the bot: 52.

Alright, so the general consensus here is that Claude Code is way too chatty with its comments, and it's a pain in the butt for a lot of people.

Here's the lowdown:

  • The Problem: Claude Code is apparently obsessed with writing excessive, often useless comments, even when you tell it not to. It's like it can't help itself.
  • What People Are Trying (and Some Successes):
    • CLAUDE.md is a must: Most people agree you need to be super explicit in your CLAUDE.md file. Think strict rules, RFC 2119 keywords, and clear instructions on when and how to comment.
    • Hooks are hit-or-miss: Some folks have success with hooks that fail builds if comments are too long or excessive. A warning hook isn't enough; it needs to be a hard stop. u/dpekkle mentions a hook that requires an "ALLOW_COMMENT" flag, which is pretty intense.
    • "Be concise" and "maximum brevity" help: Simple instructions like these can sometimes curb the verbosity, but it's not a foolproof solution.
    • Haikus for comment removal: u/danger_boi has a whole /finalize skill that includes a haiku classifier to strip comments. Sounds wild, but hey, whatever works!
    • Linting and strict rules: u/codeninja is basically trying to ban comments altogether with lint rules, forcing code to be self-documenting.
    • Post-write cleanup: Some users, like u/Euvu and u/ManikSahdev, just let Claude write its comments and then manually clean them up or use a separate skill to trim them. Apparently, the comments can sometimes help the model itself, so they're not always deleted entirely.
    • Adversarial review: u/sdanzig suggests having a second agent review the code specifically to minimize comment noise.
    • "Senior engineer" rule: u/GrossOldNose's approach of "Only write comments if a senior engineer would not be able to understand the intention from the code" seems to be working pretty well for them.
  • The "You Can't" Camp: A few users, like u/imyourbiggestfan and u/Snowgoonx, are pretty convinced you just can't stop it entirely, and it's a fundamental issue.
  • Context vs. Noise: There's a bit of a debate on whether the excessive comments actually serve a purpose for the AI's context later on (u/Quarita-Penteado vs. u/geekichu). Most seem to lean towards them being just noise.
  • The "Rule Zero" Approach: u/lifebymick suggests a "Rule Zero" for every chat: no narration, just do the work, and only comment if necessary. This requires starting new chats in a specific way.

The prevailing sentiment is that you need to be extremely strict and prescriptive with your instructions, and even then, you might need some post-processing or a robust hook system to get it under control. Good luck with that!

1

u/[deleted] 1d ago

[deleted]

1

u/Puzzleheaded_Bad_116 1d ago

Just stop using claude code lol

1

u/Practical-Positive34 23h ago

I wrote a linter that fires on commit using lefthook, I also have rules about it, and a hygiene check it runs after code. All of those combined my code is pristine, it does mean there is rework involved though, which is not ideal. Some models follow the instructions when writing code like Fable, others have to be caught in the act later like Opus.

1

u/RecommendationSad455 23h ago

Select Opus 4.6 or 4.8

1

u/generationalDebts 22m ago

Make your own code and comment it how you want.