Prompt file imported from future-architect/uzomuzo-oss (
.github/prompts/commit.prompt.md). Copyright stays with the author.
Pre-Commit Checks
Before creating a commit, run all of the following checks in order. If any check fails, stop immediately and report.
Step 1: Branch Verification
git branch --show-current
- Confirm you are NOT on
main/master(double-check even though Branch Protection blocks it) - Confirm you are on the intended branch
Step 2: Build
go build ./...
Step 3: Test
go test -race ./...
Step 4: Vet & Lint
go vet ./...
golangci-lint run
Step 5: Staging Review
git status
git diff --cached
git diff
- Ensure no secrets (.env, credentials, API keys) are staged
- Ensure no unintended files are included
Commit
Only after all checks pass:
- Stage relevant files (prefer explicit filenames over
git add -A) - Commit with a conventional commits format message (always in English)
- Run
git statusafter commit to verify success
If the user provides a commit message argument, use it. Otherwise, generate an appropriate message from the changes.