I'm part of a small infrastructure team, and a surprising amount of my day is short messages: "can you look at this MR", "is staging free", "did the migration finish". I already work with Claude Code most of the day, so I wanted it to send those messages for me.
The first drafts were the problem. I'd ask for a one-line question, and the agent would write five paragraphs: what the MR changes, why, which files it touches, the risks, a bulleted list of "key considerations", and a closing "let me know if you have any questions!" Every word was accurate, and nobody read it. It was too long and too technical, and it looked like AI slop, so people skimmed past it or left it for later. A question my colleagues would have answered in a minute sat there for hours.
What I needed was the message I would have typed myself: "can you check the staging plan on !885 when you get a minute? no rush".
So I wrote mattermost-dm, an agent skill and a small Python script that sends Mattermost DMs as you. Sending is the easy part. Most of the skill is about making the messages sound like the person who sends them.
A style guide for one person
The skill reads a file called voice.md before it drafts anything. It's a short style guide, written about you, for the agent. The template covers the habits that make a message recognisably yours:
- Length: one line, or two or three short ones.
- Capitals and punctuation: sentence case or all lowercase, a full stop at the end or not.
- Asks: "can you … please?", "when you have a minute, …".
- Warmth: "thanks!", a smiley now and then, or none at all.
- Words you use often: "btw", "FYI".
- Links and tickets: a bare URL, or a linked ticket number followed by its title.
- Don't: the things you never do, like formal sign-offs, long explanations, or bold.
The template also asks for one example of a first message of the day, because a single example shows the shape faster than any list:
good morning
can you check the staging plan on !885 when you get a minute? no rush
The "Don't" list does the most work against slop. Agents add things: background nobody asked for, bullet points, bold, a summary of what they just asked, a "let me know if you have any questions". The guide says what you never write, so the agent knows what to leave out.
The skill also has a few rules of its own, whatever your voice: lead with what you need, then add one or two lines of context at most. Don't invent dates or promises, and don't use review-speak like "the part worth your eyes". Always link a ticket or MR, so the reader can click through for the detail.
Git ignores voice.md, so it stays on your machine. Without it, the skill falls back to short, friendly, plain messages, written like a note to a teammate.
Learning the voice from your own messages
Writing a style guide about yourself is hard, because you don't notice your own habits. The faster route is to let Claude Code read how you actually write.
mm-dm --history <person> --days 90 prints your DM with one person. The README suggests this prompt:
Run mm-dm --history <name> --days 90 for each of these people: <names>.
Learn only from messages I wrote. Draft voice.md from voice.example.md. Describe my habits for
length, capitals, punctuation, greetings, asks, warmth, common words and links, and what I never
do. Copy my habits, not my typos. Don't include real names, projects, clients or quoted messages.
Show me the draft before you save it.
A few lines in that prompt carry most of the weight:
- Three to five people, across different kinds of work. You write differently to a close teammate than to someone in another department, and the guide should cover both.
- "Copy my habits, not my typos." Without this line, the agent faithfully reproduces your mistakes.
- No real names or quoted messages. The guide describes patterns with invented examples, so it doesn't turn into a copy of your private conversations.
Then read the draft and fix anything that doesn't sound like you. Ask for a few test messages and adjust the file until you'd send them without editing.
There's a trade-off to know about: --history prints both sides of each conversation, so your colleagues' messages reach your AI provider while the guide is drafted. Check your company's policy and choose conversations with nothing confidential in them. If that isn't possible, write voice.md by hand from the template.
Greetings are part of the voice
Voice isn't only wording; it's also rhythm. Nobody says "good morning" to someone they messaged ten minutes ago, and nobody skips a greeting after a week of silence.
Messages start with a {hi} placeholder, and the script fills it in from your real history. It asks Mattermost when you last posted in that DM. If you haven't spoken today, or it's been more than 4 hours, {hi} becomes a greeting. Otherwise it disappears, along with the blank line after it. In a batch, this happens separately for each person.
The greetings themselves are yours too. Add your own lists to ~/.mattermost, one for the morning and one for the afternoon:
MM_DM_GREETINGS_AM="good morning|morning :)"
MM_DM_GREETINGS_PM="hi there|hey|good afternoon"
The script picks one per person per day and keeps it, so you don't greet the same person three different ways in one morning.
Batches use {first_name}, so a question to five reviewers still reads as five personal messages:
{hi} {first_name}
can you review the runbook change before Friday's maintenance?
You still see every message
A good voice makes approval quick, but it doesn't replace it. Every message goes through a preview first: mm-dm --dry-run renders each message, greeting and name included, and Claude shows them to you. When you say yes, mm-dm --send-pending sends exactly what the preview printed. It doesn't take new text, so nothing gets reworded after you've read it. Each preview sends once, and it expires after an hour.
The token stays out of the conversation as well. The script reads it from ~/.mattermost and never prints it, and the skill tells Claude not to open that file.
Install
git clone https://github.com/abdallah/mattermost-dm.git ~/.claude/skills/mattermost-dm
touch ~/.mattermost && chmod 600 ~/.mattermost
cp ~/.claude/skills/mattermost-dm/voice.example.md ~/.claude/skills/mattermost-dm/voice.md
Add your server and a personal access token (Profile > Security > Personal Access Tokens) to ~/.mattermost:
MM_URL=https://chat.example.com
MM_TOKEN=your-token
Then edit voice.md, or ask Claude Code to draft it from your history. It needs Python 3.9 or later and has no other dependencies. If you use more than one machine, copy voice.md to each one yourself, because Git doesn't sync it.
Beyond Mattermost
The script is specific to Mattermost, but the idea isn't. Any agent that writes as you, whether it's emails, ticket comments, or commit messages, benefits from a short, private file that describes how you write and, more importantly, what you never write. Draft it from your own messages, then correct it until the test messages sound right.
The code is MIT licensed: github.com/abdallah/mattermost-dm.

Top comments (0)