AgentSkillsCN

git-commits

在创建Git提交时使用——根据暂存的更改,确定提交类型、范围与提交信息。

SKILL.md
--- frontmatter
name: git-commits
description: Use when creating git commits -- determines type, scope, and message from staged changes

Git Commits

Format

code
<type>(<scope>): <imperative description>

Imperative mood: "add feature" not "added feature" or "adds feature".

Type Selection

TypeWhenTier
featNew functionality, new files with exports1 — full context
fixBug fix, error handling correction1 — full context
refactorRestructure without behavior change2 — brief context
testAdd/update tests only2 — brief context
docsDocumentation, comments3 — summary only
choreDependencies, config, tooling3 — summary only
perfPerformance improvement1 — full context
ciCI/CD pipeline changes3 — summary only
buildBuild system, packaging3 — summary only
styleFormatting, linting (no logic change)3 — summary only

Scope Detection

Infer from the primary area of change:

  • File path: internal/auth/token.goauth
  • Directory: cmd/bd/bd
  • Feature: .claude/skills/skills
  • Cross-cutting: omit scope — feat: add retry logic across services

Tiers

Tier 1 (feat, fix, perf): Body with what changed and why. List affected files if 3+.

Tier 2 (refactor, test, build, ci): One-line body if helpful. Skip if obvious.

Tier 3 (docs, style, chore): Subject line only. No body needed.

Rules

  • Subject line: max 72 characters
  • No period at end of subject
  • No co-author credits or AI attribution
  • No generic messages ("update files", "fix stuff", "WIP")
  • Scope in the commit, not the description: feat(auth): add token refresh not feat: add auth token refresh
  • One logical change per commit when possible

Examples

bash
# Tier 1 — full context
git commit -m "feat(skills): add 4 skills from openclaw and beads"

# Tier 1 — with body
git commit -m "$(cat <<'EOF'
fix(sync): resolve race condition in concurrent token refresh

Token store was not mutex-protected during refresh. Multiple goroutines
could trigger simultaneous refreshes, causing token overwrites.
EOF
)"

# Tier 2
git commit -m "refactor(storage): extract query builder from sqlite module"

# Tier 3
git commit -m "docs: update cross-reference notes"
git commit -m "chore: bump golangci-lint to v1.62"

Red Flags

  • Committing without reviewing git diff --staged
  • Generic messages that don't explain the "why"
  • Mixing unrelated changes in one commit
  • Adding co-author footers or AI attribution