I simply try to catch myself before mistakes happen. I once made a thread here (okay, maybe it was one of a few) that I think some people laughed at me for, about how many mistakes one should allow themselves to make. The general response was, "You can control that?"
I thought it was something that yes, you could
control. Since I started studying Spanish, I've been very strict with myself as far as catching my errors and correcting them. If I'm not sure about something, I look for all avenues to find the right answer to a question I'm having.
I search WordReference forums, read through online dictionaries, ask trusted native speaking friends to explain things to me, apply a fair amount of educated guessing and checking... I also have an equally bull-headed tutor that doesn't let any mistakes slip by, and who, in our lessons, has very stringent requirements.
I've mentioned my experience with learning through school various times on this forum; however, I won't mention them again since repetition's a killer.
Instead, I'll just say this: I wouldn't have gotten as far as I did in Spanish up until 2018 if I hadn't spent some time teaching myself and holding to those ideas I mentioned. A lot of them I didn't even hold to until after I came to this forum! But I basically jumped a level in just under a year by mixing techniques I read about with my previous ones. Then I stuck to them.
But not many people, it seems (from my experience--I could be wrong), are willing to become human spell checkers or Grammarlies. Equally from my experience, though, it does save you a lot of time later.
Chin up! You can do it. Just do it your own way