What do you do to prevent stupid mistakes?
Solution 1:
Surprised no-one has added... go home when you're tired! Brain does not do its best work when you're 10 or 12 hours into the day, go home, grab a beer, get some shut-eye and hit the ground running in the morning!
I also find "peer review" useful... "hey bob, I'm just going to bargle the frargle - you see anything up with that?" just saying it out loud can solidify what you are doing in your mind.
Now we return you to "technical solutions for a single, tired brain" ;)
Solution 2:
I don't do anything to prevent them, but rather, plan around the expectation that I'm bound to make horrific ones.
Solution 3:
Just don't make a mistake that was obviously noted or explained in the documentation... which is a good advice: READ THE DOCUMENTATION FIRST