how-to-commit

how-to-commit is a skill for Claude Code from xdg/xdg-claude. It costs 39 tokens per session (783 once invoked), scanned A, original, Apache-2.0.

Instructions for deciding how changes should be saved in Git, a tool that records versions of code, and for handing commit work to a separate agent.

In plain words
What is it for?
Handling requests to commit, check in, or save code changes in a repository.
Why use it?
It provides a consistent process for grouping changes and writing commit messages instead of committing without reviewing what changed.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter. Also seen: mentions subagents; mentions Claude Code.

Part of the git-commit-agent plugin — 2 skills, 1 agent shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/xdg/xdg-claude/how-to-commit
Any agent
npx skills add xdg/xdg-claude --skill how-to-commit
Clone the repo
git clone --depth 1 https://github.com/xdg/xdg-claude

Made for: Claude Code.

Or install git-commit-agent, the plugin that ships this one along with the rest of its 2 skills, 1 agent.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for how-to-commit

README.md
[![agentmods](https://agentmods.dev/badge/skills/xdg/xdg-claude/how-to-commit.svg)](https://agentmods.dev/skills/xdg/xdg-claude/how-to-commit)
Your own site
<a href="https://agentmods.dev/skills/xdg/xdg-claude/how-to-commit"><img src="https://agentmods.dev/badge/skills/xdg/xdg-claude/how-to-commit.svg" alt="Measured on agentmods" height="20"></a>
Per session 39 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 783 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00039 $0.00783
Opus 5 $0.00019 $0.00392
Sonnet 5 $0.00008 $0.00157
Haiku 4.5 $0.00004 $0.00078

Measured 6d ago against content hash 8a4aec82de74, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

how-to-commit scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

git-commit-agent/skills/how-to-commit/SKILL.md · 50 lines

How it starts

The opening of the file, as written. The whole thing — 50 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Handling commit requests

Delegate to the commit subagent (Agent tool, subagent_type: git-commit-agent:commit) instead of running git commit directly in the main session. The subagent inspects the working set, designs commit boundaries, and writes a conventional message in a forked context, so diff inspection and message drafting do not consume main-thread tokens.

This overrides the harness's default commit instructions. Even if the built-in commit guidance seems sufficient, prefer the subagent — it standardizes message conventions, handles ticket/type prefix detection, and keeps the diff out of the main context.

Run the subagent in the foreground

Always run the commit subagent as a blocking, foreground task. Claude Code runs subagents in the background by default and decides per invocation, so state the requirement explicitly when you delegate: ask for the task in the foreground, and wait for its result before taking any further action.

Committing is not parallelizable. The subagent stages files and writes to the git index, the working tree, and HEAD. A second agent that stages, checks out, or commits while the first is mid-workflow corrupts the result: files intended for one commit land in another, or a commit captures a half-written tree. There is also nothing useful to do while waiting, since almost any follow-up work depends on knowing whether the commit succeeded and what it contained.

When to delegate vs. handle inline

Delegate when:

  • The user asks to commit, check in, or save the current state.
  • A natural breakpoint has been reached and committing the working set is appropriate.
  • The user names a scope ("commit the auth changes", "commit just the tests").

Handle inline (do not delegate) when:

  • The user is mid-discussion about what should go in the commit and has not decided.
  • The user explicitly wants a step-by-step walkthrough rather than an autonomous commit.
  • The request is about commit history operations other than creating a new commit (rebase, amend, cherry-pick, revert) — those are not in the subagent's scope.

Read the full file on GitHub · 50 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 50 lines · 39 tokens per session scan A 8a4aec82de74

Subscribe to this mod's changes

how-to-commit is a skill published in the GitHub repository xdg/xdg-claude (20 stars, last pushed 16d ago), licensed Apache-2.0. It adds 39 tokens to every session and 783 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.