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 status to see current state
- Run
git diff --staged to see staged changes
- Run
git diff to 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 status and git diff to 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): 描述 的提交信息
- 执行提交并报告结果
1---2name: git-commit-23description: Use this skill when user asks to "commit changes", "create a commit", "stage and commit", or wants help with git commit workflow.4---5
6# Git Commit
7
8Create well-structured git commits with conventional commit messages based on staged changes.
9
10## Parameters
11
12```json
13{
14 "type": "object",
15 "properties": {
16 "message": {
17 "type": "string",
18 "description": "Optional commit message override"
19 },
20 "type": {
21 "type": "string",
22 "enum": ["feat", "fix", "docs", "style", "refactor", "test", "chore"],
23 "description": "Conventional commit type",
24 "default": "auto"
25 },
26 "scope": {
27 "type": "string",
28 "description": "Optional scope for the commit"
29 }
30 }
31}
32```
33
34## When to Use
35
36- User asks to "commit" changes
37- User wants to "save" their work to git
38- User asks for help with commit messages
39- User wants to stage and commit files
40
41## Methodology
42
43### Phase 1: Status Check
44- Run `git status` to see current state
45- Run `git diff --staged` to see staged changes
46- Run `git diff` to see unstaged changes
47- Check recent commit history for message style
48
49### Phase 2: Analysis
501. **Categorize Changes**: Identify what changed (new files, modifications, deletions)
512. **Determine Type**: Is this a feature, fix, refactor, etc.?
523. **Identify Scope**: What component/module is affected?
534. **Summarize Purpose**: What does this change accomplish?
54
55### Phase 3: Commit Creation
56- Stage relevant files if not already staged
57- Generate conventional commit message
58- Execute the commit
59- Verify success with `git status`
60
61### Phase 4: Output
62Report:
63- What was committed
64- The commit message used
65- The new commit hash
66
67## Guidelines
68
69- Follow Conventional Commits format: `type(scope): description`
70- Keep subject line under 72 characters
71- Use imperative mood ("Add feature" not "Added feature")
72- Don't commit sensitive files (.env, credentials, etc.)
73- Don't use --force or --amend unless explicitly requested
74- Include meaningful description of WHY, not just WHAT
75
76## Examples
77
78### Example 1: Auto Commit
79
80**User Input**: "Commit my changes"
81
82**Expected Behavior**:
831. Run `git status` and `git diff` to understand changes
842. Analyze the nature of changes
853. Generate appropriate commit message
864. Stage files if needed
875. Create commit and report success
88
89### Example 2: Specific Type
90
91**User Input**: "创建一个 fix 类型的 commit"
92
93**Expected Behavior**:
941. 检查当前的改动
952. 确认这些改动符合 "fix" 类型
963. 生成格式为 `fix(scope): 描述` 的提交信息
974. 执行提交并报告结果