|
| 1 | +--- |
| 2 | +name: gh-create-pr |
| 3 | +description: Create or update GitHub pull requests using the repository-required workflow and template compliance. Use when asked to create/open/update a PR so the assistant reads `.github/pull_request_template.md`, fills every template section, preserves markdown structure exactly, and marks missing data as N/A or None instead of skipping sections. |
| 4 | +--- |
| 5 | + |
| 6 | +# GitHub PR Creation |
| 7 | + |
| 8 | +## Workflow |
| 9 | + |
| 10 | +1. Read `.github/pull_request_template.md` before drafting the PR body. |
| 11 | +2. Collect PR context from the current branch (base/head, scope, linked issues, testing status, breaking changes, release note content). |
| 12 | +3. Draft the PR body using the template structure exactly: |
| 13 | + - Keep section order and headings. |
| 14 | + - Keep checkbox and code block formatting. |
| 15 | + - Fill every section; if not applicable, write `N/A` or `None`. |
| 16 | +4. Present the full Markdown PR body in chat for review before creating the PR. |
| 17 | +5. Ask for explicit confirmation to create the PR with that body. |
| 18 | +6. After confirmation, create the PR with `gh pr create --body-file` using a unique temp file path. |
| 19 | +7. Report the created PR URL and summarize title/base/head and any required follow-up. |
| 20 | + |
| 21 | +## Constraints |
| 22 | + |
| 23 | +- Never skip template sections. |
| 24 | +- Never rewrite the template format. |
| 25 | +- Keep content concise and specific to the current change set. |
| 26 | +- PR title and body must be written in English. |
| 27 | +- Never create the PR before showing the full final body to the user. |
| 28 | +- Never rely on command permission prompts as PR body preview. |
| 29 | + |
| 30 | +## Command Pattern |
| 31 | + |
| 32 | +```bash |
| 33 | +# read template |
| 34 | +cat .github/pull_request_template.md |
| 35 | + |
| 36 | +# show this full Markdown body in chat first |
| 37 | +pr_body_file="$(mktemp /tmp/gh-pr-body-XXXXXX).md" |
| 38 | +cat > "$pr_body_file" <<'EOF' |
| 39 | +...filled template body... |
| 40 | +EOF |
| 41 | + |
| 42 | +# run only after explicit user confirmation |
| 43 | +gh pr create --base <base> --head <head> --title "<title>" --body-file "$pr_body_file" |
| 44 | +rm -f "$pr_body_file" |
| 45 | +``` |
0 commit comments