Commit Skill
Create atomic, logically separated git commits. First follow any repo-specific commit guidelines; if none exist, use the conventional commits format below. Focus on WHY over WHAT. Use imperative mood and paragraph body (no bullet lists).
WORKING DIRECTORY: optional argument, default current directory.
Granularity (critical)
- •One logical change per commit; never bundle unrelated changes
- •If multiple logical units exist, create multiple commits; do not batch them into one
- •Renames/moves/structure-only changes are their own logical unit when separate from content changes
- •Use
git add -pfor mixed changes in a single file - •Interactive staging via pipe:
printf 'y\nn\ny\n' | git add -p <file> - •Verify with
git diff --cachedbefore each commit
Format
- •If the repo defines commit conventions (
*.mdfiles), follow them - •Otherwise use conventional commits:
- •Subject <= 52 chars, imperative
- •Format:
type(scope): description - •Types:
feat,fix,docs,style,refactor,perf,test,build,ci,chore
Workflow
- •Check for repo commit guidelines
- •
git status -sandgit diff --stat - •Group changes by logical unit
- •Stage precisely -> verify -> commit
- •Repeat steps 3-4 until all relevant changes are committed or user says stop
- •Final:
git log --oneline -n <count>
Return only: git log --oneline output of created commits
Optional arguments: $ARGUMENTS