Have you ever held a grudge for years? Grudges can be good, actually, and we should hold onto some of them. We don’t often associate the holding of grudges with virtuous people, but that could change.

Sophie Hannah, who wrote “How to Hold a Grudge,” loves them. Hannah, who is not a psychologist, used her personal experience — and lots of therapy over the years in which she discussed her grudges in detail — to write this book.

Here is her system of enlightened grudge keeping to process your pettiness.

• Redefine the word “grudge” as an experience to learn from.

Hannah isn’t in the habit of redefining words. “But there’s no dictionary definition I can find that doesn’t describe a grudge as a negative feeling, or a collection of negative feelings,” she said.

The crucial difference in the way Hannah views grudges is that she believes a grudge is not a feeling. Rather, it’s a story that one can learn and benefit from. “When there’s some kind of suboptimal thing that somebody has done to us, the grudge is our story that we remember about that incident, because it benefits you to have that story remembered.”

• Treat your grudges like protective amulets.

Sweeping bad behavior under the rug and pretending it didn’t happen will only expose you to more of the same. A lively grudge can both console and validate — it can create space for you to acknowledge that something bad happened to you, and that it matters.

Say you have a friend named Fred. Fred gets very drunk and is a mess. If you hold a grudge against sloppy Fred because he has been a messy drunk in your house, you don’t have to stop being friends with him. You can, however, acknowledge your grudge by protecting yourself and meeting him at a bar instead.

• Write down your grudges so you can remember how you felt.

The act of “constructing a grudge story,” as Hannah calls it, provides space to analyze what happened. Perspective gained by the writing and grading process helps to make negative feelings more manageable. “We’re getting it out of ourselves so we’re not stuck in a feeling,” Hannah said.

• Make a “grudge cabinet” where you can file things.

Turn your grudges into artifacts and have a place where you can store them (which may be a Google Docs folder). “The more concrete they are, the more they will protect and inspire you,” Hannah said.

• Use your grudge stories to forgive and make you a better person.

Like a set of resolutions or goals, grudge stories can be motivating. They can inspire us by defining values that are important to us; if, for example, someone is very rude and you form a grudge about that behavior, it may inspire you to be more courteous.