how do you not snap?

I have an almost 5 year old boy and lately, he's been getting on my nerves. We bond a lot lately, so I guess the time spent togethere also allows for more of his tantrums and wily ways to show up. It just unnerves me so much. It makes my blood boil that at times, I end up spanking him.

Then I feel like such a crappy Mom. Sigh ...

Suggestions are most welcome.