If you understand these subtle pieces you perceive the AI to get wrong, you should include that in your prompt. Also, unit test and functional test coverage go a long way to ensure correct behavior.
It is surprising to see how many are still in utter denial around here, though. Maybe we should all go back to punch cards.