At EdgeMicroCloud, we have had personal experience with AI writing code.
ChatGPT is not there yet.
With a very simple project, we found we had to ask ChatGPT to correct coding errors. It took 3-4 iterations for the AI to come up with very that did not have bugs.