Step 1) Acquire spawn device

Step 2) Go to your spawn point I don't reccomend spawning indoors so make sure you get rid of any beds that you set your spawn to, remember your time is limited

Step 3) Summon boss

Step 4) Every time you die re spawn instantly, the boss will not able to despawn!

Step 5) Repeat until boss dies

Step 6) Collect your loot

This strategy works for wyverns you just have to lure them down to the surface but it does not work with Skeletron Prime and I haven't tried it with Ocram.

Step 7) Have fun farming :-).