commit-with-context
Installation
SKILL.md
Gather context
The repository to commit in is the one the user named, which may differ from the session's working directory; when none is named, it is the session's repository. Run every git command below and in the rest of this workflow against that repository with git -C <repo>:
- Current status:
git status --short - Staged changes:
git diff --cached - Unstaged changes:
git diff --stat - Current branch:
git branch --show-current - Recent commit messages:
git log -5 --format='%h%n%s%n%b%n---'
Scope the commit
- Treat a non-empty index as the intended commit scope. Do not stage additional paths unless the user explicitly asks you to select changes from the worktree.
- When the index is empty, stage only paths that belong to the requested task after inspecting their contents, including relevant untracked files.
- Do not include unrelated or pre-existing changes. If the index mixes unrelated work, stop and report the conflict instead of silently restaging it.
- Do not modify source files while performing the commit workflow.