Generally a lot of that is up to you as the Dom. It is also partly down to your relationship with the sub. There is no right or wrong answer here.
A sensible Dom will never breach a hard limit without first negotiating it with the sub.
Punishment should be punishment, it should be something the sub hates doing/having done to them in order to teach them never to do it again. If they hate pain then spank them/whip them, if they love pain then never spank them or whip them unless it is in play and for fun. Most of the more effective punishments, however, are those that involve educating the sub - making them do a repetitive task like write lines, making them clean the toilet with a toothbrush or writing out an essay on what they did and why it was bad. Other punishments are things like cum restriction, sitting in the corner to think about their action, positons (like kneeling and/or using your nose to hold a coin to the wall) for long periods of time and so on.
You do need to distinguish between 'play' (doing things that are painful/humiliating but which the sub nevertheless enjoys) and punishment (doing things the sub does not enjoy).
As for how to decide a punishment... I always like to think that the punishment should fit the crime...
Some couples have contracts detailing misdemeanours and punishments as part of the 'what a sub needs to do for their Master' section.