This is called “rubber ducking” and you are right, I have used AI for this and it’s useful.
For me it works. I first spent some time instructing it to write up specs for the feature that I want to implement. Then, based on those specs, I create the tests and finally the implementation. It took a while to set it all up but for me it works and I can build features way faster.
I’m using Cursor (Gemini / Sonnet) with some custom rules to make sure it does what I need it to do. For example, I have a rule that states that it first needs to read the docs to make sure a function and or module exists before suggesting it. This stopped it from hallucinating modules and functions that do not exist. I also have a rule set for it to follow a code style guide and so on.
Lastly, after ever prompt it asks me 3 follow up questions as if it was me. Even if I don’t end up using the code, the questions at the end make me think about what I’m doing and that has helped me a lot.
Some posts that helped me getting started:
From Skeptic to Believer: My Journey with the Stdlib Approach and AI Agents | Ihor Katkov (Elixir)