Classic layoff defense: Become irreplaceable within your team and within your company. This tactic proves self-explanatory; no need to further elucidate.
That being said, and counterintuitively, there exists one situation where you want to make yourself easily replaceable—but with respect to your team, not the whole company. This is when you plan to make an internal career move, laterally or upward.
The issue is, if you prove extremely competent at your job, your manager may not want to let you go on to the next opportunity. And in the case of an intra-company career move, you need your manager’s support and approval to make a change. Therefore, you want to make it as easy as possible to train a new person to perform your current role. Further, you want to take steps to reduce that new person’s dependence on your ongoing advice once you have transitioned to the new position.
The trick is to create and maintain constant and up-to-date documentation. Write SOPs and training materials detailing how you perform your critical tasks. Keep them current and easily accessible. Use a wiki framework if you can. Seek input from colleagues regarding content.
Writing these documents has the added benefit of making you look more professional and team-oriented (especially because writing documentation is a fundamentally team-oriented pursuit). I consider such output as just as significant a work artifact as the tasks you are responsible for in the first place.
More surprisingly, this activity streamlines your job in situ—before you even begin to consider an internal transfer. By clearly defining your work, you clarify your deliverables, which you can leverage during goal setting sessions and performance reviews. You define procedures by which you can measure your performance against. Furthermore, writing documentation (especially SOPs) helps you identify and prioritize opportunities for process improvement, which helps everybody (and again, makes you look good).
It’s best not to wait until you are ready to transfer to a new position to start this process. In fact, I started writing training documentation for position during the second week of my new job at a new company (a task not assigned to me). The reason is that during the early consideration period surrounding an internal transfer you’ll be busy with both your current job’s tasks and with the groundwork required to make the transfer successful. So, write your SOPs and training materials when you don’t yet need them; you never know when an internal career opportunity will emerge, and the added benefits of having the documents at your fingertips will pay dividends. And it’s just good karma to provide such resources to your colleagues!
I hope I’ve convinced you of the counterintuitive: That making yourself easily replaceable by writing down in explicit detail how to perform your job can prove an effective career move.