AGENT SKILL
git-commit
Use this skill when user asks to "commit changes", "create a commit", "stage and commit", or wants help with git commit workflow.
使用场景Skill与智能体开发
- License 许可
- MIT
- 最近更新
- 2026-06-24
- Stars
- ★ 66
- Forks
- 24
01 前言 Front Matter
- name
- git-commit
- version
- 1.0.0
- description
- Use this skill when user asks to "commit changes", "create a commit", "stage and commit", or wants help with git commit workflow.
- allowed-tools
- [ "Read", "Bash", "Glob", "Grep" ]
02 资源文件 8
- 参考文档bmad-skill-manifest.yaml12 B
- 参考文档skill-report.json9.8 KB
- 参考文档steps/step-01-validate-prerequisites.md10.3 KB
- 参考文档steps/step-02-design-epics.md7.6 KB
- 参考文档steps/step-03-create-stories.md8.7 KB
- 参考文档steps/step-04-final-validation.md4.9 KB
- 参考文档templates/epics-template.md1.1 KB
- 参考文档workflow.md3.2 KB
03 SKILL.md 正文
Git Commit
Create well-structured git commits with conventional commit messages based on staged changes.
Parameters
{
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "Optional commit message override"
},
"type": {
"type": "string",
"enum": ["feat", "fix", "docs", "style", "refactor", "test", "chore"],
"description": "Conventional commit type",
"default": "auto"
},
"scope": {
"type": "string",
"description": "Optional scope for the commit"
}
}
}
When to Use
- User asks to "commit" changes
- User wants to "save" their work to git
- User asks for help with commit messages
- User wants to stage and commit files
Methodology
Phase 1: Status Check
- Run
git statusto see current state - Run
git diff --stagedto see staged changes - Run
git diffto see unstaged changes - Check recent commit history for message style
Phase 2: Analysis
- Categorize Changes: Identify what changed (new files, modifications, deletions)
- Determine Type: Is this a feature, fix, refactor, etc.?
- Identify Scope: What component/module is affected?
- Summarize Purpose: What does this change accomplish?
Phase 3: Commit Creation
- Stage relevant files if not already staged
- Generate conventional commit message
- Execute the commit
- Verify success with
git status
Phase 4: Output
Report:
- What was committed
- The commit message used
- The new commit hash
Guidelines
- Follow Conventional Commits format:
type(scope): description - Keep subject line under 72 characters
- Use imperative mood ("Add feature" not "Added feature")
- Don't commit sensitive files (.env, credentials, etc.)
- Don't use --force or --amend unless explicitly requested
- Include meaningful description of WHY, not just WHAT
Examples
Example 1: Auto Commit
User Input: "Commit my changes"
Expected Behavior:
- Run
git statusandgit diffto understand changes - Analyze the nature of changes
- Generate appropriate commit message
- Stage files if needed
- Create commit and report success
Example 2: Specific Type
User Input: "创建一个 fix 类型的 commit"
Expected Behavior:
- 检查当前的改动
- 确认这些改动符合 "fix" 类型
- 生成格式为
fix(scope): 描述的提交信息 - 执行提交并报告结果