claude-skills/engineering/commit-craft/commands/cs-commit-craft.md
Claude d233831cc6
feat(engineering): commit-craft, a clean commit series from a mixed tree
Issue #1004 named a real gap: agents leave large mixed diffs, and
nothing in the catalog shapes them into commits before they exist.
Built independently from public sources.

- commit_planner.py groups the working tree in build-safe order
  (manifest with lockfile, moves, formatting, each change with its
  tests, docs, CI), holds back .env/keys/tfstate, and flags a move
  whose callers' import edits sit in another commit, because that
  commit would not build. A plain mv is detected as a rename.
- secret_gate.py blocks staged or pushed secrets, sensitive files and
  conflict markers with redacted output and reasoned waivers. On 174k
  lines added to this repo it raised 7 findings, all fake fixtures.
- message_linter.py blocks vague subjects, large changes with no why
  and fixup commits, and enforces Conventional Commits only where the
  repo already uses them.

Standalone plugin at 2.14.5, mirrored into engineering-advanced-skills
(bumped to 2.14.8, above the unreleased 2.14.7 on dev). The
bundle's G12 baseline grows by the new skill's 279 listing chars.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L8KYFJm9vze5Kqnyb5yvFs
2026-10-31 06:36:29 +00:00

29 lines
1.3 KiB
Markdown

---
disable-model-invocation: true
description: Turn the current working tree into a clean commit series - plan the groups, gate each one for secrets, write messages that say why, and lint the series before push.
argument-hint: "[repo path] [--push]"
---
# /cs-commit-craft
Turn the uncommitted work in `$ARGUMENTS` (default: the current repo) into a reviewable series.
```bash
python ${CLAUDE_PLUGIN_ROOT}/skills/commit-craft/scripts/commit_planner.py
# for each planned group, in order:
git add -- <files> # git add -p -- <file> for MIXED_FORMATTING files
python ${CLAUDE_PLUGIN_ROOT}/skills/commit-craft/scripts/secret_gate.py
python ${CLAUDE_PLUGIN_ROOT}/skills/commit-craft/scripts/message_linter.py -m "<message>" --staged
git commit -m "<message>"
# then the series
python ${CLAUDE_PLUGIN_ROOT}/skills/commit-craft/scripts/message_linter.py --range @{upstream}..HEAD
```
Stop at the first BLOCKED gate and report it; do not commit around it. Push only if `--push` was given.
## Report
1. The plan: numbered groups with subject and files, and each default you chose (type, scope, order).
2. Anything held back: secrets files, waivers with their reasons, files you staged by hunk.
3. The final `git log --oneline` of the new commits.
4. Whether every commit was tested (`git rebase -x "<test command>" @{upstream}`) or that this is still owed.