Skill: Smart Git Commit
Use this skill when the user runs /commit or asks to commit changes.
Instructions
- •
Analyze Context:
- •Run
git statusto identify modified, added, or deleted files. - •Run
git diffto inspect the actual code changes in unstaged files. - •Run
git diff --cachedto inspect changes in staged files.
- •Run
- •
Stage Changes:
- •If there are unstaged changes, run
git add -Ato stage all changes (unless the user specifically asked to partial commit).
- •If there are unstaged changes, run
- •
Generate Commit Message:
- •Analyze the diffs to understand the intent of the changes.
- •Draft a commit message following the Conventional Commits specification:
code
<type>(<scope>): <description> [optional body]
- •Types:
feat,fix,docs,style,refactor,perf,test,build,ci,chore. - •Scope: (Optional) The module or file affected (e.g.,
proxy,ui,deps). - •Description: Concise summary in imperative mood (e.g., "add support for...", not "added").
- •
Execute Commit:
- •Run
git commit -m "generated_message". - •If the message has a body, use multiple
-mflags or a heredoc.
- •Run
- •
Report:
- •Inform the user of the commit message used and the result.