--- name: git-commit path: .git disable-model-invocation: true description: "Commit selected changes in a Git repository. Use when asked to commit, record, or split current work without pushing." --- # Git Commit Preserve unrelated work and never bypass hooks. ## Procedure 1. Inspect `git status --short --branch`, the unstaged diff, and any staged diff. 2. Stop if HEAD is detached or a merge, rebase, cherry-pick, or revert is in progress unless the request explicitly covers that operation. 3. Stop if clean. 4. Read relevant untracked files before deciding whether to stage them. Exclude generated files, caches, secrets, and unrelated work. 5. Split unrelated changes into focused commits when safe; otherwise ask. 6. Run obvious fast checks and every repository-required gate. Report expensive or unclear checks that were not run. 7. Stage only the intended paths and inspect the complete staged diff. 8. Commit without pushing. If a hook only formats relevant files, inspect and restage those files, then retry once. For any other hook failure, preserve its edits and stop with evidence. 9. Report the commit hash, subject, checks, and remaining working-tree state. ## Commit messages - Use a short, concrete subject without a final period. - Prefer `add`, `fix`, `update`, `remove`, `replace`, `track`, `show`, or `rework`. - Use `type(scope): summary` when natural: `feat`, `fix`, `docs`, `chore`, `refactor`, `test`, `perf`, `build`, or `ci`. - Use a domain prefix such as `ui:`, `db:`, `cli:`, or `docs:` when clearer; start the text after a prefix lowercase. - Use a body only when rationale or non-obvious constraints matter. - Preserve relevant work-item identifiers supplied by the user or repository policy. - Add no AI attribution or trailers.