Live data from Hacker News

Write code like a human will maintain it

unstack.io

321–325 of 325 posts

Re: Write code like a human will maintain it

#321

Wild idea: just write code. I know. It’s an unbelievable concept in this AI era. Write code ? Isn’t that what dinosaurs did? If you expect that a human will need to read and maintain that code you might as well write it for them. You’ll get annoyed by having to read overly-verbose copy-pasted code. So will they. So write the code yourself and bringo: you’ll fix things yourself and write things in a way that makes sen…

I think people have outdated ideas on AI code quality. Latest ones (i.e. ones after Claude Opus 4.8) are a game changer. They now write better code than a lot of engineers. They are also able to understand much larger overall context and make less mistakes then most engineers would make.

Difference between something like Opus 4.8 and even 4.5 is massive, not even talking about difference between Opus 4.8 and Sonnet or Composer.

What i see online is that a lot of people are using cheaper models, stuff like sonnet or cursor composer or even latest cursor grok. But they aren't the same thing as using the best models. The difference in quality and correctness is huge.

Re: Write code like a human will maintain it

#322

Write yourself a /review command. That is an empty markdown file at `.claude/commands/review.md`. In it, put a checklist of things the agent should look for. When you’re ready to have your agent review the code, type `/review`. The checklist will be examined and it’ll plan out some findings to ask you if you want them fixed. Mine starts with “Enter plan mode. Examine the differences on this branch vs. main. Consider:…

My experience is the more things you add to the list, the worse agents perform (I'm not exactly the first person to notice this) I actually have a pretty simple set of instructions right now and Claude still regularly messes them up. Like, my first instructions are: - Never commit to git without permission. - Never sign commit messages You know what it constantly does? Commits without permissions and signs commit mes…

My git commits are ssh key verified and the key is behind a TouchID gate. I've told agents that they shouldn't try committing because I need to be on the computer to activate Touch ID.

Every harness I've tried has obeyed that.

Re: Write code like a human will maintain it

#323

Earlier quoted context omitted.

Sometimes the fact you mentioned “signing commit messages” is exactly why it starts signing commit messages, and it’s better to start with no prompt at all. Negative prompting is very unreliable. Giving exact instructions on how you want commits made will give you better results.

How am I supposed to take this tool seriously if it struggles with the concept of "dont"? if what you're suggesting is true, then more important instructions like "Don't delete the production database" are a problem. I shouldn't need to consider how to phrase "Don't delete the production database" in a positive manner. Isn't the point of an AI agent that it understands my intent and I don't need to hold its hand? I'm…

> How am I supposed to take this tool seriously if it struggles with the concept of "dont"?

Don't think of a pink elephant in a tutu.

What did you just think about? =)

This has been true since the very first GPT release, any words you say to the model will nudge it towards that word - it doesn't matter if you have a negative in front of the word.

Form the guidance using positive words like "always use the development database at..." instead of "don't access the production database" ... Now it "knows" that the prod database exists and "thinks" about it when processing.

Re: Write code like a human will maintain it

#324
post #321

Wild idea: just write code. I know. It’s an unbelievable concept in this AI era. Write code ? Isn’t that what dinosaurs did? If you expect that a human will need to read and maintain that code you might as well write it for them. You’ll get annoyed by having to read overly-verbose copy-pasted code. So will they. So write the code yourself and bringo: you’ll fix things yourself and write things in a way that makes sen…

I think people have outdated ideas on AI code quality. Latest ones (i.e. ones after Claude Opus 4.8) are a game changer. They now write better code than a lot of engineers. They are also able to understand much larger overall context and make less mistakes then most engineers would make. Difference between something like Opus 4.8 and even 4.5 is massive, not even talking about difference between Opus 4.8 and Sonnet o…

I always have to ask people, correct with respect to what?

The reason being that most software developers aren’t very good at specifying systems precisely enough that they can confidently determine whether their program does what they think it does.

We don’t need to specify systems to the rigour of mathematical proofs every time, of course. The point is that spoken language isn’t precise enough to measure correctness against.

When you suggest that the difference in correctness is huge, I can’t really understand what you mean. Correct with respect to how you think good software should be written? Correct with respect to informal specifications written in prose? How?

I know that the frontier models have large contexts and can compress a lot more tokens from their training sets. But how does that make it able to read your mind and make formal what is ambiguous or informal?

Re: Write code like a human will maintain it

#325
post #129

Earlier quoted context omitted.

This is what has been frustrating me most lately. Even though I have a rule in my global CLAUDE.md that says: > Only write comments to explain the why when it is not obvious from the code (rationale, gotchas, constraints). Do not comment on the what — well-named code already says it. Do not comment on how a framework works. It still keeps adding these bad comments. When I then ask it to review the comments based on m…

In Claude Code there are also "output styles" that are more deeply embedded - into a system prompt - and agent is also periodically reminded of them during the session: https://code.claude.com/docs/en/output-styles Maybe these would work better for such cases.

[flagged]
Post reply on HN