I just recently experienced this as a head count trimming qualifier without severance. Fortunately, I have a side career, a plan B, that is capable of paying all my bills.
As an individual contributor (not management) you are at the complete mercy of the employer. If they are a mess, then you will be a mess. If head count trimming is about to happen there is nothing you can do. If not you then it will be one of your peers that gets pushed out but unless leadership (not you) radically shifts directions your time is ultimately limited.
My suggestion:
Recognize the symptoms. I saw the writing on the wall months ago and ignored it. I kept making excuses like how great their culture is and how this won’t happen. Stop making excuses. I have been writing software long enough to fully understand the economics of the situation and should have applied more common sense earlier.
The moment economic pessimism starts to creep in engage the planning stages of a back up plan. Once the signs of head count reduction start you are way behind where you need to be. At that point you should be ready to execute as fully explored plan B immediately.
Things to consider:
* Save money. Always have enough in savings for 2-3 months of unemployment.
* Be looking for a pivot. Consider getting a PMP or CISSP. Certs are irrelevant and ignored by your software career, but they make for a nice exit plan if you need it. Once you have those you just need to maintain them.
* Write. Start a blog, a personal diary, or anything else. Always be improving your communication skills. This can help you transition to the next stage in life when all else has failed.
* Build professional relationships. This is critical if you want to do other things later in life, such as business or consulting. This is my biggest failure as I have dedicated all my time to family and technical mastery. I have no regrets here, but I am limited by this.
* Consider more education. I am thinking about grad school and moving away from software towards business operations positions.