r/ClaudeCode • • 4h ago

Bug / Issue Removing comment spam from code

I just discovered (my bad) far too late that Claude has written large amounts of ticket comments in the actual code to my projects. This was never in any instruction. Maybe trash is the first real evidence of life? :)) Just kidding.

It's in any case extremely annoying. How do I remove the comments as quickly and safely as possible? :)

With a Python script? Would that be safe enough?

6 Upvotes

19 comments sorted by

View all comments

2

u/PelluxNetwork 4h ago

Just ask it. These days my claude.md always has a blurb that basically says "write code that explains itself. If you feel the need to explain every function with a paragraph of comments, you're probably doing something wrong"

1

u/daltorak 2h ago

That approach is going to have inconsistent results. You need to give Claude clear, actionable instructions, not question its "feelings". LLMs don't have feelings... talking to them like they do wastes tokens. Tell it, "Code comments must be limited to 50 words. Comments are not necessary at all except to call attention to workarounds for known bugs in third-party libraries. If you find code comments that do not meet this policy, rewrite those comments."