AgentSkillsCN

commit-message

从 Git 暂存的更改中生成简洁而规范的 Conventional Commits 提交信息。适用于以下场景:(1) 用户请求提交信息;(2) 用户希望概括暂存的更改;(3) 用户提到“提交”、“暂存的更改”或“Git 提交信息”;(4) 用户需要帮助撰写提交描述。

SKILL.md
--- frontmatter
name: commit-message
description: Generate concise, conventional commit messages from git staged changes. Use when (1) user asks for a commit message, (2) user wants to summarize staged changes, (3) user says "commit", "staged changes", or "git message", (4) user needs help writing a commit description.

Commit Message Generator

Generate short, concise commit messages from git diff --staged output.

Workflow

  1. Get staged changes: Run git diff --staged to see what's being committed
  2. Analyze changes: Identify the primary type and scope of modifications
  3. Generate message: Output a single-line conventional commit message

Commit Format

Use Conventional Commits format:

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

Types (pick ONE)

TypeUse When
featNew feature or capability
fixBug fix
docsDocumentation only
styleFormatting, whitespace (no logic change)
refactorCode restructure (no feature/fix)
perfPerformance improvement
testAdding/updating tests
choreBuild, config, dependencies

Scope (optional)

File, module, or component name. Omit if changes span multiple areas.

Description Rules

  • 50 characters max (hard limit)
  • Use imperative mood: "add", "fix", "update" (not "added", "fixes")
  • Lowercase, no period at end
  • Focus on WHAT changed, not HOW

Examples

code
feat(auth): add OAuth2 login flow
fix: resolve null pointer in user service
docs: update API endpoint documentation
refactor(dashboard): extract chart components
chore: bump numpy to 2.0
test(orders): add edge case coverage

Multi-file Changes

When changes span multiple files:

  • Find the common theme/purpose
  • Use broader scope or omit scope entirely
  • Summarize the overall intent
code
# Multiple related fixes
fix: resolve data loading issues across services

# Feature touching many files  
feat: implement dark mode theming

Output

Return ONLY the commit message on a single line. No explanations, no alternatives, no markdown formatting around the message itself.