Generally speaking, spices do not make good subjects for hermit crab food studies because most of them are extremely bug-repellent. You may have heard a bay leaf can be put in flour to keep out the weevils. Or I have poured a cinnamon barrier around my crab tank to keep out ants that were attracted to poppyseeds in my beachsand. If you decide to feed one of the rare spices that are known to be safe for crabs, please beware of the form in which you buy it because they often have anti-caking agents and other preservatives that could be harmful.
Basil is safe (see comment by Jedediah).
Parsley is safe. Dried parsley must be kept out of the sun to retain it's color.
Garlic is on the unsafe list.
Onion is on the unsafe list.
Several herbs are known to be safe for hermit crabs. Here are a few:
Chamomile (aka Manzanilla)
Stevia (trial conducted by LolaGranola; see comment)