It has long been an idiom in programming that comments should explain why, not how. This is one of the remaining things that Claude will consistently get wrong. Failures can be grouped into categories:

Describing what the code does, not why

So common as to be a parody of itself, a comment on a threading implementation might have something like “// run the action inside the lock”. Sometimes this can be sensible if the code is complex or obscure, but even then most programmers would create a method named according to what it does and use that as the documentation.

Similar behaviour occurs in tests, where the test will test the current implementation instead of the desired behaviour.

Being extremely verbose

Instead of noting that some code creates an array of actions, it will say it creates an array of unique, isolated actions. The extra words don’t add any value but do contribute to the Claude cadence.

Referencing previous ideas tried and abandoned

Sometimes this is a good move in the “architectural strategy” sense: normally you would think we would do X, we do Y instead for reason Z. Claude will instead reference things it tried that session and decided against, often without any reasoning.

Referencing other parts of the codebase

Often seen with “what, not why”, these comments are also in completely the wrong place (that is, instead of being next to the code they refer to, they’re on e.g. a function called (or that calls) that code).

Sometimes this can be kind of reasonable on a class describing how it works with the wider codebase, but even this often descibes the implementation at the time Claude first wrote it instead of how it’s designed to work. Later code changes will make the comment outdated.

Referencing history

If asked to change X to Y, Claude may add a comment saying that the code used to work like X, but was changed. This isn’t useful for future readers, and is available in the git history if desired.

Not understanding that comments are positional

Some languages have special comments called “docstrings” (e.g. """ in Python or /** */ in Java) which describe the workings of the function immediately below. Claude, if asked to transfer a series of functions into a new file, might transfer docstring A, function A, and docstring B, leaving function B alone in the old place.

This is reasonable in general comments because sometimes programmers will put comments at the end of files, but shows a lack of semantic understanding for docstrings. And more generally a lack of understanding that what the comment describes refers to the nearby code.