git-commit-guard
Installation
SKILL.md
Git Commit Guard
Treat every coding task as operating on a potentially valuable worktree.
Start Of Turn
- Run
git status --short --branchfirst. - If the repository is clean, continue to the requested work.
- If the repository is dirty, stop new development first.
- Inspect modified, deleted, and untracked files with
git diff --stat,git diff, and targeted file reads. - Summarize what changed by file and by intent before editing anything else.
- Infer the strongest reasonable validation from the repo itself. Prefer existing test, lint, type-check, compile, or build commands over ad hoc checks.
- Use the narrowest command that gives real signal for the dirty changes, then broaden if the change is cross-cutting.
- If validation fails, surface the blocker immediately. Fix it only when that is in scope and safe; otherwise do not create a normal commit.
- If validation passes and the dirty changes are intentional, create a detailed Chinese git commit before starting the next implementation step.
Dirty Worktree Handling
When git status is not clean, do all of the following before new development: