In sri lanka there was a cultural practice developed to instill virtue and self-esteem: when children first started to attend school, their teachers would set a side a journal for each student, known as a 'merit book,' (punna-potthaka). And each morning the teacher could then ask a student 'What good deed have you done?" After the student would answer (perhaps "I helped my grandmother carry the groceries home…etc") the teacher could instruct the student to "Write it in the punna."
If the students kept up with the practice of writing regularly in their 'merit books', eventually, over the course of a lifetime, these journals would be filled up with good deeds. Naturally, the years pass and the time would arrive when the student became old and sick, having reached their deathbeds, family members and friends would gather around and read the books back to them, to put their minds at ease as they faced death.
To the degree that we've been conditioned by social factors, we may find our personal merit books thin of entries, while our minds are swamped with regret, opportunities missed. In such cases, we'll definitely fear death for, as the Buddha noted, nothing assuages that fear like a life well lived. (Note the Abhaya Sutta, which details the four practices that relieve fear of death.)
Fortunately, we can always start to build up a sense of one's merit, no matter how we've lived in the past. This requires us to determine how to relate to each other free of fixed judgments, long held suspicions, an accumulation of needless fears. We can put aside old wounds and make a long postponed phone call, we can volunteer or act from generosity. Breaking the ingrained habits that deter us from acts of integrity and grace are accomplished by sometimes requires us we have to drop our attachment to the past. If we reflect too often on our 'demerits' we can feel entirely disempowered; what's the point? This is the time when the empathetic friend is our best ally; for there comes a time when the only way we can put aside self-lacerating habits, over-exaggerating our faults, is when we hear that kind voice telling us that we did the best we could, while reciting aloud to us all the entries we've forgotten from those old merit book.