| name | pr-open |
| description | Automatically fill PR template from plan.md, commit, push, and open a GitHub pull request for the current branch. Use when the user says "open pr", "create pr", "submit pr", or any variation of opening a pull request. |
/pr-open - Open Pull Request
Use this skill after implementation is complete to create a GitHub pull request. It reads the existing plan.md, fills in the PR template, runs pre-commit checks, commits any remaining changes, pushes, and opens the PR.
Prerequisites
gh CLI installed and authenticated (gh auth login)
- Inside a git repository on a feature branch (not
main/master)
plan.md exists in the repository root
- Implementation work is complete (code changes are committed or staged)
Workflow
Step 1: Validate Environment
- Check current branch: Must NOT be
main or master.
- Check
plan.md exists: Read plan.md from the repository root. If it doesn't exist, inform the user and stop.
- Check for existing PR: Run
gh pr list --head <branch> --json number --jq '.[0].number'. If a PR already exists, inform the user and ask if they want to update it or stop.
- Detect base branch: Default to
main. Verify it exists with git rev-parse --verify main.
Step 2: Read plan.md and Extract Information
Parse plan.md to extract:
- Branch name from the
## Branch section
- Summary from the
## Summary section (used for PR title and summary)
- PR type inferred from the branch name prefix:
feat/ โ feat
fix/ โ fix
docs/ โ docs
refactor/ โ refactor
test/ โ test
chore/ โ chore
perf/ โ perf
style/ โ style
- If no recognized prefix, ask the user which PR type applies
- Full plan content (the entire
plan.md will be embedded in the PR body)
Step 3: Run Tests and Capture Results
Run the test suite to capture results for the PR body:
source .venv/bin/activate
pytest tests/python/unit_test -v 2>&1 | tail -20
Capture:
- Which tests were run (e.g.,
pytest tests/python/unit_test/worker/)
- Result summary (e.g., "12 passed in 3.2s")
If tests fail, inform the user and ask whether to proceed anyway or stop to fix.
Step 4: Format, Lint, and Pre-commit
IMPORTANT: Always activate the venv and run the full pipeline before committing.
source .venv/bin/activate
pre-commit install
ruff format .
ruff check --fix .
pre-commit run --all-files
If pre-commit modifies any files, re-run pre-commit run --all-files until all hooks pass cleanly.
Step 5: Commit Remaining Changes
If there are any uncommitted changes after formatting/linting:
git add -A
git reset HEAD plan.md 2>/dev/null || true
git diff --cached --quiet || git commit -m "chore: final formatting and cleanup before PR"
If there are no changes to commit, skip this step.
Step 6: Build PR Body
Construct the PR body by filling in the PR_TEMPLATE.md template. Use the template from .claude/skills/pr-open/PR_TEMPLATE.md as the structure and fill in each section:
Section 1: PR Type
Check the appropriate box based on the branch name prefix detected in Step 2:
* [x] feat: ์๋ก์ด ๊ธฐ๋ฅ ์ถ๊ฐ
(Only one type should be checked. If multiple apply, check all that apply.)
Section 2: Summary of Changes
Fill in the summary extracted from plan.md's ## Summary section:
* ํต์ฌ ์์ฝ: <summary from plan.md>
Section 3: Full Implementation Plan
Embed the entire contents of plan.md in this section inside a collapsible <details> block:
<details>
<summary>Click to expand full implementation plan</summary>
<content of plan.md>
</details>
Section 4: Test & Human Review
Fill in with the test results captured in Step 3:
### ํ
์คํธ ์ํ ๊ฒฐ๊ณผ
* ์คํํ ํ
์คํธ: `pytest tests/python/unit_test/ -v`
* ๊ฒฐ๊ณผ ์์ฝ: <test result summary, e.g., "15 passed in 4.1s">
Leave the reviewer checklist unchecked (those are for human reviewers).
Section 5: Final Checklist
Check all items that were verified:
* [x] ์ ์ฝ๋๊ฐ ํ๋ก์ ํธ์ ์ฝ๋ ์คํ์ผ ๊ฐ์ด๋๋ผ์ธ์ ๋ฐ๋ฆ
๋๋ค.
* [x] ์ ์ฝ๋๊ฐ ์๋ก์ด ๊ฒฝ๊ณ ๋ฅผ ๋ฐ์์ํค์ง ์์ต๋๋ค.
* [ ] ๋ณ๊ฒฝ ์ฌํญ์ ๋ํ ํ
์คํธ๋ฅผ ์์ฑํ์ต๋๋ค.
* [x] ๊ธฐ์กด ํ
์คํธ๊ฐ ๋ชจ๋ ํต๊ณผํฉ๋๋ค.
* [ ] ํ์ํ ๊ฒฝ์ฐ ๋ฌธ์(documentation)๋ฅผ ์
๋ฐ์ดํธํ์ต๋๋ค.
- Check the style/warnings items only if they were verified in Steps 3-4.
- Leave the "tests written" item unchecked โ the skill runs existing tests but cannot verify new tests were added. The developer should manually confirm this.
- Leave the documentation item unchecked unless docs were explicitly updated.
Step 7: Generate PR Title
Create a concise PR title (under 70 characters) from plan.md:
Format: [<TICKET-ID>] <Summary>
Examples:
[SOFT-1234] Add priority-based dynamic batching
[SOFT-2820] Add pr-review skill for fetching PR review feedback
If no ticket ID is found in the branch name, omit the bracket prefix:
Add streaming support for inference requests
Step 8: Confirm with User Before Creating PR
IMPORTANT: Do NOT create the PR automatically. Always show the user:
- PR Title (generated in Step 7)
- Target branch (e.g.,
main)
- PR body preview (abbreviated โ show the summary and PR type, note that plan.md is included)
- Test results (pass/fail summary)
- Commits included (output of
git log main..HEAD --oneline)
Ask: "Ready to push and create this PR? (yes/no)"
If user wants to modify the title or body, make adjustments before proceeding.
Step 9: Push and Create PR
Only after explicit user confirmation:
git push -u origin <branch-name>
gh pr create --title "<PR title>" --body "$(cat <<'EOF'
<filled PR body>
EOF
)"
After creation, display:
- The PR URL
- PR number
- A brief success message
Error Handling
| Error | Action |
|---|
| Not on a feature branch | Inform user, stop |
No plan.md found | Inform user to run /plan first, stop |
| PR already exists | Show existing PR URL, ask if they want to update or stop |
| Tests fail | Show failures, ask if they want to proceed or fix first |
| Pre-commit fails | Fix and retry (up to 3 times), then ask user |
gh CLI not authenticated | Inform user to run gh auth login, stop |
| Push fails | Show error, suggest git pull --rebase if behind remote |
Example Usage
User says: "open a pr"
- Read
plan.md โ extract summary: "Add pr-review skill for fetching PR review feedback"
- Detect branch:
SOFT-2820-code-review-claude-code-vllm-hyperaccel-workflow
- Infer ticket ID:
SOFT-2820
- Run tests โ 12 passed
- Run formatters โ no changes
- Build PR body with filled template
- Show user: Title =
[SOFT-2820] Add pr-review skill for fetching PR review feedback
- User confirms โ push and create PR
- Display:
https://github.com/hyperaccel/vllm-hyperaccel/pull/84
Notes
- Always uses the current branch โ never ask the user which branch
- The PR body is in Korean following the team's template convention
plan.md is never committed (it's in .gitignore) but its content is embedded in the PR body
- If the branch has no commits beyond
main, inform the user there's nothing to create a PR for
- The skill reads
.claude/skills/pr-open/PR_TEMPLATE.md as the template structure โ if the template is updated, the skill automatically follows the new format