On Friday I almost wiped my entire low level D&D party because the high dexterity Wood Elf Paladin couldn't make a DC 10 Dexterity save to not fall off a suddenly vanishing floor. He failed the check, the following DC 12 strength save to grab hold of the ledge. The next person in line then failed a similar check to catch him, and before long it came down to the last member of the party - a halfling at that - managing to keep everyone alive by securing the last part of the 'human' chain with a rope.
On Sunday, our Star Wars game that a friend runs almost had a TPK happen because two characters who have built exclusively around one of two skills (mechanics and piloting) for 400+ XP couldn't make a check to save their lives (almost literally).
Beyond just being amusing anecdotes, both sessions serve as a solid reminder: the dice will betray you. And as a GM you need to be ready for that. Luckily, there are some safety tips involved.
Safety Tip 1: Don't Make a Check For Something You Need to Succeed
If something is absolutely vital for the game to progress, or the adventure to go forward, it should not be tied to a check. At least, not unless you are willing and ready to go forward with a game where that thing did not happen. For example, if the PCs need to solve a mystery, and to solve the mystery a particular thing needs to be noticed you either need to make noticing that thing not a dice related check, or be prepared for the PCs to not get that particular thing and thus be unable to solve the mystery.
Safety Tip 2: If It Has Stats It Can Die. If It Involves A Roll It Can Fail
Both of these things seem obvious, but time after time you'll find stories on RPG boards about the PCs killing some big bad, or other giant creature, they had no business being able to kill. Alternatively, you'll find the other versions of my two stories at the top of the post. The versions where the games ended because a basic check failed causing a cascading result of dead PCs.
Always remember, if something has stats it can be killed. If something involves a roll, it can fail. If you're not prepared for these outcomes then don't give the thing stats, and don't let the dice get involved.
Safety Tip 3: Roll For Something Other Than Success/Failure
So what do you do when you want a check to be involved, but you don't want complete failure on the table? You roll for something else. One of my favorite things to roll for is how long something takes. If the check has to be successful, you just roll for how successful or how long it takes to be successful. Sure, the PCs get the engines running and manage to limp the ship to hyperspace. However, because the checks 'failed' it takes long enough that there are some serious consequences because of it. Someone might be hurt. People might have to make checks to not take damage from various sources - which could lead to someone dying. Perhaps they don't make their rendezvous on time, and now they have employer problems and bounty hunters out for them - or won't get full pay.
Failure can mean a lot of things. Don't always take it directly, or literally. Trust me, other options are often a lot more fun.
Safety Tip 4: Don't Have One Check Lead Directly To Death
One roll of the dice should not lead to death immediately. In some games that happens, and if you like that then that's fine. However, most people don't like an arbitrary turn of the dice killing their character in one go. Even combat involves a To Hit roll and a Damage Roll if someone is going to be one shot.
Did the player fail the dex check to keep their balance? Maybe a strength check to hold on as they fall. Maybe someone nearby can also try to help them. Give players a chance to keep their character alive. You don't have to string it out forever. Just at least give them a second shot at staying alive.