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"
Old config location (user-global, still read below team): !test -f "$HOME/.claude/source-control.md" && echo present || echo absent
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, skip the repo probes, and read only the old user-global file, when present (../../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. The retired .claude/source-control.md is not read. Report which layer supplied each
value.
Old locations. Until /source-control:setup apply moves them, ~/.claude/source-control.md
is still read below team, and .claude/source-control.local.md as the personal override while
probe 3 finds no personal YAML (beside it the old file is not read). Read the ## <key> sections
of each old file that applies, and for each one present tell the user once that it is an old
location and /source-control:setup apply moves it.
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"
- Old personal override, existence.
git ls-files --cached --others -- ":/.claude/source-control.local.md"
Probes 2 to 4 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 to
write-changelog-fragments.sh and 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
triggers fallback to writing the message to .git/<TEMP>.txt. .git/ is git's internal directory;
scratch files there collide with COMMIT_EDITMSG and other internals.
git commit -m "<multi-line>"flattens newlines unpredictably across shells.git add -A/git add .stages secrets, build artifacts, unrelated edits, the convention is
surgical staging.
Subject convention ladder
The subject convention (what shape a subject must take) resolves via a ladder, checked in order:
- The layered source-control convention config. Tracked team
(docs/conventions/source-control.yaml) and gitignored personal override
(docs/conventions/source-control.local.yaml), plus the old locations still read, merged per
key by