It seems like every time I read the forum, someone has a sob story about losing important dwarves to failed moods, and people reply with their clever techniques of locking them in their workshops, assigning dogs to them to take them out if they berserk, and other such silliness.
I've had two failed moods ever. One was in my first fort, and one was a glassmaker on a sandless map. What the hell is wrong with people?
I've had a couple of close calls, but the time you get is more than generous.
I present my quick guide to never, ever failing a mood, unless you have someone wanting glass on a sandless map:
Bring a couple turtles, or set a dwarf to fish just for five minutes (make a fishing zone on a safe pond if there are carpful places to fish), or buy a turtle or cave lobster from your first caravan. This way you won't be caught without shells. If you're in a desert you need to do your fishing right away before the ponds dry up. If you're on a glacier you might be screwed.
Plant pig tails in your first summer. This way you won't be caught without plant cloth, and if someone needs glass, you won't be caught without bags to gather sand in. I've tried playing with no farmer and without bringing any plants or seeds, but I started gathering plants and pulled some rope reed almost right away. If you're playing that way on a glacier you might be screwed.
Buy one or two pieces of giant cave spider silk cloth from your first caravan. This way you won't be caught without silk cloth. Even if you have a chasm, GCS cloth will make a better artifact, and in the beginning of the game when you're most vulnerable to failed moods your chasm is probably still full of nasty things.
Buy a leather bin from your first caravan, or butcher one of your initial pack animals. This way you won't be caught without leather. As long as you've got stuff for a butcher and tanner shop, you've always got those two starting pack animals, so there's almost no way to screw this up without going to great lengths to be stupid.
If you're building an aboveground fort, go dig enough to find at least one metal vein and gem cluster. This way you won't be caught without stone, metal or gems. If you have an aquifer, learn how to get through or around it; I recommend making a pump out of wood if you really have no stone at all (to make 3 mechanisms for the cave-in method) and can't use a map feature to get by.
If you brought neither a pick nor an anvil, or have an aquifer but no axe, then you might be screwed.
Have access to at least three logs. This way you won't be caught without wood, because you have logs; metal, because you can turn a log into charcoal and use it for smelting; green glass, because you can turn a log into charcoal and use it for glassmaking; or clear glass, because you can turn one log into charcoal for glassmaking, a second into ash and then potash, and the third to make pearlash. If you have a moody smith they might want several metal bars, in which case you turn all the logs into charcoal. I once had a smithing mood where I'm pretty sure the actual forging didn't use any fuel (just the burning passion of that dwarf's inspiration, I guess); if that's really how it works, you should be fine using all your logs for smelting.
If you embarked on a treeless map or without an axe, without bringing any logs, turned your wagon into beds, and are dropping caravans into magma or don't get any logs from your first, then you're probably screwed, but that's the kind of thing that happens when you live on the edge like that.
You can also buy a bar of something cheap like tin or copper from your first caravan to use in mood emergencies.
I do all these things just about automatically with every new fort. It only takes a tiny bit of planning to make sure you have every type of material around for moody dwarves.
Exercise a little foresight, and you too can move on from telling "my armorer failed a mood and died" stories to "I got this lovely artifact steel chain mail worth 384,000... but it was from a goddamn possession so I didn't get a legendary armorer."