Skip to content
Agentmart
Submit a tool

git-commit

AI 智能生成 commit message 并分批提交。读取 active preset 的 subject 格式、type 枚举、分支规则、业务词归一表,自动适配 generic / example-company / 公司自定义 preset。**不自动 push** —— push 时机交回 shk 的…

Skill by duoglas

IndexedMIT★ 39
Write a review

Chalk Labs

Need help deploying git-commit?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/duoglas-git-commit

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

AI 智能生成 commit message 并分批提交。读取 active preset 的 subject 格式、type 枚举、分支规则、业务词归一表,自动适配 generic / example-company / 公司自定义 preset。**不自动 push** —— push 时机交回 shk 的 verification-gate(仅 REVIEW 阶段放行)。Use when 用户说提交、commit、git commit、分批提交、生成 commit message 等。

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/git-commit

What's inside

Skill name
git-commit
Description
AI 智能生成 commit message 并分批提交。读取 active preset 的 subject 格式、type 枚举、分支规则、业务词归一表,自动适配 generic / example-company / 公司自定义 preset。**不自动 push** —— push 时机交回 shk 的 verification-gate(仅 REVIEW 阶段放行)。Use when 用户说提交、commit、git commit、分批提交、生成 commit message 等。
License
MIT
Instructions
292 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# git-commit

AI 自动生成 commit message 并分批提交。Test 与非 Test 自动分离,大改自动拆批。

> **本 skill 不 push**。push 时机由 shk 的 `verification-gate.js` 决定(其他阶段直接 exit 2 阻断)。

## 何时使用

- 用户说 "提交"、"commit"、"分批提交"、"帮我生成 commit message"
- 完成 EXECUTE 进入 VERIFY/REVIEW 前
- `git status` 有较多变更想拆 commit

## 何时不要用

- 用户已经写好 message + `git commit -m` 手动提交 → 直接放行,本 skill 不必介入
- 在 PLAN / SETUP / EXECUTE 阶段(verification-gate 会拒 commit;先验证再来)

## 执行原则

> 严格按步骤顺序执行,前一步成功后才进入下一步。
> 🔒 标记的步骤必须等待用户实际输入,禁止自动跳过。

---

## 1. 环境检查

```bash
git rev-parse --is-inside-work-tree
git symbolic-ref --short HEAD       # $BRANCH
git status --porcelain              # changes
```

- 非仓库 / 游离 HEAD / 无变更 → 终止
- 记录 `$BRANCH` 备后续步骤使用

## 2. 读取 active preset

```bash
node scripts/hooks/load-preset.js
```

吐出的 JSON 取以下字段:

| 字段 | 用途 |
|---|---|
| `commit_format.subject_regex` | 校验 subject 必须匹配 |
| `commit_format.format_description` | 人类可读说明(生成时参考) |
| `commit_format.type_enum` | 候选 type 列表 |
| `commit_format.type_blocked_on_branch` | type→[branch] 禁用表(支持 `!` 取反) |
| `commit_format.type_required_on_branch` | branch→[type] allowlist |
| `commit_format.title_hints` | 业务词归一表(可选;公司自定义 preset 可能提供,generic 没有) |

> 没有 `HARNESS_PRESET` / `.harness.local.json` / `.claude/settings.json` 配置时,loader fallback 到 `generic`。

## 3. 获取上次前缀

```bash
git log -1 --format=%B
```

按 active preset 的 `subject_regex` 解析第一行,提取:

- **generic / Conventional**:`<type>(scope?): subject` → `LAST_TYPE` = 第 1 个捕获组
- **任务 ID 前缀风格**(公司自定义 preset 可能采用):`{任务ID?} {type} {title}` → `LAST_TASKID` + `LAST_TYPE`

仅作为下一步"前缀复用"的默认建议。

## 4. 前缀判定(含分支×类型约束)

### 4.1 type 选择

按以下优先级决定本批次的 `type`:

1. **Test 批次**(见 §5.1 识别)→ 强制 `test`,最高优先级
2. `LAST_TYPE` 仍合法(在 `type_enum`、不被 §4.2 拒)→ 复用
3. 否则 🔒 提示用户输入:`请输入 type(候选: <从 preset.type_enum 列出>)`

### 4.2 分支×类型校验

读 `type_blocked_on_branch` 与 `type_required_on_branch`:

- `type_blocked_on_branch[type]` 任一 pattern 匹配 `$BRANCH`(含 `!pattern` 取反)→ 该 type 在该分支被禁
- `type_required_on_branch` 中存在 pattern 匹配 `$BRANCH` 而 `type` 不在该 pattern 的 allowlist → 该 type 在该分支被禁

> 例:某公司 preset 下:
> - `master` 分支不能用 `fix`(`fix: ['!fix-*']`)
> - `fix-PROJ-42` 分支只能用 `fix` 或 `test`(`fix-*: ['fix','test']`)
> - `release-20260429` 分支不能用 `feat`(`feat: ['release-*','fix-*']`)

被禁 → 🔒 提示用户重选 type 或换分支。**严禁绕过**——`branch-policy-guard.js` 同时会在 `git commit` 时 exit 2 阻断。

### 4.3 任务 ID

仅当 active preset 的 `subject_regex` 允许任务 ID 段(例如形如 `(?:\S+\s+)?` 的可选段)时执行:

- `LAST_TASKID` 仍有效 → 复用
- 否则 🔒 输入:`请输入任务号(可跳过)`

## 5. 分批

### 5.1 Test 识别

`git diff HEAD --numstat` 后,按路径分桶:

**TEST_GROUP**(命中即视为 Test):
- `test/` / `tests/` / `__tests__/` 目录
- `*.test.*` / `*.spec.*`
- `*_test.go` / `Test*.java` / `*_test.py`

**NONTEST_GROUP**:其余

约束:Test 与非 Test 必须分独立 commit,**不允许混合**。

### 5.2 分批策略

每组内:

- ≤ 4000 行优先聚合
- ≤ 40 文件兜底

From duoglas/simple-harness-kit, MIT.

More from duoglas/simple-harness-kit

Signals

Stars
39
Forks
3
Open issues
0
Last commit (this folder)
May 29, 2026 (5 months ago)
Last release
Oct 9, 2026 (25 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from duoglas

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get git-commit running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying git-commit?

CallGet help
Cite this page

git-commit skill. Agent Mart. https://agentmart.dev/skills/duoglas-git-commit (last updated 2026-10-24)