Live data from Hacker News

How to effectively write quality code with AI

heidenstedt.org

301–310 of 321 posts

Re: How to effectively write quality code with AI

#301
post #284

Spec-driven development is the only reliable way to work with AI. That's my current understanding. I spend more time refining the spec and bouncing ideas off of AI/team than before, which is good before there can't be any incorrect assumptions or hidden variables, otherwise AI will create suboptimal code. We should have been doing this much earlier in the process, even without AI, but now it's more necessary than eve…

Sentiments like this make me wonder if perhaps the dream of the 90s was just ahead of its time. Things like UML, 4GLs, Rational were all being hyped. We were told that the future was a world where people could express the requirements & shape of the system, and the machines would do the rest. Clearly that didn't happen, and then agile took over from the more waterfall/specs based approaches, and the rest was history.…

Worked a lot with UML in industry and academia.

I think PG said something about sitting down and hacking being how you understand the problem, and it’s right. You can write UML after you’ve got your head round it, but the feedback loop when hacking is essential.

Re: How to effectively write quality code with AI

#302
post #90

The first rule is an antipattern. I think describing your architecture or ANY kind of documentation for your AI is an anti-pattern and blows the context window leading to worse results, and actual more deviation. The controlling systems are not give it more words at the start. Agentic coding needs to work in loop with dedicated context. You need to think about how can i give as much intent as possible with as little…

> repo will always win over documentation it really does seem like this... also new devs are like that too: "i just copied this pattern use over here and there whats wrong?" is something i've heard over and over lol i think languages that allow expression of "this is deprecated, use x instead" will be usefull for that too

I’ve written about that a bit here https://jw.hn/dark-software-fabric

AI gets a lot of big projects right if you give at all the tools to verify its own implementation if you can build a proper system to verify the solution it works astonishly good. Even Opus 4.6 judgement seems to be wrong most of the time on projects of my scale pre the validation layers.

Re: How to effectively write quality code with AI

#304
post #253

Earlier quoted context omitted.

Strange since, in practice, coding models have steadily improved without any backward movement every 3-4 months for 2 years now. It's as if there are rigorous methods of filtering and curation applied when building your training data.

> Strange since, in practice, coding models have steadily improved without any backward movement every 3-4 months for 2 years now. It's as if there are rigorous methods of filtering and curation applied when building your training data. It's as if what I wrote implies "all other things being equal", just like any technical claim. All other things were not equal: the architectures were tweaked, the human data set is s…

1. No, you dont get to fall back on the technical claim approach. Your bias in your phrasing was clear. Maybe that works for you but I won't just ignore obvious subtext and let you weasel out of this. And that's for the benefit of other readers, not you.

2. A plateau in coding performance? I don't think you even use these models for coding then if you make that claim. It is very clear models have continually improved. You can trust benchmarks to make that clear, or real world use, or better yet: both. You seem to not have the data from either.

3. No rigorous methods of filtering and curation that can separate AI slop from useful human output? Here you go:

a. Curation already works at scale. Modern training pipelines don’t rely on “AI vs human” detection. They filter by utility signals: correctness, novelty, coherence, task success, citation integrity, and cross-source consistency. These measurable properties do correlate with downstream model performance. Models trained on smaller, higher-quality corpora consistently outperform those trained on larger, noisier ones.

b. Human-generated “valuable” data is not shrinking. The claim assumes a fixed pool. In reality, high-value human data is expanding in areas that matter most: expert-labeled datasets, preference comparisons, multimodal demonstrations, tool-use traces, verified code with tests, and domain-expert feedback. These are explicitly created for training and are not polluted by passive AI spam.

c. Synthetic data is not a dead end—when constrained. Empirically, filtered and goal-conditioned synthetic data (self-play, distillation, adversarial generation) improves reasoning, math, coding, and tool use. The failure mode is unfiltered synthetic recursion—not synthetic data per se. This distinction is already operationalized in production systems.

d. Training value ≠ raw text volume. Scaling laws shifted: performance now tracks effective compute × data quality, not sheer token count. A smaller dataset with higher signal density produces better generalization than a massive, contaminated corpus. This is observed repeatedly in ablation studies.

----

Again, the above is not for you, as I believe you don't see beyond your cope (yet). It's for other readers who are intellectually curious.

Re: How to effectively write quality code with AI

#305
Ah yes, to have AI write code for you, you simply just need to, let's see ..

