Whilst few of these things will deter every intruder / assailant (apart from maybe the twice in the
head thing

- for that a screwdriver in the top of the head also works, plus a brief moment of comic effect

)....nonetheless I think some of them would be called prudent and would deter some. There are reasons why many intrusions happen at night / under cover of darkness, even if the perpetrator does not fully understand why! Remove the nighttime and some problems will go away.
For me that would mean spreaderlights (I've got a
ketch so that means lots of light sources

). and also ideally a strobe - whether activated by movement or simply a switch down below. Like many things on a boat they also serve more than one purpose.
I would also favour locking the hatches from the inside, not neccesarily fully closed, but not leaving mansized gap (don't need a padlock for that) - and for the
companionway hatch (or any other
hatch that needs to be opened fully) then the MarkJ style
grill would seem an easy fit. and no great hassle to use. Obviously won't prevent someone smashing their way in - but unless a very heavy sleeper that will give you a chance to at least put your trousers on!
Some sound would also be nice - whether a Klaxon or a pre-recorded voice (in the local lingo) basically saying "f#ck off". The purpose not to simply summon assistance from others (good luck with that!) but mostly to unsettle the intruder and help persuade him that an easier target elsewhere.
Obviously none of that will deter everybody - but IMO will be one keen intruder to persist when lit up like a Xmas Tree, having a loud voice in own lingo in his ear and still to get through to the goodies below. And if someone does persist it is early warning that you do have serious trouble coming down the pipe (hatch!).
I would also like a spy hole into the
cockpit, or even a
camera (if no
grill used or no other viewingpoint) as once you know how many are involved and what weaponary they have better decisons can be made.
Might also want to make the Forecabin into a panic room! don't need a
steel door - just be able to lock it solidly from the inside (and a spyhole into the saloon). Ideally with access to a hatch onto
deck. Could even have a couple of mini
scuba tanks stored there (and some weapons?!), so the chance of a quick dash onto
deck and then over the side.
I don't think any of the above is too outrageous and whilst requiring a little bit of preparation not exactly turning the boat into a floating fort knox or impacting on the day to day laid back approach.
Obviously opposing a boarding is a different thing.....if they don't have
guns them IMO a better than even chance of coming out on top (as long as you have something useful and are willing to use it - until stuff stops twitching).
Guns? I guess that is a suck it and see thing - but just because you surrender doesn't mean you can't change your mind, the moment of boarding would be the time of most vulnerability for the boarder(s)....and if you suddenly turn the tables on them by fighting way into their vessel likely to have some element of surprise! (but remember to have someone onboard shoot some Youtube - as am curious as to how that would
work out

).