Generating code from scratch and modifying existing code are two different things, obviously the latter being where AI doesn't do great. Carefully managing and compressing context can somewhat help, but that is far from being a perfect solution.
I went from using copilot autocomplete and mostly just disabling it because it was not great, to now using claude most of my day. I gets stuff wrong. It does generate inefficient code. It definitely has a way to go, but otherwise it just saves so much time.