Commit
Create a git commit with resolved subject convention, Co-authored-by trailer, and surgical staging (no git add -A). Prefer bundled commit/commit-push-pr if it…
by melodic-software★ 34 GitHub stars
Install 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
About this skill
Commit
Pre-computed context
Exec-bit backstop: !bash "${CLAUDE_PLUGIN_ROOT}/skills/commit/scripts/exec-bit-check.sh" --probe 2>/dev/null || echo "unavailable — run the check manually"
Repository context. Probe the config layers
Before the layer probes, classify the config root with bash "${CLAUDE_PLUGIN_ROOT}/lib/config-root.sh" classify. For home or non-repo, report team and personal override as not applicable and skip the repo probes (../../reference/config-resolution.md, "The three layers").
The team value of the convention keys (subject_pattern, type_list, trailer_policy) comes from
docs/conventions/source-control.yaml, read when probe 1 below reports it tracked, through
bash "${CLAUDE_PLUGIN_ROOT}/lib/convention-key.sh" layer "$ROOT" <key>, which prints yaml or
none for a key; value and list print the YAML's value. The personal override,
docs/conventions/source-control.local.yaml, wins per key; local-value and local-list print
its value. Retired .claude/source-control.md, .claude/source-control.local.md, and
~/.claude/source-control.md files are not read. Report which layer supplied each value.
Run the repo-scoped probes as separate calls. Each uses git's repo-root-relative
magic pathspec :/, which resolves against the top of the working tree, so these are correct from
any subdirectory and never need the repository root substituted into them. Quote the pathspec,
the leading : is pathspec magic, and quoting keeps the shell from reinterpreting it.
- Team layer, trackedness.
git ls-files --error-unmatch -- ":/docs/conventions/source-control.yaml" - Team layer, existence.
git ls-files --cached --others -- ":/docs/conventions/source-control.yaml" - Personal override, existence.
git ls-files --cached --others -- ":/docs/conventions/source-control.local.yaml"
Probes 2 and 3 deliberately omit --exclude-standard, so a gitignored file is still listed.
Combine probes 1 and 2 in that order. Trackedness first, existence consulted only when trackedness comes back nonzero. They are not independent readings:
| Trackedness (1) | Existence (2) | Team-layer state |
|---|---|---|
| exit 0 | not consulted | present (tracked), this is a config layer |
| nonzero | non-empty output | present but UNTRACKED, deliberately not a config layer |
| nonzero | empty output | absent |
A nonzero exit from probe 1 is a result, not a failure: only a probe that could not run at all
(git unavailable, not a repository) yields an unknown value. Never fold present but UNTRACKED into
"unknown". Keep the git lines above out of ## Pre-computed context.
These are snapshots taken when they run, not substitutes for the checks. The exec-bit
line only sees what was already staged when the skill loaded; anything staged in step 2 below is
invisible to it, so step 4 re-runs the script for real. The config-layer probes report presence,
not merged content. Read the layers that are present and merge them per key. A tracked-team layer
reported present but UNTRACKED is deliberately not a layer: resolution requires the team file to
be git-tracked, so an untracked or gitignored file at that well-known path must not drive the
convention.
Every repo-scoped probe anchors at the repository root, via the :/ magic pathspec, never at
the session's current directory, and never with a resolved root path substituted in. The reasons
for each probe's shape are in reference/config-probes.md.
Per-commit checklist
Run this list for every commit, including the second and tenth commit of a session. These are commands, not remembered facts. Steps 3–5 are the ones a long session silently stops performing.
- Resolve the convention +
trailer_policyacross the config layers (once per session is enough; re-resolve if a layer changed). - Stage surgically by explicit path, after checking the four pre-existing conditions below.
- Format, run the discoverable formatter scoped to this commit's paths, re-stage its fixes.
- Exec-bit, run
exec-bit-check.sh --fix -- <this commit's paths>, after step 3. - Pre-check the drafted subject against the resolved pattern before invoking git.
- Fragments, in a repository with a
fragment-plugins.txtlist underscripts/, pipe the drafted message towrite-changelog-fragments.shand stage the paths it prints (Task step 7). - Commit via the Bash tool:
git commit -F -heredoc-piped,--trailerpertrailer_policy. - Report the resulting SHA + subject to the user.
Purpose
Encapsulates the canonical mechanic for building a commit message that honors a subject convention,
appending a Co-authored-by: trailer, and feeding the result to git commit via stdin, without
these failure modes:
- PowerShell here-string syntax (
@'...'@) inside a Bash tool call producesunexpected EOFand trigg
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
- evals/docs/conventions/source-control.local.yaml
- evals/docs/conventions/source-control.yaml
- evals/evals.json
- reference/changelog-fragments.md
- reference/config-probes.md
- reference/design-rationale.md
- reference/exec-bit.md
- reference/format-check.md
- reference/native-commit.md
- reference/pathspec-commits.md
- reference/staging-preconditions.md
- scripts/exec-bit-check.sh
- scripts/exec-bit-check.test.sh
FAQ
What does the Commit skill do?
Create a git commit with resolved subject convention, Co-authored-by trailer, and surgical staging (no git add -A). Prefer bundled commit/commit-push-pr if it resolves in this session only for generic or one-shot PR commits. Use when: 'commit this', 'make a commit', 'commit with message HINT'. Not for push or PRs: /source-control:pull-request.
How do I install the 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 Commit skill run scripts?
Yes, this skill bundles executable scripts. Review the source before installing.
Related skills
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis 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…