Write tests before asking AI to implement features. Give it:
"Here are my tests: [tests]. Implement a function that passes all of them."
This forces AI to handle all your edge cases. Without tests, AI implements what it thinks you want. With tests, AI implements what you specified.
The tests become documentation of expected behavior.