Skip to content
Agentmart
Submit a tool

git-commit

用于所有 git 提交操作(commit/amend/stage)。自动执行 diff 分析、安全扫描、lint 检查,并使用 5 部分格式(CONTEXT/CHANGE/WHY/IMPACT)生成标准提交。只要涉及 git 提交或任何记录代码变更的请求,就请加载此技能。

Skill by 418-teapot

IndexedMIT★ 1
Write a review

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/418-teapot-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

用于所有 git 提交操作(commit/amend/stage)。自动执行 diff 分析、安全扫描、lint 检查,并使用 5 部分格式(CONTEXT/CHANGE/WHY/IMPACT)生成标准提交。只要涉及 git 提交或任何记录代码变更的请求,就请加载此技能。

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. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found
Runs as
Shell scripts

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
用于所有 git 提交操作(commit/amend/stage)。自动执行 diff 分析、安全扫描、lint 检查,并使用 5 部分格式(CONTEXT/CHANGE/WHY/IMPACT)生成标准提交。只要涉及 git 提交或任何记录代码变更的请求,就请加载此技能。
License
MIT
Instructions
236 lines in SKILL.md · view on GitHub

Before installing

  • Ships executable scripts

Files (7)

  • SKILL.md
  • commit-types.md · references/
  • message-examples.md · references/
  • security-rules.md · references/
  • check-commit-msg.sh · scripts/
  • scan-secrets.sh · scripts/
  • .gitmessage · templates/

SKILL.md (first lines)

# Git 提交技能

生成黄金标准的 Git 提交:经过测试、安全且有文档记录。
按顺序执行以下每个阶段。除非用户明确说明,否则不得跳过任何阶段。

<!-- line-limit: 500 -->

---

## Phase 0 — 读取项目规则

检查仓库根目录下是否存在 AGENTS.md、CLAUDE.md、.gitmessage、.git/COMMIT_TEMPLATE 或任何跟 git commit 相关的 skill。
如果找到,这些规则将覆盖本技能的默认设置。

显示已加载的规则后再继续。

### 环境检查

```bash
git branch --show-current
git config user.name
git config user.email
```

如果在 `main`、`master` 或 `release` 分支上 → 警告用户并建议创建功能分支:
```bash
git checkout -b feat/<branch-name>
```
不强硬阻止 — 在受保护分支上执行热修复且经用户确认后是可以接受的。

如果 `user.name` 或 `user.email` 为空 → 请在提交前要求用户配置。

---

## Phase 1 — Diff 分析

在执行 `git add` 之前运行完整的 diff 分析:

```bash
git status
git diff --stat          # 哪些文件、多少行变更
git diff                 # 小变更集的完整 diff
git log --oneline -5     # 最近的提交上下文
```

对每个变更文件进行分类:

| 路径模式 | 分类 |
|-------------|----------|
| `src/` `lib/` `app/` | feature/fix/refactor |
| `tests/` `*.test.*` | test |
| `docs/` `*.md` | docs |
| `package.json` deps | chore |
| `third_party` deps | chore |
| `.github/` `Makefile` | tooling |

---

## Phase 2 — 安全扫描(不得跳过)

运行自动化安全扫描器:

```bash
bash "<当前 skill 目录>/scripts/scan-secrets.sh"
```

- **Exit 0** → 显示 "✓ Clean" 并继续
- **Exit 1** → **HARD STOP**。显示发现结果。未清理干净前不得继续。

如果发现密钥:
1. `git reset HEAD <file>` 取消暂存
2. 替换为环境变量或占位符
3. 如有必要,添加到 `.gitignore`
4. 如果已推送,轮换已暴露的凭据

阅读 `<当前 skill 目录>/references/security-rules.md` 获取完整的模式列表。

---

## Phase 3 — Lint 门控(不得跳过)

运行轻量级 lint 检查。不要假定具体工具 — 探测项目:

1. **阅读项目文档** — 检查 `AGENTS.md`、`CLAUDE.md` 或 `README.md` 中记录的 lint 命令。
2. **未找到任何内容** → 警告用户,询问是否在没有 lint 的情况下继续。

- **通过** → 继续
- **失败** → **硬停止**。先修复错误。

---

## Phase 4 — 提交消息构建

每次提交必须使用 **5 部分格式**。没有例外。正文四个字段以子项列表形式书写;每字段下每条子项以 `- ` 开头,对齐到字段标签之后的内容列,并以句号(`.`)结尾;各字段之间必须插入 1 个空行。

```
<type>(<scope>): <imperative summary — max 72 chars>

CONTEXT: - item 1
         - item 2

CHANGE:  - item 1
         - item 2

WHY:     - item 1

IMPACT:  - item 1
         - item 2

<footers>
```

### 摘要行规则

- **祈使语气**:用 "add" 而非 "added",用 "fix" 而非 "fixing"
- **末尾不加句号**
- **不超过 72 个字符**
- **总消息长度**:body(CONTEXT + CHANGE + WHY + IMPACT)合计不超过 200 词(多子项时按字段内所有子项合计)。超出时精简 CHANGE,保留 WHY。
- **这些限制是硬性要求**。宁可信息不足也不冗长啰嗦。

From 418-teapot/ZooKeeper, MIT.

More from 418-teapot/ZooKeeper

Signals

Stars
1
Forks
0
Open issues
0
Last commit (this folder)
Oct 6, 2026 (22 days ago)

From GitHub (fetched Oct 24, 2026).

Details

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

More from 418-teapot

Cite this page

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