AgentSkillsCN

git-committing

采用包含类型、范围与描述的常规提交信息格式。当需要提交代码、撰写提交信息,或为提交做准备工作时,可使用此格式。触发条件包括:提交、git commit、提交信息、常规提交、feat、fix、refactor。

SKILL.md
--- frontmatter
name: git-committing
description: "Conventional commit message format with type, scope, and description. Use when committing code, writing commit messages, or preparing changes for commit. Triggers on: commit, git commit, commit message, conventional commit, feat, fix, refactor."

Git Committing

Commit messages follow Conventional Commits format.

Format

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

[optional body]

Types

TypeUse When
featAdding new functionality
fixCorrecting a bug
testAdding or updating tests (primary change)
refactorRestructuring without behaviour change
docsDocumentation only
choreMaintenance, dependencies

Scope

Derive from:

  • Repository hint in work item title: [payments] → scope payments
  • Primary domain area affected
  • Component or module name

Check recent commits for consistency: git log --oneline -20

Description Rules

  • Imperative mood: "add" not "added" or "adds"
  • Lowercase throughout
  • No trailing period
  • Under 50 characters (hard limit: 72)
  • Specific: "add balance validation to payment processor" not "update code"

Body (Optional)

Include when the "what" isn't obvious, important "why" context exists, or the change has notable implications. Separate from subject with blank line. Wrap at 72 characters.

Examples

Feature:

code
feat(payments): add balance validation to payment processor

Validates account balance before processing payment requests.
Returns DeclinedResult with InsufficientFunds reason when
balance is below the requested amount.

Fix:

code
fix(accounts): prevent negative balance on concurrent withdrawals

Test:

code
test(payments): add integration tests for refund flow

Refactor:

code
refactor(api): extract validation into dedicated middleware

Commands

bash
git commit -m "feat(payments): add balance validation"
git log -1 --oneline  # verify