This is how I made my danger room:
1) I mined 3x3 room out of the way, with 3 tile long 1 tile wide entrance, and 2 tile deep, 1 tile wide alcove. I also made sure, I had lots of wood.
2) I opened Dwarf Therapist, checked the lowest skill of my active carpenters, and set that to be the lowest acceptable on both my carpentry workshops (making bins and barrels and beds). I made sure, there were no scheduled carpentry jobs in manager.
3) I built another workshop, then set its profile to only accept dabbling carpenters. I ordered all my 90+ training spears there. I enabled carpentry on all my peasants in Dwarf Therapist.
4) I build armor stand and door in alcove. I set door in alcove to internal, forbidden and tightly closed. I also installed 3 door in entrance corridor and set them all to tightly closed. This proved to be ineffective, so in future fort 1 door will be enough. I made barracks out of the armor stand to cover the 3x3 room.
5) I built a lever, and started installing 9 tiles of 10 no quality wooden spears connected to the lever by no quality mechanisms. This took some time.
6) With spears done, I removed my new carpentry workshop, and disabled carpentry on peasants. I hope they don't start mooding out making wooden items.
7) I hand-picked male only first squad to train in DR. I outfitted them in full "Munchkin" armor (see armor on the wiki, basically I gave them full metal armor, 2 mail shirts, and leather dress, 6 leather cloaks, and so on)
The result was fairly impressive. I got legendaries quickly, and they were not injured in any way. They were some downsides also:
- Trainees sometimes passed out of exhaustion, when in danger room, so I didn't keep it on repeat all the time. They all got inexhaustible quickly too.
- Some Dwarf went inside, probably to take out a dead cat or something, and died.
- Lots of dead pets, mostly cats and dogs. Injured elephant and big cat.
My multiple legendaries killed the next siege with relative ease. A speardwarf managed to stop 2 squads of goblins until 2 of his buddies showed up, and finished the slaughter. Only 2 dwarfs died this time rather than 20. Maybe I should give them melee weapons rather than wooden crossbows with not enough ammo. Oh well.