You cannot always prevent depression thoughts and feelings before it arises, but maybe you can stop the depression at the start or at least make the symptoms less significant and your depression more short-lived.
1. Have a "contingency plan".
It may contain advice to yourself about sleep and "thought grinder. If you sleep badly and lose energy, the tendency to overthinking increases. It can cause you to feel more depressed. You will learn to become aware of negative thoughts, you can avoid letting one negative thought tear along the other in thought mill. It prevents depression from amplifier itself.
2 Get professional help
Consult a healthcare professional if you are unable to get rid of the negative thoughts on your own. Get help themselves.
3 Ask yourself:
What was it that triggered the depression? Was there something I can influence? Then you can grab it and prevent depression again.
4 Avoid being by yourself and keep active
Being active together with other people improves self-esteem. A good self-esteem is important in efforts to prevent depression. The same applies to physical activity.