In Japan, people change departments quite often, and each time you have to write a farewell message for the people who leave, so you get in to the habit of writing these sorts of cards. After seeing these things from hundreds of people (and having received them myself several times), the 'safest' pattern I see is:
- Express your gratitude for having had the chance to work with the person
- Point out a specific instance you appreciated them
- Wish them the best of luck on their future adventures
Thanks for working together
General gratitude is very straightforward, doesn't require any specific knowledge, and it is a nice positive message. You can go at it from several different angles, but at the end of the day you just want to make sure it is positive and actually reflects what the person did. For instance:
It's been a pleasure working with you on Project X over the last Y months -- the experience and skills you brought to the team made the project run more smoothly.
Feel free to comment on any general positive trait from skills, to experience, to positive attitude -- whatever fits best.
Specific Thanks
Even if you don't know the person well, you probably wouldn't be invited to write something on a card if you had never interacted with them at all. This doesn't need to be work-related, it can be anything positive and personal. For instance:
While it was a great experience working with you, I'll especially miss your restaurant recommendations -- the Thai place you recommended has been a hit with everyone I've taken there, and makes me look like I know more about food than I do!
Of course, it could also be work-related, for instance:
I really wanted to thank you for that time you helped me with that pesky bug I was struggling with. Thanks to your help teaching me how to debug that part of the legacy code, I've been able to lessen my daily frustration, and am grateful you took the time to teach me how to do that on my own.
The goal is just to point out that you have some personal positive experience with the person, and letting them know that it was appreciated (even if you didn't say much but 'thanks' at the time). Everyone loves feeling appreciated.
Wish them luck
Finally, you want to wish them the best of luck on their transfer/new job/change in careers/whatever. No need to be over the top, just a simple well-intentioned "Good luck!" will work, for instance:
I wish you the best in finding even more success in your next position. From working with you here, I am sure you will be a great fit. The world is a small place, and I hope that we get the chance to work together again in the future.
If they are leaving the job for something entirely different (stay-at-home parent, going back to school, starting their own business, etc.), wish them the best of luck in the change of pace, or anything that is positive and says, "Things change, but don't worry, you'll do great!"
Things not to do
No matter what you do, try to avoid the following pitfalls:
- Don't be negative
- Don't try to convince them to stay, or indicate that they made the wrong decision
- Don't be insincere
The person will likely read the card once or twice, and just wants to come away feeling good. You just want them to come away with a smile, so there's no need to be particularly profound on the card. Even if you know the person very well, the farewell card isn't the right place for honest feedback or oversharing, as other coworkers will likely read what you wrote, and if you're that close you can share the same info over a beer without any of the problems writing it down on a card may bring.