There is no generally accepted "rule". If there was, there would be too many exceptions. As for the old "i before e, except after c" rule, which today is excoriated, I will say this: it always helps me out when I cannot remember the spellings of words that I commonly use. The only exception is "weird".
One way to learn awkward spellings that I have found helpful is the method that my old English master taught me: when you can't remember the spelling of a word, look it up and write it out (in longhand) ten or twenty times. It will soon become habit (through muscle memory), and you won't need to think about it. However, this doesn't work so well with keyboards (I think), but it served me well enough in my youth. Today, we must rely on spell-checkers.
Before I had access to automatic spell-checkers, when I was typing and could not recall the spelling of a word, I would simply write it on a piece of paper. That would usually be sufficient to jog my memory, such is the power of muscle memory. Without my writing practice, that would not have been possible.