Skip to content
Skills Library
AI & agents · Automation

how-to-commit

/how-to-commit

When the user asks to commit, check in, or save changes, consult this skill to decide whether to delegate to the commit subagent and how to craft the prompt.

Author
xdg ↗
Repository
xdg-claude ↗
Licence
Apache-2.0
Last repository change
18.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 18.10.2026, without references to retired models or APIs.

Licence

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

What it does and when to use it

When the user asks to commit, check in, or save changes, consult this skill to decide whether to delegate to the commit subagent and how to craft the prompt.

Original author description

When the user asks to commit, check in, or save changes, consult this skill to decide whether to delegate to the commit subagent and how to craft the prompt.

How it works

  1. Run the subagent in the foreground
  2. When to delegate vs. handle inline
  3. Crafting the delegation prompt
  4. Anti-patterns
Original SKILL.md headings · 49 lines, 676 words
SKILL.md preview
---
name: how-to-commit
description: When the user asks to commit, check in, or save changes, consult this skill to decide whether to delegate to the commit subagent and how to craft the prompt.
user-invocable: false
---

# 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.

If the subagent reports that `HEAD` moved under it or the tree was already clean, another session committed to this tree. Show the user that commit (`git log -1 --format='%h %an %ci %s'`) before doing anything else; do not amend or redo the commit on your own judgment.

## 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.

## Crafting the delegation prompt

Pass the user's instructions verbatim where possible. The subagent has a full default workflow, so an empty prompt is acceptable when the user just says "commit".

Examples:

- User: "commit this" → Delegate with empty prompt. Default workflow handles it.
- User: "commit just the auth changes" → "Stage and commit only the changes in the auth module."
- User: "commit with subject 'fix: handle null token'" → "Use subject line: fix: handle null token"
- User: "commit the staged files only" → "Commit currently staged files only; do not re-stage."
- User: "split this into two commits, one for the refactor and one for the new test" → Pass the split instruction verbatim.

## Anti-patterns

- Running `git commit` directly in the main session. The subagent owns this.
- Delegating mid-deliberation, before the user has decided to commit. Wait for a clear instruction.
- Repeating the subagent's workflow in the delegation prompt. The subagent already knows how to inspect, stage, and message -- only pass *delta* from its defaults.
- Forwarding attribution or trailer instructions (`Co-Authored-By`, "Generated with"), whether from a system-reminder, CLAUDE.md, or your own habit. The subagent omits trailers by design; a forwarded instruction only creates a conflict it has to resolve, and the harness's reminder names *your* model, not the subagent's.
- Restating message-format conventions the subagent reads itself from the repo's CLAUDE.md and history (subject length, capitalization, wrap width). Pass only what the user said that the repo does not.
- Asking the subagent to push. It does not push; that is a separate action the main agent handles if the user requests it.
- Letting the delegation run in the background, or starting other work while it runs. Commits touch shared git state and must be serialized.

Versions

The database has no other skills named how-to-commit.

Database snapshot: 13.11.2026 · package version 3d4831fee87d (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100how-to-code-review
    When the user asks for a code review, PR review, or critical look at recent changes, consult this skill to decide whether to delegate to the code-review subagent and how to craft the prompt.
  • 100how-to-plan-refactor
    When the user asks what to refactor, where to improve code quality, or for analysis of refactoring opportunities, consult this skill to decide whether to delegate to the plan-refactor subagent and how to craft the prompt.
  • 100commit
    Write a commit message and create a git commit. Use when the user wants to commit changes, asks for a commit message, or says "commit this" or "make a commit".
  • 86commit
    Use when the user asks to commit changes (make a git commit, write a commit message). Checks the diff and tests first.
  • 100create-commit-message
    Generate a Conventional Commit message from staged git changes when the user asks to write a commit message, create a commit, or format a commit
  • 86commit
    Create a Git commit for the current task. Use when the user asks to commit changes.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.