Commit Message Improver Skill
Take a vague commit message and the diff, return a Conventional Commits message that actually reflects the change. Useful for cleaning up a feature branch before merge, as a pre-push hook, or for bulk-improving a backlog of bad messages.
The Problem
"fix stuff", "wip", "more changes", "address feedback" — every repo has them, and they're worthless six months later when someone is doing git blame to figure out why a line was added. Conventional Commits make git log and git bisect actually useful, but the discipline is hard to maintain in the moment. AI fills the gap: rewrite the bad ones after the fact, using the diff as ground truth.
How It Works
- A
runtimeenvtask pulls one or more recent commits with their messages and diffs - The
commit-message-improverskill rewrites each into Conventional Commits format - The improved message is either printed for review (most common) or used to amend/rebase the commit (advanced — destructive, opt-in only)
Setup
- Install this skill
- Have a clone of the repo on the InTouch host
- Use the YAML below
Example YAML Job — single most-recent commit
name: commit-message-rewrite
version: 1.0.0
description: Rewrite the most recent commit message in Conventional Commits format
notifications:
- userNames: [intouch]
alertOnError: true
tasks:
- name: collect-commit
tool: runtimeenv
properties:
scriptContent: |
#!/bin/bash
set -euo pipefail
REPO_DIR="${REPO_DIR:-/srv/repos/myproject}"
cd "$REPO_DIR"
echo "originalMessage: |"
git log -1 --pretty=format:"%B" | sed 's/^/ /'
echo
echo "diff: |"
git show HEAD --no-color | sed 's/^/ /'
- name: improve
tool: skill
properties:
skillName: commit-message-improver
input: "{{collect-commit.output}}"
- name: report
tool: message
properties:
subject: "Improved commit message"
body: "{{improve.answer}}"
userNames: "intouch"
Bulk-rewrite mode (advanced)
To rewrite a range of commits in place, use git rebase -i with the AI's output. Doing this DESTROYS the original SHAs — only run it on a feature branch you have not pushed yet, never on shared history.
A safer pattern: have the job write the improved messages to a file alongside each SHA, and review them manually. Apply selectively with git commit --amend (for the most recent) or interactive rebase (for older).
Customization
- Pre-push hook — for the squeaky-clean-history workflow, wire this into a git pre-push hook that runs the job and prints the suggested message; developer edits then pushes
- Constrained scopes — pass a
scopes:list in the input matching your repo's modules so the AI doesn't invent scope names - Mass-fix old commits — collect commits in a range (
git log v1.0.0..HEAD) into one input and have the skill output a numbered list; review then apply
Safety notes
- This skill REWRITES messages based on the diff. If your diff is misleading (a feature commit accidentally bundled with a refactor), the rewritten message will be misleading too — the skill notes this in its WHY line, but the human reviewer is the safety net
- Never auto-apply rewrites to shared history without review
Cost
- AI assistant: ~$0.005 per commit with Claude Haiku for typical small commits
- Larger commits (>500 lines diff): switch to Claude Sonnet, ~$0.02 each