I guess it's hard to tell from the death shot, but I don't see the "sheer bad luck" here. Is it that you had the double shotgun equipped when the commando showed up, or barely didn't kill him? Plasma rifle only has +2 accuracy, you probably would have had an excellent chance to run away from him, get your bearings straight, and shoot him from out of vision.
Having that many shotgun shells (with a shotty build) is usually indicative of not finding other items to fill up the space. Early on you SHOULD be collecting as many shells as possible, swapping them out, as time passes, with more important items. I'd agree with Mrazerty that 4-5 is usually okay for HNTR, but I don't mind having anywhere between 6-8 just in case. Of course, when you have to take other types of ammunition into account, item management is a little trickier: BackPack helps greatly to this end, which you understand well enough. Until you hit The Wall, three stacks of rockets is optimal to carry for clearing it, and I don't bother with more than a stack of cells (if that) unless you have definite plans for a plasma-type weapon. 4 med-packs of any type is good to reserve whenever possible.
Keep in mind that combat-normal-double is the order of best-to-worst range when it comes to shotguns. Unless I'm within two or three tiles of the target, for instance, I don't get out the double shotgun. MAD builds are best handled with the combat shotgun as your primary anyway, since the armor reduction factor is more significant when you aren't dealing much per shell. And, of course, running ALWAYS makes things better for a shottyman, since there are no losses to doing so.