More military. Ambushes come in more than one squad.
Eeergh. I recruited four marksdwarves, had them training up in the archery range, and a massive goblin ambush killed off three and left the last one crippled and probably dying. I have a long corridor extended outside - I was planning to build drawbridges over it to smash any intruders. I'm now planning to build a roof over it and use it as a Great Wall-type thing so my marksdwarves can walk on it and kill intruders, but I have a few problems:
1. How do I even do this? How high should I make it and such, and how do I build a floor over two walls?
2. If I have this Great Wall and corridor of death protecting everyone inside, how do I protect people outside gathering clothes or whatnot?
1. Build floors in between the tops of the wall. You'll need access from inside. After that, put fortifications on top of the walls.
2. Melee dwarves. Once they're trained up, they will, in conjunction with the archers, cause goblins to be killed close in.
Now, to keep the civillians protected, you need them to be out there as little as possible. This means that, after a siege, you need to haul the stuff you plan to keep indoors ASAP.
My system is to mass-designate everything to be dumped, then melted, then use the stocks menu to un-designate the corpses and body parts. After that, the bodies and parts are hauled, then the metal, and finally the clothing.
For a fully-working fort of 100-150 dwarves, I keep a somewhat inflated military. Something like 30 or 40 dwarves, divided into three melee squads and one or two ranged.
The fortress guard (female migrants are surplus to requirements, dwarves brain-damaged while sparring before they make Hero level) is set to unarmed, to train the military in wrestling.
The military itself is recruited from male migrants. I don't bother to boot-camp train them, I just assign them armour and train them unarmed in one large squad per migrant wave, before assigning weapons when they hit elite or legendary. This is to make sure they don't kill each other.
For protecting the civillians, I station two melee squads in the archery defense corridor, with archers on hand if there's a squad on rotation. There's a big chunk of Restricted access over the main entrance, to discourage anyone wandering outside, and work out there is done in spurts, guarded at all times.
I also chain up war dogs by the inside entrance, with any extras going into a cage on the outside, hooked to a lever.
All this makes sure that if an ambush is spotted, the military can react instantly and decisively.
Squad leaders are checked regularly to make sure they're on station. Anyone drinking or asleep is swapped out instantly, to get the rest of the squad back.
Squads have a season or two on duty, then the rest of the year off for training and exposure to the meeting zone.
The corridor itself has a pair of right-angle turns, to stop archers firing straight in. It is also the ONLY access to the unprotected outside. ANYWHERE. Access to the protected outside is inside a courtyard that the corridor is linked to, which contains the trade depot (and drowning system), and access to the Z-level above.
I like to have an upper courtyard, for the sake of keeping bolts and an archery range on.