Prompt file imported from joey-yoonsung/real-vibe-coding-python-public (
.claude/commands/pr.md). Fill in{{arguments}}before use. Copyright stays with the author.
description: Create a pull request automatically using the project PR template. allowed-tools: Bash, Read, Glob, Grep argument-hint: <optional: target base branch, default main>
Automatic Pull Request Creation
Create a pull request for the current branch using the project's PR template.
Workflow
Step 1: Validate State
- Run
git statusto check for uncommitted changes. If there are uncommitted changes, warn the user and stop. - Get the current branch name with
git branch --show-current. If onmain, warn the user and stop. - Determine the base branch: use
{{arguments}}if provided, otherwise default tomain.
Step 2: Gather Context
Run these commands to understand the changes:
git log <base>..HEAD --onelineto get all commits since diverging from base.git diff <base>...HEAD --statto get changed files summary.git diff <base>...HEADto get the full diff.
If there are no commits ahead of base, warn the user and stop.
Step 3: Read PR Template
Read the PR template from .github/PULL_REQUEST_TEMPLATE.md.
Step 4: Analyze Changes and Fill Template
Based on the commits and diff, fill in the PR template:
- Summary: Synthesize a concise summary from all commits and changes. Focus on "why" not "what".
- Change Type: Determine if changes are structural, behavioral, or both based on the commits and diff content.
- Changes: List the key changes as bullet points derived from the commits.
- How to Test: Keep the default test steps unless changes require specific testing.
- Checklist: Check off items that are confirmed (tests pass, linting passes, etc.).
Step 5: Determine PR Title
Create a concise PR title (under 70 characters) that summarizes the changes. Follow conventional format:
feat: ...for new featuresfix: ...for bug fixesrefactor: ...for structural changesdocs: ...for documentationchore: ...for maintenance taskstest: ...for test additions
Step 6: Push and Create PR
- Push the current branch to remote:
git push -u origin <current-branch> - Create the PR using
gh pr create:
gh pr create --title "<title>" --base <base-branch> --body "$(cat <<'EOF'
<filled template content>
EOF
)"
Step 7: Report Result
Output the PR URL so the user can review it.
Important Rules
- Never force-push
- Never create a PR from
maintomain - Always push before creating the PR
- Use the full diff context to write accurate summaries
- Keep the PR title short and descriptive
