The shotgun can be a formidable weapon at very close range. However, there are several problems in using one for home defense.
The first problem, as Dale points out, is recoil. This can be pretty grim, especially if your wife is trying to use it. One solution: Use a 20 gauge. It will do just about every thing a 12 will, with much less recoil.
The second problem is that the barrel is long and awkward to maneuver inside a home without exposing yourself. Mike is right...defending a pistol barrel against a grab is much easier than defending a shotgun barrel. However, if you can establish a proper defensive position, and don't need to move from there in order to protect other members of your household, a shotgun should work fine.
I've fired well over 60,000 rounds of shotgun shells, and have my share of expert badges and patches. Nevertheless, my choice for wake-up-in-the-night defense against home invasions (and we've had three locally in the last several weeks) is a Glock 23 in .40 caliber. These trolls travel in groups of two, three, four or more. A high-cap auto is easy to grab out of a sound sleep, and gives you the firepower to defend yourself effectively against such living nightmares. It also gives you a quick reload if needed. My second choice would be a short, handy carbine like the Ruger Mini-14.
As for shot size and slugs, you have to make your own choice. At 20 feet, what you pick will probably work. Don't expect it to penetrate the skull or the bullet-proof vests some of these thugs are wearing, however. This means you have to think about shot placement, and be flexible enough to put the second shot in the face, groin or leg if the first one doesn't do the job.
Very Important: Don't think it's over just because you put down the first guy. He's probably traveling with friends just as bad as he is.