Losing your job is bad, but it's worse if you're blindsided. While a firing can come out of nowhere, there are often plenty of warning signs if you know to what to watch for. What you do if you see danger signs is up to you. You can talk to your boss, try to improve your performance or start hunting for your next job.
If you and your boss don't get along, your job is never completely secure. It may be a constant antagonism, or it may be you said one wrong thing at a meeting and she took offense and won't let it go. If you're argumentative or critical much of the time, she may decide you're impossible to work with. If you think you get along fine but your performance is frequently criticized, that may be a warning sign too.
If you used to get good assignments -- challenging projects, important clients -- a shift to lesser projects or tedious tasks is bad sign. So is getting less work overall or being discouraged from working on long-term projects. The subtext could be that your boss no longer has faith in your abilities or doesn't want you seen as a respected member of her team. Short-term projects might mean you won't be around much longer.
The Cold Shoulder
Even if your boss isn't ready to lower the boom immediately, he may not be good at hiding his feelings. Avoiding eye contact or cutting short your attempts to talk are hints of trouble. You may be left out of team meetings or be dropped from the mailing list for team emails. If it leaks out that you're in trouble, your co-workers might shun you too, turning down lunch or drink invitations. They may feel their own jobs are safer if they're not hanging out with you.
If firing you isn't a spur-of-the-moment decision, your company will try to line up a replacement before handing you a pink slip. If you're asked to train one of your colleagues to cover for you in emergencies, that's normal. If your boss wants the co-worker to master all your core projects and important day-to-day work, that's much more ominous. If you hear rumors the company is talking to recruiters about filling your position, that's another sign you may not be there for long.
Turning It Around
If you see the writing on the wall, you can start lining up a new job before the current one disappears. If you'd rather stay where you are, you can try to save yourself. If your workload has changed, ask to take on a high-profile or long-term project to show you're still committed. Look at your boss's criticism and decide if it has some merit and whether you can overcome your weaknesses. If so, talk to your boss and tell her how you plan to turn things around. If your proposals don't get a favorable response, it may be too late.