"Document the requirements, specifications, constraints, and architecture of your project in detail. Document your coding standards, best practices, and design patterns. Use flowcharts, UML diagrams, and other visual aids to communicate complex structures and workflows. Write pseudocode for complex algorithms and logic to guide the AI. Develop efficient debug systems for the AI to use. Build a system that collects logs from all nodes in a distributed system and provides abstracted information. Use a system that allows you to mark how thoroughly each function has been reviewed. Write property based high level specification tests yourself. Use strict linting and formatting rules to ensure code quality and consistency. Utilize path specific coding agent prompts. Provide as much high level information as practical, such as coding standards, best practices, design patterns, and specific requirements for the project. Identify and mark functions that have a high security risk, such as authentication, authorization, and data handling. Make sure that the AI is instructed to change the review state of these functions as soon as it changes a single character in the function. Developers must make sure that the status of these functions is always correct. Explore different solutions to a problem with experiments and prototypes with minimal specifications. Break down complex tasks into smaller, manageable tasks for the AI. You have to check each component or module for its adherence to the specifications and requirements."

And just like that, easy peasy, nothing to it.

As a supreme irony, the story currently on the front page directly under this one ('You are here'), makes the claim "The cost of turning written business logic into code has dropped to zero. Or, at best, near-zero." in the very first sentence.

Re: How to effectively write quality code with AI

#306

Earlier quoted context omitted.

Why is it so hard to find examples?

You’re asking to see my company’s code base? It’s not like with AI we’re making miraculous things you’ve never seen before. We’re shipping the same kinda stuff just much faster. I don’t know what you’re looking for. Code is code it’s just more and more being written by AI.

Do you find reading hard? I'm asking for examples. Why isn't anyone showing this off in blog posts. Or a youtube video or something. It's always this vague, it's faster, just trust me bro bullshit and I'm sick of it. Show me or don't reply.

Re: How to effectively write quality code with AI

#307
post #116

The best thing about this is that AI bots will read, train on and digest the million "how to write with AI" posts that are being written right now by some of the smartest coders in the world and the next gen AI will incorporate all of this, making them ironically unnecessary.

> AI bots will read, train on and digest the million "how to write with AI" posts that are being written right now Yes! > by some of the smartest coders in the world Hmm... How will it filter out those by the dumbest coders in the world? Including those by parrots?

>Hmm... How will it filter out those by the dumbest coders in the world?

if you know, and I know, and the guys at openai and anthropic know... not a big leap that the models will know too? many datasets are curated and labeled by humans

Re: How to effectively write quality code with AI

#309
post #307

Earlier quoted context omitted.

> AI bots will read, train on and digest the million "how to write with AI" posts that are being written right now Yes! > by some of the smartest coders in the world Hmm... How will it filter out those by the dumbest coders in the world? Including those by parrots?

>Hmm... How will it filter out those by the dumbest coders in the world? if you know, and I know, and the guys at openai and anthropic know... not a big leap that the models will know too? many datasets are curated and labeled by humans

> if you know, and I know,

We don't know.

> and the guys at openai and anthropic know... not a big leap that the models will know too?

The models don't "know" anything. They just regurgitate what they are fed.

"Child abuse images found in AI training data"

https://www.axios.com/2023/12/20/ai-training-data-child-abus...

> many datasets are curated and labeled by humans

Including these ones: "AI industry insiders launch site to poison the data that feeds them"

https://www.theregister.com/2026/01/11/industry_insiders_see...

Re: How to effectively write quality code with AI

#310
post #307

Earlier quoted context omitted.

>Hmm... How will it filter out those by the dumbest coders in the world? if you know, and I know, and the guys at openai and anthropic know... not a big leap that the models will know too? many datasets are curated and labeled by humans

> if you know, and I know, We don't know. > and the guys at openai and anthropic know... not a big leap that the models will know too? The models don't "know" anything. They just regurgitate what they are fed. "Child abuse images found in AI training data" https://www.axios.com/2023/12/20/ai-training-data-child-abus... > many datasets are curated and labeled by humans Including these ones: "AI industry insiders launc…

I mean, having a curated dataset of the works and posts of the top 200 coders in the world (at least the public ones) is not very difficult. I’m sure these articles like the one in OP will be very easy to mark as “high value training data”. I think you’re letting your bias blind you
Post reply on HN