For an individual, the answer is hand washing with regular soap, an intact epidermis, and good sanitation habits.
Hand washing with soap removes dirt, skin oils, and the bacteria that cling to them. We pick up bacteria (and also viruses) from virtually everything we touch. It is normal to have bacteria on your skin, and the vast majority of them are harmless; however it's easy to pick up and transmit a harmful bacterium and not realize it. Therefore hand washing, particularly after handling anything that is likely to contain such bacteria (diapers, raw meat, trash) or before using your hands to do something sanitary (removing a contact lens, serving food, feeding a baby) is the first line of defense against spreading bacteria.
Your epidermis is a very good barrier to bacterial infection as long as it is intact. Cuts and other injuries should be cleaned and kept covered.
Good sanitation habits would include hand washing, not putting things in your mouth, and keeping your hands away from your face, since the membranes of the nose, mouth, and eye socket are common points of entry for bacteria and viruses.