Whenever it gets in a cycle of fucking up, I ask it to break the code down into smaller functions and write a test suite for each individually.<p>Tell it what language or packages to use or it might make selections that add dependencies or require installing stuff on your computer.<p>Tell it how you want your code written or it will be an extra chore to accommodate linting requirements.<p>Basically just being very explicit.
I mostly write low-level code in Python and JS. When working with a new API, I would sometimes find it difficult to locate information to fix problems. With ChatGPT I simply <i>rubber duck</i> my problem. It usually only takes a couple of iterations to zoom into the core solution.
Copilot in visual studio to fix compiler errors and let it type all the boilerplate code by TAB-ing. Sometimes it even manages to spit out an entire - and correct - function.<p>Mistral Le Chat for more advanced questions and figuring out things that copilot can't.