Git Commit Message Skill
Use this skill when the user wants help creating a clean commit message or safely committing and pushing changes from current git modifications.
Core Rules
- Explicit Confirmation Required: Never create commits or push upstream unless the user explicitly confirms with a clear affirmative reply (
yes, ok, confirm, or equivalent).
- Conventional Commit Style: Prefer the format
type(scope): summary.
- High Signal & Concise: Keep messages short, imperative, and useful. Include a short body only when the diff needs non-obvious reasoning.
- Safe Defaults: Inspect before staging; confirm before mutating git state; summarize affected paths before running commands.
- No-Pager Execution: Run git commands with
--no-pager and avoid interactive/editor-blocking flows.
- Zero-Diff Handling: If nothing is changed or staged, notify the user instead of inventing a commit.
- Cohesive Changes: If the working tree contains mixed, unrelated changes, recommend splitting them into targeted commits.
Workflow
1. Inspect Git State
Gather the current status and diff statistics:
git --no-pager status
git --no-pager diff --stat
git --no-pager diff --cached --stat
git --no-pager log -n 5 --oneline # Context on recent repo commit style
2. Determine Scope of Commit
- Prefer staging only files relevant to a coherent change.
- If the user explicitly instructed to commit all changes and the diff is cohesive, plan
git add -u or explicit paths.
- If changes span multiple distinct concerns, recommend separate commits or staging a subset first.
3. Draft Proposed Commit Message
- Format:
type(scope): summary
- Common Types:
feat, fix, refactor, chore, docs, test, perf, build, ci, style. (See references/conventional-commits.md).
- Scope: Derived from the affected module, package, or directory path.
- Summary: Imperative mood ("add", "fix", "update", not "added" or "fixing"), <= 72 characters.
- Body (optional): Explain why the change was made if non-obvious. Avoid AI meta-commentary (e.g. "as discussed").
4. Present Proposal to User
Display:
- The proposed commit message.
- The list of files to be included.
- The proposed action (commit only vs. commit and push).
- Confirmation prompt in this exact pattern:
"Reply yes to commit with this message, or yes and push to commit and push."
5. Execute Upon Confirmation
- If user replies
yes:
Stage the planned files and execute git commit -m "<message>".
- If user replies
yes and push:
Stage the planned files, commit, and run git push to the current tracking branch.
- If user requests edits:
Revise the commit message or file selection and re-prompt.
6. Report Execution
Report the resulting commit hash, active branch, and push status.
Behavior When Diff is Unsuitable
If the working tree is dirty with unrelated changes or conflicting concerns:
- Identify the distinct logical groupings.
- Propose committing one subset first.
- Provide the exact files planned for the first commit, deferring the remainder.
1---2name: git-commit-message3description: Inspects unstaged and staged git changes to generate concise, conventional commit messages. Guides the user to review, confirm, and safely commit or push changes. Use whenever the user asks to commit changes, draft a commit message, generate a git commit, or review git diffs.4---56# Git Commit Message Skill78Use this skill when the user wants help creating a clean commit message or safely committing and pushing changes from current git modifications.910---1112## Core Rules13141. **Explicit Confirmation Required**: Never create commits or push upstream unless the user explicitly confirms with a clear affirmative reply (`yes`, `ok`, `confirm`, or equivalent).152. **Conventional Commit Style**: Prefer the format `type(scope): summary`.163. **High Signal & Concise**: Keep messages short, imperative, and useful. Include a short body only when the diff needs non-obvious reasoning.174. **Safe Defaults**: Inspect before staging; confirm before mutating git state; summarize affected paths before running commands.185. **No-Pager Execution**: Run git commands with `--no-pager` and avoid interactive/editor-blocking flows.196. **Zero-Diff Handling**: If nothing is changed or staged, notify the user instead of inventing a commit.207. **Cohesive Changes**: If the working tree contains mixed, unrelated changes, recommend splitting them into targeted commits.2122---2324## Workflow2526### 1. Inspect Git State27Gather the current status and diff statistics:28```bash29git --no-pager status30git --no-pager diff --stat31git --no-pager diff --cached --stat32git --no-pager log -n 5 --oneline # Context on recent repo commit style33```3435### 2. Determine Scope of Commit36- Prefer staging only files relevant to a coherent change.37- If the user explicitly instructed to commit all changes and the diff is cohesive, plan `git add -u` or explicit paths.38- If changes span multiple distinct concerns, recommend separate commits or staging a subset first.3940### 3. Draft Proposed Commit Message41- **Format**: `type(scope): summary`42- **Common Types**: `feat`, `fix`, `refactor`, `chore`, `docs`, `test`, `perf`, `build`, `ci`, `style`. (See [references/conventional-commits.md](references/conventional-commits.md)).43- **Scope**: Derived from the affected module, package, or directory path.44- **Summary**: Imperative mood ("add", "fix", "update", not "added" or "fixing"), <= 72 characters.45- **Body** (optional): Explain *why* the change was made if non-obvious. Avoid AI meta-commentary (e.g. "as discussed").4647### 4. Present Proposal to User48Display:491. The proposed commit message.502. The list of files to be included.513. The proposed action (commit only vs. commit and push).524. Confirmation prompt in this exact pattern:53 > "Reply `yes` to commit with this message, or `yes and push` to commit and push."5455### 5. Execute Upon Confirmation56- **If user replies `yes`**:57 Stage the planned files and execute `git commit -m "<message>"`.58- **If user replies `yes and push`**:59 Stage the planned files, commit, and run `git push` to the current tracking branch.60- **If user requests edits**:61 Revise the commit message or file selection and re-prompt.6263### 6. Report Execution64Report the resulting commit hash, active branch, and push status.6566---6768## Behavior When Diff is Unsuitable6970If the working tree is dirty with unrelated changes or conflicting concerns:71- Identify the distinct logical groupings.72- Propose committing one subset first.73- Provide the exact files planned for the first commit, deferring the remainder.