Present perfect is used for the nearest past, like I have just comment on italky. Past perfect is for the past nearer than the simple past, like I had written my notes when my cat ate my paper note. So, I write the notes before my cat ate it.... I hope it's clear to you :)