You cannot do much to avoid shingles. It is not caught from contact with someone with shingles or with chickenpox.
If you have shingles you should stay away from other people until the blisters have dried (usually about seven days), as there are virus particles in the blister fluid. The risk is that people who have not had chickenpox might catch that from you.
Those at particular risk are people whose immune system is not functioning normally (who are immunocompromised), as for example in people on steroids, chemotherapy for cancer or those with transplants or with AIDS, so do try to avoid contact with people in these categories if you have shingles.