| name | committing-and-creating-pr |
| description | Guides local Git commit preparation and pull-request drafting with staged-diff and secret checks. Use when the user asks to commit changes, prepare a conventional commit, or draft a PR. When a dedicated GitHub publishing workflow is available, use it for pushing and opening the PR after these local checks. |
Git Commit & PR Guide
Secure commits with consistent style.
Pre-Commit Security Check
Before committing, scan for:
- API keys (
sk-, AKIA, ghp_)
- Passwords in code
.env files tracked by git
- Private keys (
.pem, .p12)
git diff --cached | grep -iE "(password|api_key|secret|token).*="
Commit Workflow
Step 1: Stage Changes
git add <specific-files>
Step 2: Review Staged
git diff --cached
Step 3: Commit
git commit -m "$(cat <<'EOF'
feat(auth): add JWT token validation
Implement token validation middleware with refresh logic.
EOF
)"
Commit Message Format
<type>(<scope>): <subject>
<body>
Types: feat, fix, docs, style, refactor, test, chore
PR Creation
gh pr create --title "feat: add feature" --body "$(cat <<'EOF'
## Summary
- Change 1
- Change 2
## Test plan
- [ ] Unit tests pass
- [ ] Manual testing done
EOF
)"
Security Rules
NEVER commit:
.env files
- API keys/tokens
- Private keys
- Credentials
Always check:
git status
git diff --cached