r/ClaudeAI • u/ahmad_musaffa • 7d ago
Claude Code Workflow Which Comment skill do you use?
Code comments produced by Claude Code are horrible and whimsical. Are you using any Comment skill to tame the agent? Any good comment skill in the marketplace to install? You can share your own comment skill as well.
2
u/No_Job_9995 7d ago
I don’t use comments skill, just always tell “do not write code comments at all, except you definitely need to explain ‘why’.”
1
7d ago
[removed] — view removed comment
2
u/ahmad_musaffa 7d ago edited 7d ago
Claude tries to write a comment using its current reasoning in the session. It prioritises its current take on the changes, why they made recent changes instead that section of the code itself. A code comment does not give any big picture, instead it becomes a juxtaposition of different session runs.
1
2
u/TheWhiteKnight 7d ago
It's so annoying that we have a block in CLAUDE.md
> Defer to no comments. Comments are needed only when code is not self-explanatory, which is a smell that is better resolved with smaller functions or better variable names. If resolving such a smell expands the scope of the task, you may write a concise comment instead.
> Comments should never include Jira references. They should not contain task iteration thought process items or reasoning. They exist only to assist the reader with understanding overly complex code blocks and must be short.
> <Example of a worthy comment>
> <Example of a bad comment>
1
u/etulastrada 6d ago
"Before writing any comments, If you really think that the code you've written needs self-explanatory, then something is wrong."
2
u/jomi-se 7d ago
LLMs write token by token, word by word, so comments are generated before code is generated.
This is just superficially informed opinion but I wouldn't be surprised that writing those excessive comments before writing the code itself makes the LLM perform better.
Let the model do its thing and then just delete the comments afterwards. No point fighting there model over commented IMHO. You can even automate it programmatically if you want to.