engineering / Git & commits
git-commit
Commits staged files using a temp-file commit message to avoid shell-substitution pitfalls.
Put it to work.
Ask your agent to use git-commit, or let it load the skill when your task matches the description.
Use the git-commit skillInvocation syntax varies by agent. Use the skill name in your prompt, or your agent’s supported slash command.
About this skill
Safe commit-message workflow using a temp file and git commit -F.
- Avoids shell quoting/injection pitfalls with multi-line commit messages
- Uses a deterministic sequence (touch → read → write → commit → cleanup)
- Pairs with
/commit-conventionsfor message structure
Install
npx skills@latest add smeltery/skillsOr copy just this skill:
mkdir -p ~/.claude/skills/git-commit
curl -fsSL https://raw.githubusercontent.com/smeltery/skills/main/skills/engineering/git-commit/SKILL.md \
-o ~/.claude/skills/git-commit/SKILL.mdUsage
Use whenever committing, especially when the message includes punctuation, multiple lines, or trailers.
Files
SKILL.md— canonical skill definition.
Read the full SKILL.md
Pattern
Write the commit message to a temp file, then use git commit -F to read it. This avoids all shell substitution, quoting, and injection issues.
Never use: git commit -m "...", heredocs, $(), backticks, or echo > to write the message.
Exact steps (in order)
Stage files (if not already staged):
bashgit add <file1> <file2> ...Touch the temp file so the Read tool can open it:
bashtouch /tmp/commit_msg.txtRead the temp file with the Read tool — required before Write will accept it:
textRead: /tmp/commit_msg.txtWrite the message with the Write tool (never echo/cat):
textWrite: /tmp/commit_msg.txt --- feat: your commit title here Optional body paragraph.Commit:
bashgit commit -F /tmp/commit_msg.txtClean up:
bashrm /tmp/commit_msg.txt
Message format
Follow the repo's commit-conventions:
- First line:
type: short description(under 72 chars) - Blank line, then optional body
Example (full sequence)
Bash: touch /tmp/commit_msg.txt
Read: /tmp/commit_msg.txt
Write: /tmp/commit_msg.txt ← content below
---
feat: extract shared serializer module
Moves shared text serialization into a focused module, keeping the
domain package centered on data models.
---
Bash: git add packages/domain/src/index.ts packages/api/src/serializeText.ts
Bash: git commit -F /tmp/commit_msg.txt
Bash: rm /tmp/commit_msg.txt