Git Commit Workflow
Create a commit from staged changes with a concise, single-line message.
Steps
- •
Check for staged changes
bashgit diff --staged --stat
If nothing staged, inform the user.
- •
Check for unstaged changes
bashgit diff --stat
If unstaged changes exist:
- •Show the user WHAT the unstaged changes are (diff content, not just file names)
- •Use
AskUserQuestionwith options like "Stage them", "Leave unstaged" - •Stage additional files if requested
- •
Read the staged diff content
bashgit diff --staged
- •
Detect convention Run the detection script:
bash~/.claude/skills/git-pr/scripts/detect-convention.sh
If it outputs a convention name, load the corresponding
<convention>-conventionsskill. If it fails, proceed without convention-specific rules. - •
Check branch protection
bashgit branch --show-current
If on
mainormaster:- •If convention is
shellicar-config→ allowed, continue - •Otherwise → STOP and ask user to create a new branch
Do NOT commit directly to main/master (except for config repos). Offer to create a branch:
bashgit checkout -b <branch-name>
- •If convention is
- •
Generate commit message
- •Concise, single line
- •Imperative mood ("Add feature" not "Added feature")
- •No period at end
- •Detail belongs in PRs, not commits
- •
Show the user the proposed commit message and ask for confirmation
Use
AskUserQuestionwith options like "Commit", "Edit message", "Cancel" - •
Commit
bashgit commit -m "message"
- •
Push
bashgit push
IDE Diagnostics
When files are edited, IDE diagnostics may appear. Handle them as follows:
- •Errors: Report to the user and address before committing
- •Warnings/Information: Ignore silently (e.g., spell-checker warnings)
- •Exception: If a warning appears critical or high-severity (e.g., security issue, likely runtime error), you MAY mention it
Do NOT mention trivial non-error diagnostics to the user.
Convention Hooks
Convention skills may define:
- •Work item ID in commit message (e.g.,
AB#1234: Add feature) - •Prefix conventions (e.g.,
feat:,fix:) - •Branch name requirements