HOW TO BE A PERFECT IMPROVISOR

It can't be done.
Perfection is a stupid goal.
Besides if perfection is your goal, memorize a script so it all works out exactly as expected.
There's no need to be perfect.

Instead be kind.
Put your scenepartner ahead of yourself.
Value and be grateful to your audiences.
Keep trying to learn new things from
likely and unlikely sources.
It's never done.