This is a fairly common OCD obsession, often complete with compulsions.
Let’s say that you believe Jesus, Mary, and God view you as a sinner and are waiting to strike you down with lightning; therefore, every time there’s a storm, you have to hide in a closet and count to seven three times in order to be safe.
The numbers people use are often typical numbers for a religious obsession, the number seven is often seen as lucky in our culture, and the number three is often used because of the trinity in the Christian religion. However, there is a flaw in this logic, if God is really all-powerful, then it does not matter what you count to or where you hide because that lightning is going to find you.
Most likely, you are not as afraid of what a higher power thinks of you as you are of what you think of yourself. The more negative you are to yourself, the more difficult it will be for you to stop doing the rituals, you will rely on them for relief from the obsessive thoughts.
You have to work on first accepting yourself, negative or sinful thoughts and all, and then recognize that you are probably not much different from anyone else you know, except for the fact that you treat yourself much more harshly, and then you use the threat of hellfire and damnation as a way to try to motivate yourself to be better.
This will most likely lead to only feeling worse, and the cycle of rituals will just continue.