When punishing children it is good practice to inform them what they did is wrong, why it is wrong, and what they can do better. If you can’t articulate these things, then you should examine why you are giving out a punishment in the first place
A lot of parents do not understand the difference between their emotional response to a misbehaving child and the lesson needed to actually fix the misbehavior. Consistent punishment without context breeds children fearful of trying anything new or angering peers. It is a slippery slope to child abuse.