AgentSkillsCN

commit-changes

按照项目规范,创建格式规范的提交信息。自动从 Git 历史中检测提交风格。

SKILL.md
--- frontmatter
name: commit-changes
description: Create a well-formatted commit following project conventions. Auto-detects commit style from git history.

Commit Task

Create a commit for staged/unstaged changes following project conventions.

Steps

  1. Check git status for changes
  2. Analyze git log --oneline -10 to detect commit style
  3. Categorize changes (feat/fix/docs/refactor/test/chore)
  4. Generate commit message matching detected style
  5. Present to user for approval
  6. Execute commit

Commit Style Detection

Use the detection script for accurate results:

bash
# Returns JSON with style and confidence
"${CLAUDE_PLUGIN_ROOT}/scripts/detect-commit-style.sh"

Output example:

json
{
  "style": "conventional-scoped",
  "confidence": 80,
  "stats": { "total": 10, "conventional_scoped": 8, "gitmoji": 2 }
}
PatternStyle
type(scope): messageConventional Commits (scoped)
type: messageConventional (no scope)
:emoji: messageGitmoji
Plain textSimple

Conventional Commits Types

TypeUse For
featNew features
fixBug fixes
docsDocumentation only
styleFormatting changes
refactorCode restructuring
perfPerformance improvements
testAdding/fixing tests
choreMaintenance tasks

Message Format

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

<body>

<footer>

Subject Rules:

  • Imperative mood ("add" not "added")
  • No period at end
  • Max 50 characters
  • Lowercase

Body (optional):

  • Explain what and why
  • Wrap at 72 characters

Footer (optional):

  • Closes #123
  • BREAKING CHANGE: description

Output

Present message for approval before committing.