Here are some tips from the Centers for Disease Control and Prevention to prevent dog bites and scratches.
Always ask if you wish to pet someone's dog. And make sure the dog sniffed and saw you before you reach out to pet it.
Do not let young children play with dogs or family pets without supervision
Socialize your dog with a leash in public.
Do not disturb a dog while it is eating, sleeping or caring for puppies.
Do not continue petting a dog if it seems scared, sick or angry.
Do not encourage your dog to play aggressively or roughhouse.
Do not panic or make loud noises; never run from a dog or break up dog fights.