Worms are in soil, so chickens will pick up the eggs. It helps to keep them on grass, and let them free range. If they are confined to a coop and run, keep it as clean and dry as possible. There is a lot of misinformation about so called preventatives. When I joined BYC, a lot of people were saying that ACV, cayenne pepper, and pumpkins seeds would prevent worms. No scientific data to prove that. I tried those, but the best things are keeping your chickens in a fairly clean and healthy environment. Keep your bedding stirred, dry, and add to it as needed. Change it before you have an ammonia odor. Clean water daily, clean food, etc.