When these words refer to LOCATION:
"on" = "on top of", "on the front surface of" or "traveling for"
Ex. 1: "The cat is on the chair."
Ex. 2: "I watched the movie on TV."
Ex. 3: "He is on a business trip to Mexico."
"in" = "inside of" or "attending"
Ex. 1: "The dirty dishes are in the dishwasher."
Ex. 2: "Mr. Jones is in a meeting right now."
"at" = "near", "visiting", or it is used for events / entertainment (indoors or outdoors), or for locations where the purpose is more important than the building
Ex. 1: "The horses were at the trough, eating."
Ex. 2: "We had dinner at my friend's house."
Ex. 3: "John is at the movies right now."
Ex. 4: "I saw Mary at the post office."
With locations that have a specific purpose, you use "at" when you are talking about the purpose and "inside" when you need to talk about the building itself:
Ex. 1: "The children are at school right now." (purpose, i.e., education)
Ex. 2: "There was a fire inside the school today." (the building structure)
In English, there are always exceptions to the rule. But these are good, general guidelines that should help with many of your problems of usage.