| name | git-pr-workflow |
| description | Review branch diff, derive a descriptive commit message, run Go checks, then commit, push, and open a PR with gh. Use when this capability is needed. |
| metadata | {"author":"abdelazizmoustafa10m"} |
Git PR Workflow
Use this skill when the user asks to prepare changes for git, commit, push, and open a PR.
Required Sequence
- Confirm branch context and inspect diffs.
- Draft a descriptive commit message from actual code changes.
- Run Go verification checks before staging/committing.
- Only if checks pass: stage, commit, push.
- Create PR with
gh.
Do not skip or reorder these steps.
1. Branch and Diff Review
Run:
git branch --show-current
git status --short
git diff --stat
git diff
git diff --staged
Rules:
- If branch is
main or master, stop and ask the user for confirmation before committing.
- If there are no changes, stop and report no-op.
- Use the diff to understand what changed before writing commit/PR text.
2. Commit Message Construction
Create a commit message from the diff, not from guesswork.
Use Conventional Commits style:
- Title format:
<type>(<scope>): <summary>
- Common types:
feat, fix, refactor, docs, test, chore
- Summary: imperative, specific, <= 72 chars
- Optional body: short bullets describing key changes and rationale
Examples:
feat(discovery): implement parallel file walker with errgroup
fix(config): prevent panic on missing TOML key
refactor(pipeline): extract FileDescriptor to shared types
test(security): add redaction golden tests for AWS keys
3. Mandatory Pre-Commit Checks
Before git add or git commit, run:
./run_pipeline_checks.sh
If checks fail:
- Attempt to fix the issue
- Re-run checks
Rules:
- Never commit when required checks fail.
- The script runs the following checks in order (fail-fast):
gofmt -l . — formatting check
go vet ./... — vetting
golangci-lint run — linting (skipped gracefully if not installed)
go mod tidy + diff check — module hygiene
go test -race -count=1 ./... — testing
go build ./cmd/harvx/ — build (optional with --with-build flag)
4. Stage and Commit
Only after all checks pass:
git add <specific-files>
git commit -m "<title>" -m "<body>"
Prefer staging specific files over git add -A.
5. Push Branch
branch="$(git branch --show-current)"
git push --set-upstream origin "$branch" || git push origin "$branch"
6. Create PR
branch="$(git branch --show-current)"
base="$(gh repo view --json defaultBranchRef -q .defaultBranchRef.name)"
gh pr create --base "$base" --head "$branch" --title "<pr-title>" --body "<pr-body>"
PR body should include:
## Summary
- [Key changes in bullets]
## Task Reference
- [T-XXX if applicable]
## Verification
- `go build` pass
- `go vet` pass
- `go test` pass
## Test Plan
- [How to verify the changes]
Final Report Format
Return:
- Branch name
- Commit title used
- Verification check results
- Push result
- PR URL
Converted and distributed by TomeVault — claim your Tome and manage your conversions.