Make sure the fish are active and interested in their surroundings. There should be no dead/dying/diseased fish in their tank
(or any tank on the same filter system), and they should all be a good weight and show proper colouring. You can also ask to see them being fed, to make sure they take an appropriate amount of interest in feeding (something I always do now). Choose fish that aren't being bullied, or bullying other fish, and basically just spend a good 5-10 minutes studying the fish you are interested in before commenting to buy. You can always ask to see the fish closer up in the bag too once caught
Unfortunately sometimes you can end up with a bad batch of fish, which isn't always necessarily down to the shop. Always make sure you get them home as soon as you can, and take an appropriate amount of time acclimatising them with the lights off before releasing them.