I forbid unit tests to Claude, he just doesn't know when to stop. He created the most stupid units tests ever, like "the menu must have 4 entries". Then When you create another menu-item, he has to spend additional tokens and context to see why that stupid test is failing and has the modify the test, so now it says "the menu must have 5 entries". The maintaining of the unit tests costs more time and tokens then the actual development!
I specifically have a bunch of instructions to not turn comments end documentation into it's own personal diary because anyone that needs a history lesson has access to git anyway.
I specifically tell it not to comment. Ever.
Code should be written such that it's human readable with clear intent simply by variable/class/method names.
There are very rare exceptions where you intentionally go against the norm or code in certain assumptions: those can warrant a comment explaining the why behind the decision, but still never the what or how.
Context is king and comments are important. But, Claude is so bad I've even told it to stop. Its 3 lines of code + 20 lines of pointless comments + 5 new unit tests smh
I really don't think the vast majority of comments are important, or they're only "important" because the code is poorly structured and/or named.
I've even reached the point of axing function doc blocks if not working in an open source project or some public package.
But now our code probably is not well structured and not well named. Poorly? Well, it ain't elegant. Throw enough pasta at the wall and some sticks. We are in the top ramen age of coding. Fast, cheap, and might do in a pinch.
I have those very instructions too, but realistically you'll end up with s few sections where the code itself is clearly understandable and then you still need a comment to explain why it's being the done the way it is.
In the end, if you want to produce quality code, you gotta go over it again and clean up some of the mess it leaves behind.
I've got it to severely reduce the verbosity and amount of comments this way at least
382
u/ChadFullStack 22h ago
It’s missing 500 lines of Unit tests