When creating an epitaph for a friend, or writing your own epitaph, there are five main things to think through.
1) A good epitaph is often very short.
Many great epitaphs are very short, even just one or two lines, as it forces the author to sum up a persons life in a concise manner - focusing on what is most important. Though it can be a beneficial limitation for other reasons, it was historically motivated by the difficulty and expense of hand carving small lettering into stone, and the physical size of the stone itself. Hand carved letters must be around 1" tall, and many craftsman charged by the letter - a tradition continued to this day by many monument companies, though modern lettering is now usually sandblasted using a much easier and efficient process. Unless you have a very large stone to work with, it is still difficult to fit more than a few lines of text on a tombstone, though an entire poem may fit on the back of an upright tablet monument.
2) A good epitaph makes an emotional connection.
An epitaph, much like art and literature, can invoke emotion in the reader. It seems best to celebrate a life and create joy, rather than focus on tragedy and create sadness - as the death of a loved one already creates sadness and mourning in those who loved them. Humor may also be a good way to help someone reflect fondly on the life of a loved one - especially if the deceased loved humor themselves. When writing ones own epitaph, reminding those who you will be leaving behind of the depth of love you have for them will surely create meaningful epitaph.
3) Reflect on and record the life lived
A good epitaph sums up the life of an individual. Any hobbies or interested that a person is especially known for is a great way to reflect on a life. When writing an epitaph for a loved one, recounting virtuous or inspirational character traits will celebrate a life in a meaningful way.
4) Who will be the voice, or the speaker of the epitaph?
An epitaph may be written in the first person, or from the perspective of a friend or family member. Typically, if writing your own epitaph, either writing in the first person, or leaving a general statement from a narrator is used. Deciding which is best is a matter of personality, and personal preference. If writing an epitaph for a friend or family member, it can be helpful to reflect on the type of person they were. If they were very outspoken, or known for any specific phrases or jokes, it may be beneficial to write an epitaph from their perspective, or even just using a memorable quote.
5) Who will be the reader of the epitaph?
Who is the epitaph prodominately written to? From you to a loved one? From friends or family to the deceased? From the perspective of the deceased to a passersby? There are many combinations, but ultimately this is a decision left up to personal preference. This will somewhat be dictated by whether you are writing an epitaph for yourself, or if you are writing an epitaph for a loved one.