I'm a super visual person, so when I was first learning this, an analogy that my professor used stuck with me: a picture with a frame. They drew a squiggly frame on the board with a person right in the middle. The person represented the action (preterite) and everything else was the context or setting of the action (imperfect). This imagery helped me distinguish between verb tenses by asking what the purpose of the verb was. Was is to provided context for an action or describe a thing/location/feeling in the past? --> imperfect OR Was is to describe something that took place and then ended? --> preterite
Examples
Imperfect:
Cuando era niña ..... when I was a girl
Cuando tenía diez años ... when I was 10 years old
Ese día, el cielo era claro y brillante. .... That day, the sky was clear and bright.
Preterite:
Me lavé los manos .... I washed my hands.
Encontré el anillo ... I found the ring.
Rompió la mesa ... He/She/You broke the table.
Imperfect with preterite:
El cielo era claro y brillante, pero de repente empezó llover .... The sky was clear and bright, but suddenly, it began to rain.
Yo sentía feliz hasta que me cortó el pelo ... I was feeling happy until I cut my hair.