We use the past perfect to describe actions in the past that happened before another completed action in the past.
When we arrived, they had left. (action 1. The people left. action 2. We arrived.)
It is pretty straightforward to construct the past perfect starting with the subject, 'had', followed by the past participle.
subject + had + past participle
She had finished her homework when we went out.
He had decided before we could talk to him.
They had gone by the time we arrived.
You can also use 'just' with the past participle to show that something was completed very recently.
I had just finished cleaning when they all arrived.
I had just got on the train when it began to leave.
I had just given up when the delivery finally arrived.
You can watch our video on the past perfect for more explanation on how and when to use this tense. Visit our write up pager for even more information and examples and a mind map to help you remember when it is used.