Not sure what I can say but the LLMs simply do not write good code without tons of handholding. As a C developer most LLMed patches I have seen the last couple of months have been awful and the few good ones I know from the author themselves that they did a ton of iteration and/or manual cleanup. Maybe they are less bad at writing other languages.
At least what I have seen in Ruby and Typescript, they are excellent at doing what you asked for. But if what you asked for is stupid they will happily make it happen.
They don’t make normal mistakes like typos and they aren’t lazy so things like tests and checking error cases is usually done.