Rule 1: Don’t be someplace you shouldn’t be, especially if it’s someone’s home.
Rule 2: Don’t be there at night.
Concur: Exodus 22:2 If a thief is caught breaking in at night and is struck a fatal blow, the defender is not guilty of bloodshed”