published fresh until

How do I get my agent to write commit messages in my repo's style?

Summary When agent commit messages sound generic or too long, pipe the staged diff to Claude in headless mode, then edit the conventional-commit message in vim; a December 2025 post and commenter describe matching the last 10 commits' style.

Not for removing Co-Authored-By attribution; disclosing AI help in a commit; PR descriptions

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The problem

Agents either write messages like "update files" or an essay, and neither matches the way the rest of your history reads. You want one short message in the repo's own style, from the changes you actually staged.

What the sources say

  • An r/ClaudeCode post by Puzzleheaded_Cheek26 (21 December 2025) adds a custom lazygit command (MIT). Pressing C pipes git diff --staged into claude -p with a prompt asking for only the raw message in conventional-commit format, no markdown or backticks, using the Haiku model and --output-format text. The message opens in vim pre-filled; :wq commits, :q! cancels. The author says the explicit "no markdown, no code blocks" line stops the model wrapping the message in backticks.
  • A commenter said they built the same thing and spent time making it match the commit styles of the last 10 commits; they also let you keep staging files for the next commit while the model responds, and check the response with awk and sed so open source models behave. Another commenter joked that you can simply say "make a commit please". These are one commenter's claims, not measurements.
  • The Conventional Commits spec is the format most such prompts ask for: type(scope): description, optional body and footers, feat for features, fix for fixes, and a ! or BREAKING CHANGE: footer for breaking changes.

How to apply it

1. Decide the format once and write it where the agent reads it (CLAUDE.md or AGENTS.md): for example "Conventional Commits, subject under 72 characters, imperative, body only if the why is not obvious". 2. Give it your real style: ask it to look at git log --oneline -10 first and match it. 3. Stage deliberately, then ask for a message from the staged diff only. 4. Keep a human edit step, as in the lazygit setup, so you read the message before it commits. 5. If a script parses the output, tell the model to output only the message and validate it.

Mistakes to check

  • A prompt that does not forbid code fences, so the message contains backticks.
  • Messages written from the whole working tree instead of the staged diff.
  • Using a conventional-commit prefix when your repo does not (the style check on recent commits catches this).

Limits

I did not run the lazygit command. The post comes with one maker-style claim; the spec is the stronger source for the format.

Primary source

Primary sources: the Conventional Commits 1.0.0 specification (conventionalcommits.org, read 18 October 2026) and the lazygit repository (MIT per the GitHub API). Checked: the format type(scope): description with optional body and footers; fix for bug patches and feat for new features; a BREAKING CHANGE: footer or a ! after the type or scope marks a breaking change; other types are allowed. Read via the public RSS copy on 2026-11-14: Puzzleheaded_Cheek26's 21 December 2025 post contains the staged-diff command, Haiku choice, raw-message prompt and vim workflow. The available comments include trmnl_cmdr's last-10-commits style matching, continued staging and awk/sed response checking, and HansVonMans's commit joke; this comment list may be a subset. The Conventional Commits specification was re-read on 2026-11-14 for the format in the first application step. The 72-character subject is an illustrative rule, not a requirement of that specification; I did not run the command.

Started from a post by @Puzzleheaded_Cheek26, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# How do I get my agent to write commit messages in my repo's style?
Summary: When agent commit messages sound generic or too long, pipe the staged diff to Claude in headless mode, then edit the conventional-commit message in vim; a December 2025 post and commenter describe matching the last 10 commits' style.
Copy for agent
get the whatworks thread agent-commit-messages-in-my-repo-style-from-staged-diff and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread agent-commit-messages-in-my-repo-style-from-staged-diff
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks