I've heard miltiple ways of thinking about it, but I think this one was most helpful for me.
に is used like a target, motioning towards a direct location. Like "家に帰る," which is saying "I return home," (home being a specific location). に is also used when talking about a time something is taking place. For example, "8時に、学校へ行く," meaning "At 8:00, I go to the school". (If you dont know, へ, pronounced え in this situation, is used like に but more general and focusing on the journey more than the actuall destination).
で basically denotes a place at which an event is taking place. For example "家で勉強した", meaning "I studied at home". Home is the place where you are studying.
は and が are very similar, but different in nuance. I like to think of it as が puts the emphasis on the subject (which is the word before the が), while は puts more emphasis on what comes after. for example, somebody might say "私が強くなった", basically putting emphasis on 私 and saying "I*** became strong", whereas a less cocky individual may say "私は強くなった", translating to "I became strong".
Don't worry too much about following the exact definitions or usages shown in the dictionary, the most important thing is to listen and observe, and you'll catch onto a pattern even if you don't realize it. I hope this gave you a basic idea of what to look out for, and I apologize if I got some things wrong. Good luck! :)