I highly recommend frequent practice. Be intimately familiar with your weapon, put at least several hundred rounds through it before you trust yourself with it enough to feel protected.
While you can't always anticipate a bad guy's actions you often have several hints of what could be going down momentarily. Be prepared and don't be surprised.
You can't always have much time, if someone is kicking down your door you should have plenty of time to be aiming at the door before they are through. If someone bursts into a store with guns blazing you should have been watching the door and been ready.
Know what is going on around you. It isn't hard, we do it while we drive or at least a good driver does. Be ready.