frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Ask HN: Why so many [dead] replies?

3•cyanclouds•13m ago•2 comments

Tell HN: Our paid Claude AI subscription unavailable >1 week and no support

30•KellyCriterion•4h ago•9 comments

Can anti-fraud make large-scale attacks unprofitable?

3•jezzwar•1h ago•1 comments

Why I prefer Opus 5 to Fable 5

5•novlrdotcom•1h ago•1 comments

Ask HN: How to rewrite `Claude.md` and install the skill for Opus5 and Fable5

5•hyhmrright•6h ago•5 comments

BMWs shows in-car ads for Spiderman

32•bigmattystyles•18h ago•14 comments

Internet is no longer accessible?

36•cute_boi•10h ago•21 comments

Ask HN: How to deal with security implications of running/installing projects?

12•johng•15h ago•10 comments

Claude's code comments – too much or just enough?

8•lalaleslieeeee•9h ago•5 comments

Ask HN: What apps are you building?

12•totaldude87•10h ago•15 comments

Goodbye POSIX, Hello Tea Room: Inside MinervaOS Architecture

10•xentnex•21h ago•6 comments

Ask HN: Why is every company encorporating AI everywhere?

24•vanessa1211•1d ago•38 comments

Ask HN: What are the most promising RL fields for a new master student?

34•zecice•1d ago•14 comments

Messaging platform I can self-host for my agents to communicate

2•giribisthebest•14h ago•3 comments

Claude Code getting "API Error: 529 Overloaded"

5•croemer•1d ago•2 comments

Ask HN: Any New Computer Ideas?

8•robalni•1d ago•13 comments

Ask HN: How do you figure out what you're passionate about?

10•charliebwrites•1d ago•20 comments

Ask HN: What livestream do you keep open in a tab?

53•missmoss•2d ago•18 comments

Tell HN: Namecheap gave my account to an unverified third party

495•Thrashed•4d ago•177 comments

Opus Cost = Minimum Wage in South Africa

4•bridgettegraham•1d ago•2 comments

Ask HN: Where do those LLM-generated outreach emails come from?

4•nicbou•1d ago•2 comments

Ask HN: Protecting your Sites/Services from Unwanted Traffic?

12•prologic•2d ago•10 comments

Ask HN: Does the tech industry require deterministic ML training?

4•Swapnopam•1d ago•0 comments

CstWeave – On-device, privacy-first Chrome extension for tab region GIFs

2•fujidevv•1d ago•0 comments

Robotic Adaptation Suffers from Data Collection Bottleneck

3•aunmesh•1d ago•0 comments

Ask HN: Which Jabber clients support SCRAM+ and XEP-0474

12•Bender•2d ago•0 comments

You've reached the end!

Open in hackernews

Claude's code comments – too much or just enough?

8•lalaleslieeeee•9h ago
Has anyone else noticed that Claude leaves a lot of large code comments sprinkled throughout its work?

Some of my meat-based engineers have taken issue with it and directed Claude to never leave comments unless strictly necessary, but I want to know what others think. Personally, I write and read a lot of code comments so I’m confused about why these specific comments are so offensive to my fellow engineers.

I have two questions: 1. Why does it do this? 2. Do you have feelings about it?

Is the agent leaving breadcrumbs for other agents? Do they improve the output of future agent-driven code or is it just a stylistic choice?

I don’t want to devolve into a discussion about the purpose of code comments at-large. Instead I’m wondering if there’s a purpose behind the specific comments that agents leave

Comments

carlostkd•9h ago
Well, a good programmer doesn't leave code comments in production code.

This is basic from school.

Why not?

Two reasons: First, you are telling an attacker, "Look, my code works like that, and this function does that, etc., etc." Without comments, let the attacker read and try to understand everything alone, if he can.

Secondly, it's easy to copy totally or partially, you spent hours coding and anyone can say "Oh look a nice function; it's what I was looking for."

The normal behavior should be keep comments for yourself in a development code copy delete all comments for production.

ventana•8h ago
Too much for sure, and often ignores instructions to not leave obvious comments.
gojkoa•6h ago
there's a difference between comments above code (documenting the purpose of a class/function...) and comments inside code (documenting the implementation or design).

I treat comments inside code as smells. They exist sometimes because the author wanted to say something else but was prevented from doing it because of existing conventions, sometimes because a piece of code is difficult to understand, sometimes because a large piece of code has multiple responsibilities. For things like that, I tend to clean up the code to make the design more intention revealing and break large pieces of code into smaller pieces with appropriate names. I tend to document behaviour using unit tests (where the unit test has the name that would be in the comment). This was a rule before claude code, and it still is for us.

In general, this leads to better code, that's easier to understand, manage and maintain. It also leads to functional decomposition that's easier to test than a large blob, so fewer bugs.

We have linting rules preventing claude from leaving comments inside code, and forcing it to apply these refactorings. The one to write tests to document behaviour instead of just commenting it is especially useful as there's proof that the code is actually doing what the comment suggested, and ongoing checks that it still does that. a comment may become stale easily without you noticing.

as for the reason why claude is doing it, my best guess is training material included lots of comments.

ctkqiang96•5h ago
If without the exccessive code comments and emojis how would Anthropic earn those money from you? more code and commnets meaning more token usage. So........
DrOctagon•5h ago
I have something to the effect of ‘no narrative comments’ in my Claude.md that mostly sorts this out