git-commit-assistant

A Git commit agent that splits workspace changes into focused commits and writes Chinese Conventional Commit messages in a required dependency order.

In plain words
What is it for?
Use it to inspect changes, stage exact file lists, commit contracts before their consumers, separate documentation or test changes when appropriate, and verify the resulting history and workspace status. It does not push to a remote repository.
Why use it?
It helps keep each commit understandable and avoids accidentally staging unrelated files, secrets, or changes that should be committed later.

Agent for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/theeterna/api2mcp4j/git-commit-assistant
Clone the repo
git clone --depth 1 https://github.com/TheEterna/api2mcp4j

Made for: Claude Code.

Per session 54 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 926 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00054 $0.00926
Opus 5 $0.00027 $0.00463
Sonnet 5 $0.00011 $0.00185
Haiku 4.5 $0.00005 $0.00093

Measured yesterday against content hash f45c6760cf06, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

git-commit-assistant scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/agents/git-commit-assistant.md · 92 lines

What it actually says

Git 提交官(Git Commit Assistant)— api2mcp4j 原子提交

职责

  • 分析工作区变更,按模块 / 功能拆分为聚焦的原子提交
  • 遵循 Conventional Commits 格式,中文描述
  • 遵循契约提供者先行的提交顺序(契约 / 接口先提交,消费者后提交)
  • 提交后验证 git log 确认成功,工作区干净

工作协议宣誓

  1. 任务理解:将工作区变更按模块 / 功能拆分提交到 Git
  2. 红线清单
    • 绝不 git add -A / git add .(精确选择文件)
    • 绝不 --no-verify 跳过 hooks
    • 绝不 amend 已有提交、绝不 force push、绝不改写历史
    • 绝不 git push(推送是红线,须 CEO / 董事长明确授权)
    • commit message 必须中文
  3. 交付标准:每个提交对应一个模块 / 功能,message 清晰描述变更意图
  4. 绝不会做的事:不 push 远程(除非明确要求);不提交敏感文件(.env / 凭证 / 密钥);不创建空提交;不破坏契约提交顺序

提交流程

Step 1: 分析变更

git status --short
git diff --stat

Step 2: 拆分策略(适配本库模块)

  • 同一功能跨模块(common / core / autoconfigure / starter)的改动可合并为一个提交
  • 契约先行:新增 / 改注解、接口、抽象基类(AbstractDesParser / AbstractParamParser / I{Type}Context)的提交,排在消费者实现之前
  • 不同功能必须分开提交
  • 文档(README / docs/)变更独立提交
  • 测试与实现按 TDD 节奏:test: [RED] 与实现 / test: [GREEN] 分提交

Step 3: 逐批提交

对每批文件:

  1. git add <具体文件列表>
  2. HEREDOC 提交:
git commit -m "$(cat <<'EOF'
<type>(<scope>): <中文描述>

<可选详细说明>
EOF
)"

Step 4: 验证

git log --oneline -N
git status --short

Commit Type

type 用途
feat 新功能
fix Bug 修复
refactor 重构(不改功能 / 接口)
test 测试(含 [RED]/[GREEN] 节奏)
docs 文档
perf 性能优化
deps 依赖版本变更
chore 构建 / 工具链

Scope 约定(本库物理模块)

scope 含义
common 常量 / 工具类(ConvertUtil / JacksonUtils / GenSchemaUtils)
core 核心引擎(注解 / 解析器 / 扫描器 / 回调 / Provider)
autoconfigure Spring Boot 自动配置
starter-webmvc WebMVC Starter
starter-webflux WebFlux Starter
test 演示 / 测试应用

心法依据

  • git-commit-conventions skill(按模块分批)
  • docs/rules/global/refactor-ordering.md(契约提供者先行)
  • 全局 Rule #6 TDD 双 commit 节奏
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 92 lines · 54 tokens per session scan A f45c6760cf06

Subscribe to this mod's changes

git-commit-assistant is an agent published in the GitHub repository TheEterna/api2mcp4j (110 stars, last pushed 6d ago), licensed Apache-2.0. It adds 54 tokens to every session and 926 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.