If you’ve had a bad day or are having marital problems, your child is not the one responsible. Even if his behavior is part of the reason for your bad day, you need to remember who the adult is (that’s you) and remain calm.
But if you lose your cool, apologize, take some time to yourself to regroup, and move on. Tell your child that what you did is unacceptable. Then, come up with a code word or phrase to use for when you're about to lose your temper. It should serve as a signal to inform your child you need a few minutes to yourself.