My guess is that there are automated ways that will help with e.g. 90% (or even all) cases like this:
Just asking the model “see this patch, try making it cleaner and more concise if possible, while keeping all the important logic” would likely help in your case.
You could also have some “critic” role. The insight “this looks too long and complicated on the first skim” is something an LLM could also say here, and then you could ask the model to improve that part.
Generally LLMs are really good at refactoring, but it feels people don’t use them for that purpose enough because that costs time and tokens. But I don’t see a good reason for why it would stay that way forever.
So, in other words, I would predict that with the current LLMs you could have “high quality code” scaffold that produces high quality code, just at a cost.
My guess is that there are automated ways that will help with e.g. 90% (or even all) cases like this:
Just asking the model “see this patch, try making it cleaner and more concise if possible, while keeping all the important logic” would likely help in your case.
You could also have some “critic” role. The insight “this looks too long and complicated on the first skim” is something an LLM could also say here, and then you could ask the model to improve that part.
Generally LLMs are really good at refactoring, but it feels people don’t use them for that purpose enough because that costs time and tokens. But I don’t see a good reason for why it would stay that way forever.
So, in other words, I would predict that with the current LLMs you could have “high quality code” scaffold that produces high quality code, just at a cost.