Hacker News new | ask | show | jobs
by robben1234 401 days ago
I work with python codebases and consider comments that answer "what?" instead of "why?" bad.

LLMs tend to write comments answering "what?", sometimes to a silly extent. What I found helping for using Claude 3.7 was to add this rule in cursor. The fake xml tag helped to decrease the number of times it strays from my instructions.

<mandatory_code_instruction>

YOU ARE FORBIDDEN FROM ADDING ANY COMMENTS OR DOCSTRINGS. The only code accepted will be self-documenting code.

</mandatory_code_instruction>

If there's a section of code where a comment answering "why?" is needed this rule doesn't seem to interfere when I explicitly ask it to add it there.