Some chefs prefer to cook shrimp with shells on, to retain the shrimp's flavorful juices, as in Deviled Shrimp. The trick is to remove the digestive vein along the back of the shrimp without peeling off the shell. Here are two ways to devein shrimp with the shell on. (If the vein isn't dark, you don't need to remove it.)
Cut through shrimp shells along the top of the back with a small, sharp knife. Cut a shallow slit along the back of each shrimp through the opening and lift out vein with the tip of the knife. This method makes cooked shrimp easier to peel. Also, if you're marinating the shrimp, as in Deviled Shrimp, it allows more of the marinade to penetrate the flesh.
Alternatively, insert a toothpick or skewer between shell segments through back of shrimp, under and at right angles to vein. Gently pull up on toothpick and lift out vein (see photo). If vein breaks, repeat in several places. This technique maintains maximum juiciness in the shrimp.