"Passé composé" is for an action that's finished. Usually, you know something precise about the time it happened.
"Imparfait" is for a habit or description in the past. It can be the background for something else that happened in the "passé composé". It replaces "used to" or "was ...ing", usually.
For example:
I used to play the piano as a kid.
Je jouais du piano quand j'étais jeune.
It was snowing when I arrived.
Il neigeait quand je suis arrivé.
It was sunny and hot.
Le temps était chaud et ensoleillé.
I watched TV and then I went to bed.
J'ai regardé la télé puis je me suis couché.