- Always do your best,
- acquire new skills,
- and as soon as you feel that your personal growth is stagnating, look for an opportunity in a better company where you will be able to continue growing your skillset.
I can't think of another way to avoid getting laid off, and there was never much logic here when it comes to cuts.