frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Ask HN: What's your secret weapon for keeping code/docs/tests from rotting?

3•bochoh•1d ago
I've been using cursor lately to handle some (most) of the grunt work and it's been surprisingly useful for two things: keeping documentation from going stale and spotting gaps in test coverage. For example, I'll ask it things like "what's the most likely way this function could break?" and it will suggest edge cases I hadn't thought of.

That said, it's not (maybe?) magic and sometimes hallucinates test cases that are rubbish so some critical thinking is still required.

I'm curious what y'all are using to keep docs/tests maintainable? Are you leaning on AI or doing it the old fashioned way?

Comments

sunscream89•23h ago
You make the most junior member of your team take notes or revise them as they are directed to deal with each issue (like final step in closing the ticket.)

I know, I know, “everyone should do it.” Everyone is not going to do it, everyone left it undone the last times.

Works best when someone is trying to impress, or is told to do it in some essential capacity.

And there is also the setting of a good example.

speedgoose•22h ago
I don’t write documentation about code. I do for the architecture and the APIs, but the code is self documented.
moomoo11•19h ago
If you follow basic things like single responsibility principle and layers you don’t need code documentation.

The tests can be a useful guide on how the code is supposed to work. But let’s be honest most test suites become wack any time you work on really big or complex projects.

I think the best thing you can do is optimize for that. Write code in a clean way, and organize tests in a way that can quickly convey high level functionality to maintainers.

If you find yourself writing tests that are doing too much or need to add documentation to code, you’re probably doing other things wrong too. (Not you btw just saying in general)

AnimalMuppet•18h ago
> If you follow basic things like single responsibility principle and layers you don’t need code documentation.

Yes, write the code so cleanly, and with such good names, that you don't need documentation. Absolutely.

But the code is never quite clean enough, and the names are never clear enough, and the people coming later don't know everything that you know. So write documentation anyway. And not just "sling something out there" - write the best documentation you can; write it as well as you write the code.

(No, I don't do as I say. But it's the right thing to do...)

I launched 17 side projects. Result? I'm rich in expired domains

82•cesargstn•2h ago•55 comments

Google Maps Reviews in Germany Are Basically Dead

7•tahaygun•49m ago•2 comments

Ask HN: Is university still credible?

11•mettamage•4h ago•17 comments

Claude Code weekly rate limits

590•thebestmoshe•1d ago•693 comments

Tell HN: Add "NSFW" words in your Google query to avoid AI summary

20•behnamoh•19h ago•18 comments

Ask HN: What are you working on? (July 2025)

252•david927•2d ago•834 comments

Ask HN: How will the OSA affect small Mastodon instances?

27•Digit-Al•1d ago•15 comments

Ask HN: Whats your best workflows to draft legal agreements without lawyers?

6•philippb•16h ago•11 comments

Ask HN: Why is "Tea" still on the App Store after so many data breaches?

79•benguild•3h ago•58 comments

Ask HN: With AI written resumes, what are the new hiring signals?

3•plentysun•12h ago•4 comments

Ask HN: What is the reason Chinese AI labs are opensourcing everything

2•awaisraad•1h ago•4 comments

Ask HN: Should I Leave Software?

7•apatheticonion•14h ago•10 comments

Ask HN: How many of you are working in tech without a STEM degree?

52•zebproj•1w ago•81 comments

Warp.dev Terminal – Overpriced, Buggy, and AI-Sabotaged My Code

55•MistermanX•2d ago•38 comments

Drafting Software Recommendation

16•morpheos137•5d ago•16 comments

Tell HN: macOS Time Machine will no longer support Time Capsules

15•nodesocket•16h ago•7 comments

An app that schedules your most important tasks around your peak energy levels

6•rashempandit48•21h ago•11 comments

Ask HN: What's your secret weapon for keeping code/docs/tests from rotting?

3•bochoh•1d ago•4 comments

How do I get a paid internship as a 16yo developer?

10•uint23•1d ago•20 comments

Have We Stopped Inventing Futures Worth Predicting?

7•squarekernels•1d ago•4 comments

My Theory: Advertising is a lot like capitalism itself

9•cm2012•1d ago•15 comments

Ask HN: How do you handle audit logs in your systems?

17•efeoge•2d ago•8 comments

Ask HN: Why do Cursor, Windsurf and Claude Code dominate the conversation?

28•bluelightning2k•1w ago•38 comments

Ask HN: Will I get left behind if I don't jump on AI train?

23•LLcolD•3d ago•32 comments