When you make a mistake, you should regard it, look at it, examine it, and focus your energy on it in such a way so as to mark it permanently in your memory as a mistake, then dedicate the emotional charge that that generates toward self restraint. Perhaps you would like a mantra to help you remember: “I see that mistake as a mistake for the sake of self restraint.”
You may be asking yourself, “what is the result of applying this teaching diligently?” First, it provides a mental support in the form of knowing what to do in a given situation. Your mind keeps bringing up a past screw up and it’s driving you to distraction. Regard it as a mistake and feed the emotional charge to your restraint maker. If it doesn’t go away after 2 or 3 applications, move to MN 20 described here. Another result of applying this teaching with zeal is that you tend to do fewer things you regret later.
You may be thinking “But what if looking at it, I can see no other possible action than the mistake?” Then you need to concentrate on bringing investigation to the area of memory where the mistake lies. Perhaps the lack of desire to invent new wholesome qualities is your problem. Perhaps you need to protect and grow wholesome qualities that you already have. Perhaps you need to interrupt unwholesome qualities, or prevent them while they don’t exist. Perhaps the mistake was done with ill intent. In that case, refocus the “mistake”-marking mental object on the ill will and dedicate the effort towards self restraint for the sake of freedom from suffering.
You may be thinking “Are there any gotchas to using this teaching?” The main one is if your mind brings it up more than 2 or 3 times, fall back to MN 20. Another is that shame may be part of your mistake view. If so be very gentle, you can burn out your sense of shame, and that hurts for a long time.
Managing expectations: this will not do much of anything until you’ve done it a while, and then the results will show slowly, so the desire to do this must be such that you will not give up at the first obstacle. Think of it as wearing a tool handle smooth, you won’t be able to say “because I regarded these mistakes as mistakes, I had the restraint to avoid these mistakes.” But you will be able to say with direct knowledge “Because I began treating mistakes in this way, I made fewer regrettable actions.”