git-commit
FreeNo executable scriptsNot checkedStage user-selected paths, confirm the exact staged set, and create one local Conventional Commit, or generate a commit message for staged changes without…
by microsoft★ 1,654 GitHub starsAbout this skill
Git Commit
Goal
Create one local Conventional Commit from whole paths the user selects and confirms, or generate a message for the currently staged changes without touching the index.
Inputs
mode(optional):commit(default) runs the select, stage, confirm, and commit protocol.message-onlygenerates a message for the staged changes and never stages, unstages, or commits.
Message Rules
Generate every message by following references/commit-message.md. It owns types, scopes, description and body limits, and the footer line. Once generated, the message is authoritative for the commit.
Message-Only Mode
- Read the staged changes with
git --no-pager diff --staged. Use the host's staged-changes tool instead when the user asks to avoid the terminal or no terminal is available. - When nothing is staged, output
No changes to commit.and stop. - Generate the message from the complete staged diff.
- Output the message in a fenced code block and tell the user to copy it as-is or edit it before committing.
Commit Protocol
- Inventory candidate paths. Before changing the index, run
git status --porcelain=v1 -z --untracked-files=allandgit rev-parse --verify HEADin the target repository.- Record tracked, untracked, deleted, renamed, copied, and initially staged paths. Treat only an
RorCstatus record that supplies both old and new paths as one logical selection. Present a separate deletion and untracked addition as independent candidates without inferring a rename. - If
HEADcannot be verified, stop, because this workflow cannot restore a rejected staging change safely. - If any path has both staged and unstaged changes, stop and ask the user to resolve its hunk-level intent outside this workflow. Do not restage a partially staged path.
- If there are no candidate changes, output
No changes to commit.and stop.
- Record tracked, untracked, deleted, renamed, copied, and initially staged paths. Treat only an
- Confirm whole-path intent. Present the candidate paths and their states without file contents, then ask the user to select the whole paths intended for this commit.
- Every initially staged path must be selected. If the user excludes one, stop before changing the index; never unstage prior user work.
- A status-reported rename or copy is selected only as its complete old-and-new path pair.
- If the selection is empty, ambiguous, unsafe to represent as shell arguments, or absent, stop without staging or committing.
- Stage only the selection with
git --literal-pathspecs add -- <safely quoted selected paths>. Never use an unscopedgit add -Aorgit add -upath.- Quote each path for the active shell and keep
--before path arguments. If a path cannot be represented safely, stop. - Record only the selected paths that were not initially staged as this invocation's staging delta.
- If staging fails, report a concise error and stop without retrying.
- Quote each path for the active shell and keep
- Inspect and confirm the staged set. Use the host's staged-changes tool, such as
get_changed_fileswithsourceControlStateset tostagedandrepositoryPathset to the full project path.- Verify that the exact staged path set contains every selected path, contains every initially staged path, and contains no unselected path. If it differs, restore this invocation's staging delta and stop.
- Present the exact staged paths without file contents or suspected sensitive values. Ask the user to confirm that these paths and their staged content are intended for the local commit.
- If the user rejects, does not respond, or gives an ambiguous answer, restore this invocation's staging delta and stop without committing.
- If no staged changes remain, output
No changes to commit.and stop without creating an empty commit.
- Generate the message from the staged changes and commit once, without showing the message first.
- Pipe the exact message, including body and footer line, through STDIN, for example
echo "<full message>" | git commit -F -. Preserve newlines exactly and end with the footer line followed by a newline. - Run no other Git command at this step (no push, pull, fetch, diff, show, status, log, branch, switch, merge, rebase, or tag).
- Pipe the exact message, including body and footer line, through STDIN, for example
- After the commit succeeds, print
Commit created successfully with the following message:, a blank line, and the full message in a fencedmarkdowncode block. - If the commit fails, for example because a hook rejects it, report a concise error with a suggested fix and stop without retrying.
Staging-Delta Restoration
- Restore only paths newly staged by this invocation with
git --literal-pathspecs reset -- <safely quoted staging-delta paths>. This resets their index entries toHEAD, preserves working-tree content, and leaves initially staged paths unchanged. - Treat both paths of a selected status-reported rename or copy as one restoration unit.
- If restoration fails, report the affected path names and stop. Do not retry or
Install git-commit in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
FAQ
What does the git-commit skill do?
Stage user-selected paths, confirm the exact staged set, and create one local Conventional Commit, or generate a commit message for staged changes without committing. Use when you want a guarded commit or a ready-to-paste message.
How do I install the git-commit skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the git-commit skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
by Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
by Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
by Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
by Anthropic