Turn mixed local changes into clean, reviewable Conventional Commit batches.
Once installed, this skill automatically intercepts ALL commit-related
operations — not just explicit "batch my commits" requests. When the agent
detects any intent to git add, git commit, or git push, it MUST follow
the plan-first workflow before executing any git command.
This means:
- Asking the agent to "commit my changes" triggers the full workflow.
- The agent splits changes into logical batches, runs safety gates, and commits directly — no confirmation needed by default.
- To review the plan before execution, explicitly ask the agent to show the plan first.
- Safety gates (sensitive data, conflict markers, protected branch, etc.) still require user confirmation when triggered, regardless of execution mode.
This behavior is enforced across all supported platforms (Codex, Claude Code, Kiro, Kimi, Qwen, Gemini, OpenAI) through their respective entrypoint files.
- Plan-first workflow prevents accidental mixed commits.
- Clear batch boundaries make review, revert, and
git bisectsafer. - Commit messages stay standards-compliant without manual policing.
- Built-in safety gates catch risky commits before they happen.
- Developers with a messy working tree before opening a PR.
- Teams that want cleaner commit history for release/changelog tooling.
- Agent-driven workflows that need deterministic commit hygiene.
npx skills add cnkang/conventional-commit-batcher
npx skills listThen ask your agent:
I have mixed changes in my working tree. Commit them with proper Conventional Commit messages.
The agent will automatically inspect, split, and commit. To review the plan before execution instead:
I have mixed changes in my working tree.
Show me the commit plan first before executing.
cat > .git/hooks/commit-msg <<'HOOK'
#!/usr/bin/env bash
set -euo pipefail
MSG_FILE="$1"
SCRIPT_PATH="scripts/validate_conventional_commit.py"
if [ ! -f "$SCRIPT_PATH" ]; then
echo "[commit-msg] validator not found: $SCRIPT_PATH"
exit 1
fi
python3 "$SCRIPT_PATH" \
--file "$MSG_FILE" \
--max-subject-length 72 \
--max-header-length 100
HOOK
chmod +x .git/hooks/commit-msg
cat > .git/hooks/pre-commit <<'HOOK'
#!/usr/bin/env bash
set -euo pipefail
python3 scripts/precommit_safety_gate.py
HOOK
chmod +x .git/hooks/pre-commitBy default, the skill auto-executes: it inspects changes, splits into logical batches, runs safety gates, and commits directly. After each batch, it reports what was committed.
If you want to review the plan before execution, explicitly ask:
Show me the commit plan first before executing.
In plan-first mode, the skill outputs the full plan and waits for your confirmation:
Commit Plan
Batch #1: feat(scope): ...
Intent: ...
Files/Hunks:
- ...
Staging commands:
- git add ...
Commit command:
- git commit -m "feat(scope): ..."
The skill includes pre-commit guards for common beginner mistakes:
- secret/sensitive data accidentally staged
- local or generated files that should stay out of history (
.gitignoredrift) - commits on protected/release branches by mistake
- unresolved merge conflict markers
- unexpected binary/large artifacts
- empty staged commit attempts
These checks are executed by scripts/precommit_safety_gate.py before each
commit attempt:
python3 scripts/precommit_safety_gate.py- exit
0: pass - exit
2: explicit user confirmation required (rerun with matching--allow-*flags after confirmation) - exit
3: hard block (must be fixed before commit)
If Python is unavailable, the agent must run the equivalent git diff/git status
manual checks from references/core-rules.md and enforce
the same decisions.
- No hard Python dependency: Python script is preferred, not mandatory.
- Why the script exists: it makes checks programmatic, regression-testable, and reusable in hooks/CI.
- If Python is not available: agent runs the same gate logic directly with
gitcommands fromreferences/core-rules.md, checks every gate one by one, and reports/block decisions in the same way. - In both modes, when sensitive indicators are found, output includes triggered file paths, snippet evidence, and a "please review these files" suggestion.
Use it when:
- any commit operation is performed through an agent (automatic interception)
- one branch contains mixed intents (
feat+fix+docs+style) - you need reviewable commit boundaries before PR
- you want consistent Conventional Commit history across contributors
Skip it when:
- you only have one tiny, single-intent change
- commit history hygiene is not relevant for the task
Note: even when the skill could be skipped, if it is installed, the agent will still produce a Commit Plan and run safety gates. The plan may contain only a single batch, which is fine.
- Agent flow: load this skill and follow
references/core-rules.md. - Validator CLI (commit header):
python3 scripts/validate_conventional_commit.py "feat(scope): add ...". - Safety gate CLI (6 pre-commit checks):
python3 scripts/precommit_safety_gate.py. - No-Python fallback: run manual gate commands in
references/core-rules.md. - Hook flow: use the script above (or
references/commit-msg-hook-example.md).
- Default language is English for commit message text (subject/body/footer).
- If a user explicitly asks for another language, text in subject/body/footer may use that language.
- Conventional Commit syntax tokens stay standard and untranslated:
type, optionalscope,!, andBREAKING CHANGE:. - Canonical enforcement lives in
references/core-rules.md. - This section is a non-authoritative summary;
references/core-rules.mdis the single source of truth.
- Keep body optional: add it when the header is not enough.
- Prefer brief, high-signal context (what changed and why it matters).
- Avoid verbose/noisy text that does not help reviewers.
- For tiny or obvious changes, an empty body is acceptable.
Use these docs only for tool-specific setup details:
- Codex:
references/codex-setup.md - Claude Code:
references/claude-setup.md - Kiro CLI:
references/kiro-setup.md - Kimi CLI:
references/kimi-setup.md - Qwen Code:
references/qwen-setup.md - Gemini CLI:
references/gemini-setup.md
All entrypoints delegate to one canonical rule file:
- Bug reports and feature requests: GitHub Issues (
.github/ISSUE_TEMPLATE/) - Product discussion and usage ideas: GitHub Discussions
