| name | git-commit |
| description | Generate a well-formatted Git commit message based on staged changes. Use when the user wants to commit code and needs a clear, conventional commit message written for them. |
Git Commit
Generate a commit message for the current staged changes.
Steps
- Run
git diff --cached to see what is staged.
- If nothing is staged, run
git status and tell the user to stage files first.
- Analyze the diff: identify what changed, why it likely changed, and what component/scope is affected.
- Write a commit message following the Conventional Commits format:
<type>(<scope>): <short summary>
<optional body: what and why, not how>
Types: feat, fix, refactor, chore, docs, test, style, perf, ci
Rules:
- Summary line: max 72 chars, imperative mood ("add" not "added")
- Scope: the module, file, or feature area affected (optional but preferred)
- Body: only when the change needs context beyond the summary
- Show the commit message to the user and ask for confirmation or edits.
- Once confirmed, run
git commit -m "<message>" (or with -m for body if needed).