The nutritional requirements of fish vary greatly depending on species, as well as age.
For example, juveniles require more protein and the carnivore is not properly cared for when mostly feeding greens.
Proper dietary selection also is determined on the eating times and habits of fish. Special consideration is needed for nocturnal fish, day dwellers, top feeders, bottom feeders, etc. Offering a variety of floating and sinking pellets should be a staple in any community tank. Alternate food options should be weekly regulars ensuring a proper diet.
Above all, think moderation and variety.
Always observe the fish during feeding. Little to no appetite indicates water problems (environment) or unhealthy fish (disease).
Dry foods come as flakes, granules, pellets, sinking, floating, and anything in-between. These are species-specific, off-the-shelf, ready-to-serve choices covering the basic nutritional requirements.
The freezer section of the pet store holds a wide variety of frozen treats. Starting from frozen shrimp, bloodworms, plankton, prawn, krill, beef heart, mussels, etc. They're usually available in special or variety packs. Veggies and spirulina are also available in freezer packs. The common pre-portioned cubes should first be dissolved, then strained before added to the aquarium.
A good alternate and healthy addition is salad, cucumber, zucchini, spinach etc. These can be clipped (using a veggie clip) to the side of the tank, or held in place near the substrate using the aquariums decor. Greens should be removed, or replaced, within 24 hours. Adding greens is a good way to keep fish from eating plants.
Besides shrimp popular live foods include feeder fish. Feeder fish are often fed to larger carnivores and should not be used regularly. Worms are available at bait shops, and some live food can be effortlessly cultivated at home.