Once your dog has learned a command, such as sit, it is important to start teaching them that they can sit in the kitchen where you taught it, outside or at the pet store. We believe in baby steps when training. Just because your dog is consistently sitting when asked in your home where you usually practice doesn’t mean you should jump straight to expecting them to understand and listen when you get to the busy dog park and ask them to sit for the first time. In order to properly generalize you will gradually add more distractions, add duration, or differing body language when asking the dog to perform the known command. Another helpful tip when it is a large step is to treat it like a new command again and using a high value reward (and make sure to reward right away just like when you first starting teaching them to the command). As you work on this with different commands you will notice they are quicker to generalize commands that you might not have spent as much time on.
A quick way to test how well your dog generalizes a command is to sit on the floor yourself and give your command. Does your dog listen or are they busy sniffing you and think “WOAH my human is on the ground - this is weird, is it play time”? Instead of going straight to the floor try giving the command from sitting in a chair. Your body language tells your dog a ton of things and they get used to seeing a specific image when you ask for each command. When first teaching a command you might notice your dog has troubles because you always stand up straight with your hands out in front of you to give a hand signal but your husband stands with his hands in his pockets. If you are the one that typically practices with the dog there is a good chance when your husband asks the dog to sit that it is confused at first as the visual image presented is different than what it is expecting to see with the command sit. This is where generalization comes in.
Below is a fun list that is a good way to practice and test how well your dog can generalize. It uses the command sit but you can work on this with any behaviour.