Ask HN: How do you make the LLM generate good code?
5 comments
Step one is to get out of the ChatGPT web interface. OpenCode is a much better harness
Step 2, have it write a plan in a file, then iterate on that plan
Download dependency source code and API specs for it to reference
Be specific, you wanted it to use a specific API but then said "use any API like .."
Don't expect a single session to get you there, use many and keep them fresh (the design/plan/status files help)
Read Anthropic knowledge share, it is currently the best and applies in generality
We don't use "LLMs" to generate code, we use "agent harnesses" and "context engineering". Good phrases to start your knowledge deepening
Give your agent good tools and context, then iterate
Step 2, have it write a plan in a file, then iterate on that plan
Download dependency source code and API specs for it to reference
Be specific, you wanted it to use a specific API but then said "use any API like .."
Don't expect a single session to get you there, use many and keep them fresh (the design/plan/status files help)
Read Anthropic knowledge share, it is currently the best and applies in generality
We don't use "LLMs" to generate code, we use "agent harnesses" and "context engineering". Good phrases to start your knowledge deepening
Give your agent good tools and context, then iterate
I'm glad you asked this. I had a small project on the weekend to build a persistence of vision toy and thought I'd give this "vibecoding" thing a try and work with an LLM.
I learned quite a lot in the process, mostly that I need to think in tiny systems. I was expecting I could feed the hardware environment into the LLM and prompt for an output. I was not expecting that I need to instruct the LLM to deliver code that was human-edit/readable.
I'm appreciating the advice in the comments to this post.
I learned quite a lot in the process, mostly that I need to think in tiny systems. I was expecting I could feed the hardware environment into the LLM and prompt for an output. I was not expecting that I need to instruct the LLM to deliver code that was human-edit/readable.
I'm appreciating the advice in the comments to this post.
I have a ~200 line file of style rules that I copy and paste between all my projects(There's got to be a better way to manage files like that!) but I can never quite tell if it's helping anything....
I usually prompt with very specific architectures, defining classes, functions, and JSON schemas, plus what libraries I want to use, and that seems to work, most of the time.
I generally use AiderDesk with MiniMax M2.5
I usually prompt with very specific architectures, defining classes, functions, and JSON schemas, plus what libraries I want to use, and that seems to work, most of the time.
I generally use AiderDesk with MiniMax M2.5
I have very much enjoyed GSD as a framework within claude code
https://github.com/open-gsd/gsd-core
I can code this function quickly using the MusicBrainz API and I believe most other HN readers can too. Yet many hours later, no matter how I prompt the bot I can't get it to do it. This is what ChatGPT generates---other bots reply with similar garbage:
https://chatgpt.com/share/6a396ea9-44d4-83eb-bdfd-216dfcc87e99
They complain about how the problem is ambiguous (is not) or how MusicBrainz doesn't have the data (it does). Am I prompting the bot incorrectly or not using powerful enough coding models? The results are very underwhelming.