7 ms·
Anecdote time! I had Codex GPT 5.4 xhigh generate a Rust proc macro. It's pretty straightforward: use sqlparser to parse a SQL statement and extract the column
by cornstalks 7mo ago
Anecdote time! I had Codex GPT 5.4 xhigh generate a Rust proc macro. It's pretty straightforward: use sqlparser to parse a SQL statement and extract the column names of any row-producing queries.
It generated an implementation that worked well, but I hated the ~480 lines of code. The structure and flow was just... weird. It was hard to follow and I was seriously bugged by it.
So I asked it to reimplement it with some simplifications I gave it. It dutifully executed, producing a result >600 lines long. The flow was simpler and easier to follow, but still seemed excessive for the task at hand.
So I rolled up my sleeves and started deleting code and making changes manually. A little bit later, I had it down to <230 lines with a flow that was extremely easy to read and understand.
So yeah, I can totally see many SWE-bench-passing PRs being functionally correct but still terrible code that I would not accept.
- SerCe 7mo agoIf you've got some time, I highly recommend going through the exercise of trying to change the prompt in a way that would produce code similar to what you've achieved manually. Doing a similar exercise really helps to improve agent prompting skills, as it shows how changing parts of the prompt influences the result.
- foltik 7mo agoI haven’t had any luck prompting LLMs to “have taste.” They seem to over fixate on instructions (e.g. golfing when asked for concise code) or require specifying so many details and qualifications that the results no longer generalize well to other problems. Do you have any examples or resources that worked well for you?
- zarzavat 7mo agoYeah prompting doesn't work for this problem because the entire point of an LLM is you give it the what and it outputs the how. The more how that you have to condition it with in the prompt, the less profitable the interaction will be. A few hints is OK, but doing all the work for the LLM tends to lead to negative productivity. Writing prompts and writing code takes about the same amount of time, for the same amount of text, plus there's the extra time that the LLM takes to accomplish the task, and review time afterwards. So you might as well just write the code yourself if you have to specify every tiny implementation detail in the prompt.
- kqr 7mo agoMakes me think of this commitstrip comic: https://i.xkqr.org/itscalledcode.jpg https://i.xkqr.org/itscalledcode.jpg (mirrored from the original due to TLS issues with the original domain.) A guy with a mug comes up to a person standing with their laptop on a small table. The mug guy says, "Some day we won't even need coders any more. We'll be able to just write the specification and the program will write itself." Guy with laptop looks up. "Oh, wow, you're right! We'll be able to write a comprehensive and precise spec and bam, we won't need programmers any more!" Guy with mug takes a sip. "Exactly!" Guy with laptop says, "And do you know the industry term for a project specification that is comprehensive and precise enough to generate a program?" "Uh... no..." "Code. It's called code."
- datastoat 7mo agoGoodhart's Law of Specification: When a spec reaches a state where it's comprehensive and precise enough to generate code, it has fallen out of alignment with the original intent. Of course there are some systems where correctness is vital, and for those I'd like a precise spec and proof of correctness. But I think there's a huge bulk of code where formal specification impedes what should be a process of learning and adapting.
- keybored 7mo agoMy dream antiprogram is a specification compiler that interprets any natural language and compiles it to a strict specification. But on any possible ambiguity it gives an error. ? This terse error was found to be necessary as to not overwhelm the user with pages and pages of decision trees enumerating the ambiguities.
- newswasboring 7mo agoOpenspec does this. But instead of "?" it has a separate Open Questions section in the design document. In codex cli, if you first go in plan mode it will ask you open questions before it proceeds with the rest. The UX is there, for small things it does work for me, but there is still something left for LLMs to truly capture major issues.
- SerCe 7mo ago> Do you have any examples or resources that worked well for you? Using this particular example, if you simply paste the exact code into the prompt, the model should able to reproduce it. Now, you can start removing the bits and see how much you can remove from the prompt, e.g. simplify it to pseudocode, etc. Then you can push it further and try to switch from the pseudocode to the architecture, etc. That way, you'll start from something that's working and work backwards rather than trying to get there in the absence of a clear path.
- tobr 7mo agoThat’s an interesting approach, but what do you learn from it that is applicable to the next task? Do you find that this eventually boils down to heuristics that generalize to any task? It sounds like it would only work because you already put a lot of effort into understanding the constraints of the specific problem in detail.
- johndough 7mo agoWhat worked for me was Gemini 3 Pro (I guess 3.1 should work even better now) with the prompt "This code is unnecessarily complicated. Simplify it, but no code golf". This decreased code size by about 60 %. It still did a bit of code-golfing, but it was manageable. It is important to start a new chat so the model is not stuck in its previous mindset, and it is beneficial to have tests to verify that the simplified code still works as it did before. Telling the model to generate concise code did not work for me, because LLMs do not know beforehand what they are going to write, so they are rarely able to refactor existing code to break out common functionality into reusable functions. We might get there eventually. Thinking models are a bit better at it. But we are not quite there yet.
- catlifeonmars 7mo agoI wonder if it helps at all to first tell the agent to write the APIs/function signatures, then second tell the agent to implement them.
- brap 7mo agoI actually don’t think golfing is such a bad thing, granted it will first handle the low hanging fruits like variable names etc, but if you push it hard enough it will be forced to think of a simpler approach. Then you can take a step back and tell it to fix the variable names, formatting etc. With the caveat that a smaller AST doesn’t necessarily mean simpler code, but it’s a decent heuristic.
- newswasboring 7mo agoI have a stupid solution for this which is working wonders. It does not help to tell the LLM "don't do this pattern". I literally make it write a regex based test which looks for that pattern and fails the test. For example I am developing a game using GDscript, LLMs (including codex and claude) keep making scripts with no classnames and then loading them with @preload. Hate this, and its explicitly mentioned in my godot-development skill. What agents can't stand is a failing test. Feels a bit like enforcing rules automatically. This is a stupid idea but it works wonders on giving taste to my LLM. I wonder if I should open source that test suite for other agentic developers.
- stared 7mo agoI spend much more time refactoring that creating features (though, it is getting better with each model). My go-to approach is to use Claude Code Opus 4.6 for writing and Gemini 3.1 Pro for cleaning up. I feel that doing it just one-stage is rarely enough. A lot of prompts about finding the right level of abstraction, DRY, etc. An earlier example (Opus 4.5 + Gemini 3 Pro) is here: https://github.com/stared/sc2-balance-timeline https://github.com/stared/sc2-balance-timeline I tried as well to just use Gemini 3 Pro (maybe the model, maybe the harness) it was not nearly as good as writing, but way better at refining.
- ndriscoll 7mo agoConcise isn't specific enough: I've primed mine on basic architecture I want: imperative shell/functional core, don't mix abstraction levels in one function, each function should be simple to read top-to-bottom with higher level code doing only orchestration with no control flow. Names should express business intent. Prefer functions over methods where possible. Use types to make illegal states unrepresentable. RAII. etc. You need to think about what "good taste " is to you (or find others who have already written about software architecture and take their ideas that you like). People disagree on what that even means (e.g. some people love Rails. To me a lot of it seems like the exact opposite of "good taste").
- irthomasthomas 7mo agoHave you tried meta-prompts e.g. "Rewrite the prompt to improve the perceived taste and expertise of the author"
- XenophileJKO 7mo agoI really should spend some time analyzing what I do to get the good output I get.. One thing that is fairly low effort that you could try is find code you really like and ask the model to list the adjectives and attributes that that code exhibits. Then try them in a prompt. With LLMs generally you want to adjust the behavior at the macro level by setting things like beliefs and values, vs at the micro level by making "rules". By understanding how the model maps the aspects that you like about the code to language, that should give you some shorthand phrases that give you a lot of behavioral leverage. Edit: Better yet.. give a fresh context window the "before" and "after" and have it provide you with contrasting values, adjectives, etc.
- globnomulous 7mo agoI appreciate that your message is a good-natured, friendly tip. I don't mean for the following to crap on that. I just need to shout into the void: If I have some time, the last thing I want to do with it is sharpen prompting skills. I can't imagine a worse or more boring use of my time on a computer or a skill I want less. Every time I visit Hacker News I become more certain that I want nothing to do with either the future the enthusiasts think awaits us or the present that they think is building towards it.
- SerCe 7mo agoWhile I somewhat understand the impact on the craft, the agents have allowed me to work on the projects that I would never have had enough time to work on otherwise.
- vasco 7mo agoYou dont need to learn anything, it needs to learn from you. When it fails, don't correct it out of bounds, correct it in the same UI. At the end say "look at what I did and create a proposed memory with what you learned" and if it looks good have it add it to memories.
- laserlight 7mo ago> change the prompt in a way that would produce code similar to what you've achieved manually. The problem is that I don't know what I'll achieve manually before attempting the task.
- Bridged7756 7mo agoThis better reflects what I thought about the other day. You either, let clankers do its thing and then bake in your implementation on top, you think it through and make them do it, but at the end of the day you've still gotta THINK of the optimal solution and state of the code at which point, do clankers do anything asides from saving you a bunch of keypresses, and maybe catching a couple of bugs?
- avereveard 7mo agoAlso useful to encode into the steering of your platform. The incremental aspect of many little updates really help picking up speed by reducing review time. Big bang approach could be a start, but a lot of one line guidance from specific things you dont want to see stack up real fast.
- aix1 7mo agoMy mildly amusing anecdote is that, whenever Claude Code produces something particularly egregious, I often find it sufficient to reply with just "wtf?" for it to present a much more sensible version of the code (which often needs further refinement, but that's another story...)
- mvanzoest 7mo agoYeah I had a similar experience on a smaller scale, reducing a function from 125 lines to 25.
- scuff3d 7mo agoHad the same problem with a Python project. Just for the hell of it I tried to have it implement a simple version of a proxy I've made in the past. What was finally produced "technically" worked, but it was a mess. It suppressed exceptions all over the place, it did weird shit with imports it couldn't get to work, and the way it managed connection state was bizarre. It has a third year college students approach to "make it work". It can't take a step back and reevaluate a situation, or determine a new path forward, it just hammers away endlessly with whatever it's trying until it can technically be called "correct".
- kqr 7mo agoWhen I benchmark LLMs on text adventures, they reason like four-year olds but have the worlds largest vocabulary and infinite patience. I'm not surprised this is how they approach programming too.
- duskdozer 7mo ago>It has a third year college students approach to "make it work". It can't take a step back and reevaluate a situation, or determine a new path forward, it just hammers away endlessly with whatever it's trying until it can technically be called "correct". OH! Yeah I think this is the exact bad feeling I've gotten whenever I've tried testing these things before, except without clear and useful feedback like compiler error messages or something. I remember when I used to code/learn like that early on and...it's not fun now. I also don't think it's really solvable
- scuff3d 7mo agoYeah it's really funny to watch. They'll get stuck in a specific method call or a specific import. Even if you tell them to read the docs. Doesn't matter if there's a better approach, or that method only exists for some obscure edge case, or the implementation runs counter to the design of the API, if the can hammer the round peg into the square hole, they'll do it. They also just... Ignore shit. I have explicit rules in the repo I'm using an agent for right now, that day it is for planning and research only, that unless asked specifically it should not generate any code. It still tries to generate code 2 or 3 times a session.
- jlandersen 7mo agoVery familiar experience
- iijaachok 7mo ago[dead]
- tobr 7mo agoI wonder why they fail this specific way. If you just let them do stuff everything quickly turns spaghetti. They seem to overlook obvious opportunities to simplify things or see a pattern and follow through. The default seems to be to add more, rather than rework or adjust what’s already in place.
- OtomotO 7mo agoAll it does is generate soup. Some of which may taste good. There is no thinking, no matter what marketing tells you.
- samdjstephens 7mo agoI suspect it has something to do with a) the average quality of code in open source repos and b) the way the reward signal is applied in RL post-training - does the model face consequences of a brittle implementation for a task? I wonder if these RL runs can extend over multiple sequential evaluations, where poor design in an early task hampers performance later on, as measured by amount of tokens required to add new functionality without breaking existing functionality.
- foo42 7mo agoYeah I've been wondering if the increasing coding RL is going to draw models towards very short term goals relative to just learning from open source code in the wild
- Antibabelic 7mo agoLLMs are next token predictors. Their core functionality boils down to simply adding more stuff.
- logicchains 7mo agoThey do what you tell them to. If you regularly tell them to look for opportunities to clean up/refactor the code, they will.
- catlifeonmars 7mo agoTo me this seems like a natural consequence of the next-token prediction model. In one particular prompt you can’t “backtrack” once you’ve emitted a token. You can only move forwards. You can iteratively refine (e.g the agent can one shot itself repeatedly), but the underlying mechanism is still present. I can’t speak for all humans, but I tend to code “nonlinearly”, jumping back and forth and typically going from high level (signatures, type definitions) to low level (fill in function bodies). I also do a lot of deletion as I decide that actually one function isn’t needed or if I find a simpler way to phrase a particular section. Edit: in fact thinking on this more, code is _much_ closer to a tree than sequence of tokens. Not sure what to do with that, except maybe to try a tree based generator which iteratively adds child nodes.
- iamflimflam1 7mo agoWe’re heading for a world of terrible code that can only be maintained by extremely good coding agents and are pretty much impossible for a human to really understand. The days of the deep expert, who knew the codebase inside out and had it contained in their head, are coming to an end.
- pas 7mo agothat was the exception not the rule
- tveita 7mo agoProbably more like the long tail of software - software that was created for a particular purpose in a particular domain by a single person in the company who also happened to know programming - maybe just as Excel macros. I strongly assume the long tail is shifting and expanding now and will eventually mostly be software for one-off purposes authored by people who don't know how to code, and probably have a poor understanding of how it actually works.
- pas 7mo agoHm, yes, it makes sense. If AI "makes" software more and more composable, then yes, most software will be thin wrapper on some ancient machinery that no one understands :) I guess in some sense this is already the case. Most developers are not "full stack" (and the job postings that describe a software MacGyver are ridiculed like clockwork), but with AI this is actually becoming more and more possible (and thus normal, or at least normalized). And of course software is eating the world, including itself, so the common problems are all SaaS-ified (and/or FOSS-ified), allowing AI-aided development to offload the instrumental dependencies.
- hinkley 7mo agoThen this is an era of snake oil because customers aren’t going to put up with that shit for long.
- 7mo ago
- cbg0 7mo agoxhigh effort is actually pretty terrible for 5.2/5.3/5.4 models. Stick to medium/high as it overthinks less.
- laserlight 7mo agoI reported a similar case of mine several days ago [0]. I was able to achieve better quality than Claude Code's 624 lines of spaghetti code in 334 lines of well-designed code. In a previous case, I rewrote ~400-line LLM generated code in 130 lines. [0] https://news.ycombinator.com/item?id=47272913 https://news.ycombinator.com/item?id=47272913
- yodsanklai 7mo agoHappens all the time. I usually propose a details structure myself (e.g. do it in three phases, add 3 functions + an orchestrator, make sure structure is valid before writing the function bodies), or iterate on detailed plan before implementing code. Now some people argue that terrible code is fine nowadays, because humans won't read it anymore...
- ernst_klim 7mo agoIndeed. I have a few colleages and they constantly try to push these long convoluted functions which look like is_done = False while not is_done: if pattern1: ... if pattern2: ... if matched == "SUCCESS": is_done = True break if pattern3: ... It's usually correct but extremely hard to follow and reminds of the good old asm code with convoluted goto's. And the colleages tend to do reviews with the help of the agents so they don't even care to read this mess.
- lmeyerov 7mo agoOnce my code exists and passes test, I generally move on to having it iteratively hunt for bugs, security issues, and DRY code reduction opportunities until it stops finding worthwhile ones. This doesn't always work as well as I'd like, but largely does enough. Conversely, doing as I go has been a waste of time.
- mplanchard 7mo agoI had a similar experience yesterday. Was working on some async stream extensions. Wrote a couple proofs of concept to benchmark, and picked one based on the results. I almost never use LLMs to write code, but out of curiosity, asked whatever the newest claude is to make it with all the real prod requirements, and it spit out over 400 lines of code, lots of spaghetti, with strange flow and a lot of weird decisions. Wrote it myself with all the same functionality in right around 170 lines. Also had a similar experience in the past weeks reviewing PRs written with LLMs by other engineers in languages they don't know well, one in rust and one in bash. Both required a lot of rounds of revision and a couple of pairing sessions to get to a point where we got rid of the extraneous bits and made it read normally. I'm glad the tool gave these engineers the confidence to work in areas they wouldn't normally have felt comfortable contributing to, but man do I hate the code that it writes.