Break tasks
Have each AI task be extremely small in nature for what scenarios it’s supposed to handle.

Instead of having a single prompt handle every edge case, you can build a router prompt that identifies some of the most common scenarios, and then build unique flows for them.