In the forum X, when your post get deleted, a message notification will be sent to your inbox with popular reason: "Off topic". It won't help you understand what/where you're wrong. Here's what I can elaborate on your idea: giving reason for deleting post.
When a moderator delete a post, a box shown up like this:

When a reason is given and the deletion is confirmed, it should be shown like this:

The same procedure can be applied when
giving negative karma