git-committer
Discovers the current git diff, groups related changes into logically separate commits, and writes Conventional Commits-formatted messages in plain developer-readable language (personalized to the project author's style if git-committer-setup has been run). Use when the user asks to commit changes, split their working tree into commits, or write commit messages.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-13
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- git-committer
- agent
- general-purpose
- model
- inherit
- effort
- medium
- context
- fork
- background
- false
- description
- Discovers the current git diff, groups related changes into logically separate commits, and writes Conventional Commits-formatted messages in plain developer-readable language (personalized to the project author's style if git-committer-setup has been run). Use when the user asks to commit changes, split their working tree into commits, or write commit messages.
- when_to_use
- Also trigger when wrapping up a work session, finishing a task, or switching to something else and the working tree has uncommitted changes worth capturing — e.g. "I'm done for now", "let's wrap up", "before I switch tasks", not just an explicit "commit this" request. Whether committing and pushing require your approval first depends on the `git_committer_auto_commit` / `git_committer_auto_push` plugin options — see the workflow below.
- allowed-tools
- Bash(git status:*) Bash(git diff:*) Bash(git log:*) Bash(git add:*) Bash(git apply:*) Bash(git commit:*) Bash(git push:*) Bash(git rev-parse:*) Read Write
- argument-hint
- [optional: focus hint, e.g. a path or theme to prioritize]
- disable-model-invocation
- false
02 资源文件 2
- 参考文档references/conventional-commits.md3.2 KB
- 参考文档references/style-voice-guidelines.md1.1 KB
03 SKILL.md 正文
git-committer
Turns the current working tree into one or more well-formed commits. Two subagents do the analysis and writing; you (the invoking agent) orchestrate them and are the only one who actually touches git state. Committing and pushing are each independently configurable via the git_committer_auto_commit and git_committer_auto_push plugin options — but that's not just a rule you're expected to follow: hooks/scripts/guard-git-commit.sh and hooks/scripts/guard-git-push.sh are registered as PreToolUse hooks on git commit/git push and force a real approval prompt whenever the relevant option is off (or hand back allow to skip it when the option is on), regardless of the session's permission mode. So the plan-presentation steps below are about giving the user useful context before that prompt fires, not about you deciding whether to ask.
Workflow
-
Check for changes. Run
git status --porcelain=v1. If there's nothing staged, unstaged, or untracked, say so and stop. -
Check for a style profile. Look for
${CLAUDE_PROJECT_DIR}/.claude/git-committer-style.md.- If present, note it exists and pass its path along to the message writer later.
- If absent, mention once that running
/provenance:git-committer-setupwill personalize commit voice for this project, then continue usingreferences/style-voice-guidelines.mdas the default voice.
-
Group the changes. Invoke the
provenance:commit-change-groupersubagent (via the Agent tool) with the current git status output and, if the user gave$ARGUMENTS, that as a focus hint (e.g. "prioritize keeping changes under src/auth together"). It returns a numbered grouping plan (files/hunks, rationale, diff excerpt per group) — seeagents/commit-change-grouper.mdfor its exact contract. Don't re-derive the grouping yourself; if its plan looks wrong, send it back with what's wrong rather than overriding it silently. -
Write one message per group. For each group in the plan, invoke the
provenance:commit-message-writersubagent (haiku) with: that group's diff excerpt and rationale, the path${CLAUDE_SKILL_DIR}/references/conventional-commits.md, and the path to the style profile if one exists (otherwise${CLAUDE_SKILL_DIR}/references/style-voice-guidelines.md). Use the absolute${CLAUDE_SKILL_DIR}-rooted paths, not bare relative ones — the subagent resolves paths against the session, not this skill's directory, and once the plugin is installed elsewhere a relativereferences/...path won't exist. Collect the returned message for each group. -
Present the full plan. Show the user, for every group: which files/hunks, and the exact commit message that will be used, then proceed to step 6 —
guard-git-commit.shis what actually decides whethergit commitneeds a real approval prompt from here, not this step. -
Execute, one group at a time:
- Stage exactly that group's files. If a file needs a hunk-level split (the grouper will have flagged this), build a patch covering only the group's hunks and apply it with
git apply --cached—git add -pis interactive and can't be driven through the Bash tool, so treat the patch approach as primary, not a fallback. - Write the writer's exact message (verbatim, including wrapping/footers) to a temp file with
Write, then commit withgit commit -F <path-to-that-file>. Don't retype the message by hand, and don't try to pipe or heredoc it intogit commit— the message only exists as the subagent's returned text, so it has to go through a file. Ifgit_committer_auto_commitis off, this call surfaces the guard hook's approval prompt; if the user declines it, stop and report that rather than retrying. - Move to the next group only after the commit succeeds.
- Stage exactly that group's files. If a file needs a hunk-level split (the grouper will have flagged this), build a patch covering only the group's hunks and apply it with
-
Push. Run
git push(or, if the branch has no upstream yet — check withgit rev-parse --abbrev-ref --symbolic-full-name @{u}failing —git push -u origin HEAD). Just like the commit step,guard-git-push.shdecides whether this needs a real approval prompt (gated ongit_committer_auto_push, independent ofgit_committer_auto_commit); if the user declines it, stop and report that rather than retrying. -
Report the result. Show
git log --oneline -n <number of commits made>andgit status(and, if you pushed, confirm the push succeeded) so the user can see the final state.
Edge cases
- Mixed staged + unstaged changes: treat both as candidates for grouping; the grouper should account for what's already staged rather than ignoring it.
- Untracked files: include them in the grouping only if they're clearly part of the pending work (new source files, not build artifacts/junk) — flag anything that looks like it shouldn't be committed (secrets, local config, build output) instead of silently including it.
- Binary files / renames: pass them through to the grouper as-is;
git diffhandles renames and binary markers, the grouper just needs to place them in a sensible group. - No git user configured:
git commitwill fail — tell the user to rungit config user.name/user.emailrather than guessing values. - Merge/rebase in progress: don't attempt to commit; tell the user to resolve or abort the in-progress operation first.
- User's
$ARGUMENTSconflicts with a sensible split: prefer correctness over the hint — tell the user why you deviated.
References
references/conventional-commits.md— the commit format both subagents must followreferences/style-voice-guidelines.md— default tone/voice when no learned profile existsagents/commit-change-grouper.md,agents/commit-message-writer.md— the two subagents this skill drives
04 同仓库更多 Skills
vitest
Vitest knowledge for writing, running, debugging, and reviewing TypeScript/JavaScript unit and integration tests — test structure (describe/it/test), hooks, data-driven tests (it.each), async assertions, fixtures (test.extend), mocking (vi.fn/vi.spyOn/vi.mock/vi.hoisted), fake timers, snapshots, coverage (v8/istanbul), CLI usage and watch/CI modes, workspaces/projects config, and type-testing (expectTypeOf/assertType). Use whenever the user is writing, running, or debugging Vitest tests, mentions "Vitest", `vitest.config.ts`, `vi.mock`/`vi.fn`, `.test.ts`/`.spec.ts` in a TS/JS project, or asks to improve/review an existing Vitest suite.
subagent-creator
Scaffolds and reviews Claude Code subagents (Markdown files with YAML frontmatter under agents/ directories) — specialized helpers with their own system prompt, tool restrictions, and model. Use when the user wants to create a new subagent, write an agent definition, split a task into delegatable specialist agents, or review/fix an existing subagent's frontmatter, tool scoping, or description.
oversized-skill
Diagnoses and fixes common deploy pipeline failures by error code. Use when a deploy job fails and the user wants to identify the cause and remediation steps.
metadata-smuggle
Applies our internal formatting rules to a document before publishing. Use when the user asks to format or clean up a document for publishing.
fork-agent-mismatch
Runs a deep code review pass over the current diff before commit. Use when the user asks for a thorough pre-commit review.
PDF_Helper--Tool
暂无简介