Files
claude/skills/commit-change/SKILL.md
T
bastien d82c06f572 refactor(doctrine): C2 coherence — 30 doctrine/skill tensions resolved, doctrine wins (BDR-099)
One ask policy; mandated executors exempt from the delegation rule; skill plan satisfies the planning rule; journal line exempt from the approval gate; chore = maintenance without new behaviour; small fix on develop = bugfix; BDR-068 written as the one auto-finish exception; deploy routes to /deploy. Skills and agents follow: hotfix types by base + skips the design gate on trivial; capitalize/close create missing registries; commit-change asks the branch type; doc/seo/web-validate/refactor branch through the aiguillage; tour reports BREAKING fixes as needs-decision and runs doc-syncer two-mode; client-handover applies audit bundles from its main loop behind one gate; init-project/onboard use the 200-file graphify signal and bootstrap memory; release-candidate gates the tag push only; push wording aligned with the BDR-095 hooks; stale pointers fixed (§ Language, .gsd/ROADMAP.md, handover script path, design-gate lists).
2026-09-24 20:25:40 +02:00

5.2 KiB

name, description, allowed-tools
name description allowed-tools
commit-change Analyze all pending changes (staged, unstaged, untracked) and create atomic commits grouped by logical unit, retracing the work. Any git repository. Triggers: "commit my changes", "smart commit", "auto commit", "commit everything", "analyse et commit", or any variation of committing messy pending work intelligently.
Bash
Read
Grep
Glob
Agent
AskUserQuestion

/commit-change — propose → confirm → apply dispatcher

Grouping (propose, model="opus" override — judgment) and committing (apply, sonnet pin — mechanical) both run on the dispatched commit-changer subagent (dispatch makes the pin effective). No inline reflection happens in this dispatcher to protect, so there is no model gate. This dispatcher owns the two approval gates that used to live inside the subagent: commit-plan approval and capitalize approval — the subagent never asks; MODE: propose only proposes, MODE: apply only executes what this dispatcher confirms. Never auto-commit blind — a wrong group is harder to undo than not committing.

STEP 0 — Pre-flight (STOP conditions, before any dispatch)

git rev-parse --abbrev-ref HEAD                        # "HEAD" = detached
git status --porcelain=v1 | grep -c '^\(UU\|AA\|DD\|AU\|UA\|DU\|UD\)'   # ALL unmerged porcelain codes
git status --porcelain=v1 | wc -l                       # nothing pending?
git config user.email
  • Detached HEAD → STOP, report the state, do not dispatch.
  • Any unmerged conflict entries (UU/AA/DD) → STOP, tell the user to resolve conflicts first, do not dispatch.
  • Nothing pending (git status --porcelain empty) → STOP, tell the user there's nothing to commit.
  • git config user.email empty → STOP, ask the user to configure identity first, do not dispatch.

On a protected base (main/develop — bash "$HOME/.claude/lib/gitflow.sh" protected-base) ask the user the branch TYPE before any dispatch — a branch name is a public name:

AskUserQuestion:
  Protected base — branch type for these commits? (feature / bugfix / chore)

Suggest chore only when every pending path is under .claude/** or docs; pending code never lands on a chore/* branch. Pass the answer as TYPE: <type> in the STEP 1 prompt — the subagent runs the aiguillage with it inside MODE: propose (its Phase 0) and branches to <type>/* before drafting the plan. Code never lands directly on a protected branch. On a working branch, omit TYPE: (the aiguillage is a no-op there).

STEP 1 — Propose

Agent(subagent_type="commit-changer", model="opus")
prompt: "MODE: propose
TYPE: <the STEP 0 answer — feature / bugfix / chore; omit on a working branch>
$ARGUMENTS"

(model="opus" — BDR-077: propose = narrative reconstruction + capitalize routing, judgment tier; the call-site override takes precedence over the sonnet frontmatter pin. Apply, STEP 4, stays on the pin.)

Read the returned COMMIT PLAN + EDGE CASES + CAPITALIZE CANDIDATES, terminated by READY TO APPLY — awaiting dispatcher confirmation.

The subagent reported BLOCKED: unresolved merge conflicts... instead of a plan (a race with STEP 0) → STOP, surface it, do not proceed.

STEP 2 — Gate 1: commit-plan approval

Show the COMMIT PLAN and any EDGE CASES verbatim, then:

AskUserQuestion:
  Approve the commit plan? (all / <numbers> / edit <n> / skip)
  • all → every step in the plan is approved as-is.
  • <numbers> (e.g. 1,3) → only those steps are approved; the rest stay uncommitted for a later run.
  • edit <n> → re-dispatch commit-changer with MODE: propose and the user's correction for step N folded into the prompt, so all grouping / message judgment stays on the dispatched propose mode (model="opus", BDR-077 — never redrawn inline on the session model); show the redrawn plan and re-ask.
  • skip → exit cleanly, no commits created, no MODE: apply dispatch. Note: if the propose run created a <type>/* branch (gitflow aiguillage off a protected base), that branch stays checked out with the work uncommitted — mention it so the user isn't surprised by the branch switch.

STEP 3 — Gate 2: capitalize approval

If the STEP 1 output said CAPITALIZE: nothing to log, skip this gate — treat the capitalize entries as none and go straight to STEP 4.

Otherwise show the CAPITALIZE CANDIDATES block, then:

AskUserQuestion:
  Valider les entrées mémoire ? (all / <IDs> / skip)
  • all → every candidate entry is approved verbatim.
  • <IDs> (e.g. BDR-041,LRN-019) → only those entries are approved.
  • skip → no memory write; MODE: apply still runs for the code commits.

STEP 4 — Apply

Agent(subagent_type="commit-changer")
prompt: "MODE: apply
APPROVED PLAN: <the STEP-2-approved steps — numbers, messages, files,
  exactly as confirmed, including any edits>
APPROVED CAPITALIZE ENTRIES: <the STEP-3-approved entries verbatim, or none>"

Parse the COMMIT-EXEC REPORT:

  • STATUS: DONE → report the COMMITS + MEMORY hashes to the user.
  • STATUS: BLOCKED → surface the blocker verbatim and stop. Do not retry automatically — a blocked step (e.g. one file needs an interactive git add -p split) needs a human decision.