I’m not even kidding when I say I just did 6h or so of work in around 45 minutes
Figure out what your goal is, and then start by giving a wide context and at first it will give wrong answers due to lack of context. With each wrong answer give it some more context fro what you think the solution provide is missing the most. Eventually you get 100% working code, or something so close to it that you can easily and quickly finish it yourself.
This is one strategy, but there are many that you can use to get it to reduce the burden of refactoring.