Anger issues

My partner thinks I have hidden rage that I keep back a lot. We had an incident the other night where I slapped him for pulling a prank on me and scaring me. My partner understandably has concerns and is confused about me now.

My question is, how do I not respond to this rage or anger when it comes sometimes just auto-pilot? I’m very upset and feel like an awful person and I don’t know how to change this about me. I didn’t even know I was capable of doing something like this. I can’t believe I am/was capable of putting my hands on another person, especially my partner who I love and live with. What do I do? I’m so lost.

Thank you for your time.