Create Pull Request
Create a GitHub Pull Request following conventional commits, pre-filled with the repo's PR template, and opened in the browser for final review.
Every PR bullet must map to an actual commit or diff hunk: drop claims you can't back with evidence in git log or git diff.
Invariant: never mutate the user's files to satisfy a precondition. If a check in step 1 fails, report it and stop. Do not run git checkout, git restore, git reset, git stash, or git clean against the user's tracked files to "fix" a dirty tree, and do not switch branches to route around a main/master check, those are the user's decisions, not this skill's. The only git commands this skill runs against the working tree are read-only until step 7's git push.
Workflow
Validate preconditions (run this before anything else, including branch analysis)
- Check working tree is clean:
git status --porcelain. Any output means it's dirty.
- If dirty: stop immediately. Show the
git status --porcelain output and tell the user to commit or stash their changes first, e.g. Working tree has uncommitted changes: M README.md. Commit or stash before opening a PR. Do not proceed to step 2, and do not touch the listed files.
- Get current branch:
git branch --show-current.
- If it's
main or master: stop immediately. Tell the user there's no feature branch to open a PR from, e.g. Currently on main — check out a feature branch first. Do not proceed.
- Check commits exist:
git log origin/<base>..HEAD --oneline. If empty, stop and say there's nothing to open a PR for.
- Extract ticket ID from branch name (e.g.,
ABC-123 from feature/ABC-123_description)
Determine base branch
- Use
--base/-b argument if provided
- Otherwise:
gh repo view --json defaultBranchRef -q .defaultBranchRef.name
- Fall back to
main if detection fails
Analyze changes
git log origin/<base>..HEAD --format="%h %s" for commits
git diff origin/<base>...HEAD --stat for file changes
- Synthesize these directly in the main thread: a subagent fan-out is overkill for what one
git log + one diff --stat already summarizes. Only reach for a subagent if the diff is too large to fit in context.
Generate PR title (conventional commit format, max 72 chars)
type(scope): [TICKET-123] description or type(scope): description if no ticket
- Types:
feat, fix, docs, style, refactor, perf, test, build, ci, chore
- Examples:
feat(auth): [ABC-123] add OAuth2 login support, fix(api): resolve null pointer in user endpoint
Fill PR template
Ask for confirmation
- Show a compact summary: ticket, commit count, authors (keep lines under 60 chars)
- Preview the generated title and body
- If the repo has CI configured (
.github/workflows/*.yml) and tests haven't been verified locally this session, suggest running the cc-arsenal:ci-local skill first (via the Skill tool where available, otherwise run the workflow's gating steps locally by hand): cheaper to catch a failure now than after the PR is open
- Ask:
Create PR? (y/n/e to edit): (accept y/yes/n/no/e/edit)
- On
e, ask for custom title/body
Push and create PR (after confirmation)
# Push first — required before gh pr create can reference the branch
git push -u origin $(git branch --show-current)
# BODY_FILE is the file written in step 5
gh pr create \
--title "type(scope): [TICKET] description" \
--body-file "$BODY_FILE" \
--base <determined-base-branch> \
--web
- Do not combine
--reviewer, --assignee, or --label with --web: they conflict. The user adds those in the web UI.
Argument Parsing
--base branch / -b branch: target branch, defaults to repo default
--draft / -d: adds --draft to gh pr create
Examples
git-create-pr # uses repo default base branch
git-create-pr --base develop # target a specific base branch
git-create-pr --draft # create as draft PR
git-create-pr -b develop -d # both
After pushing, the PR opens in the browser pre-filled with title and body. Add reviewers/labels there.
Precondition failure (dirty tree, stop before any analysis):
Working tree has uncommitted changes:
M README.md
Commit or stash before opening a PR. Not proceeding.
No git checkout, git push, or gh pr create runs after this: the turn ends here.
1---2name: git-create-pr3description: Create a GitHub Pull Request from the current branch, following conventional commit format and pre-filling the repo's PR template. Activates on "create a PR", "open a pull request", "push this for review", or similar. Use after commits are made and pushed is not yet done; for the commits themselves use git-commit, for release/hotfix branch PRs use gitflow, and for the full review-then-commit-then-PR pipeline in one go use ship.4---56# Create Pull Request78Create a GitHub Pull Request following conventional commits, pre-filled with the repo's PR template, and opened in the browser for final review.910Every PR bullet must map to an actual commit or diff hunk: drop claims you can't back with evidence in `git log` or `git diff`.1112**Invariant: never mutate the user's files to satisfy a precondition.** If a check in step 1 fails, report it and stop. Do not run `git checkout`, `git restore`, `git reset`, `git stash`, or `git clean` against the user's tracked files to "fix" a dirty tree, and do not switch branches to route around a main/master check, those are the user's decisions, not this skill's. The only git commands this skill runs against the working tree are read-only until step 7's `git push`.1314## Workflow15161. **Validate preconditions (run this before anything else, including branch analysis)**17 - Check working tree is clean: `git status --porcelain`. Any output means it's dirty.18 - If dirty: **stop immediately**. Show the `git status --porcelain` output and tell the user to commit or stash their changes first, e.g. `Working tree has uncommitted changes: M README.md. Commit or stash before opening a PR.` Do not proceed to step 2, and do not touch the listed files.19 - Get current branch: `git branch --show-current`.20 - If it's `main` or `master`: **stop immediately**. Tell the user there's no feature branch to open a PR from, e.g. `Currently on main — check out a feature branch first.` Do not proceed.21 - Check commits exist: `git log origin/<base>..HEAD --oneline`. If empty, stop and say there's nothing to open a PR for.22 - Extract ticket ID from branch name (e.g., `ABC-123` from `feature/ABC-123_description`)23242. **Determine base branch**25 - Use `--base`/`-b` argument if provided26 - Otherwise: `gh repo view --json defaultBranchRef -q .defaultBranchRef.name`27 - Fall back to `main` if detection fails28293. **Analyze changes**30 - `git log origin/<base>..HEAD --format="%h %s"` for commits31 - `git diff origin/<base>...HEAD --stat` for file changes32 - Synthesize these directly in the main thread: a subagent fan-out is overkill for what one `git log` + one `diff --stat` already summarizes. Only reach for a subagent if the diff is too large to fit in context.33344. **Generate PR title** (conventional commit format, max 72 chars)35 - `type(scope): [TICKET-123] description` or `type(scope): description` if no ticket36 - Types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`37 - Examples: `feat(auth): [ABC-123] add OAuth2 login support`, `fix(api): resolve null pointer in user endpoint`38395. **Fill PR template**40 - Look for `.github/pull_request_template.md` and fill it without changing its structure41 - If none exists, use:42 ```markdown43 ## Summary44 [Brief description]4546 ## Changes47 - [Bullet points from commits]4849 ## Testing50 - [ ] Tests added/updated51 - [ ] Manual testing completed52 ```53 - Save to `BODY_FILE="/tmp/pr-body-$(date +%s).md"`54556. **Ask for confirmation**56 - Show a compact summary: ticket, commit count, authors (keep lines under 60 chars)57 - Preview the generated title and body58 - If the repo has CI configured (`.github/workflows/*.yml`) and tests haven't been verified locally this session, suggest running the `cc-arsenal:ci-local` skill first (via the `Skill` tool where available, otherwise run the workflow's gating steps locally by hand): cheaper to catch a failure now than after the PR is open59 - Ask: `Create PR? (y/n/e to edit):` (accept `y`/`yes`/`n`/`no`/`e`/`edit`)60 - On `e`, ask for custom title/body61627. **Push and create PR** (after confirmation)63 ```bash64 # Push first — required before gh pr create can reference the branch65 git push -u origin $(git branch --show-current)6667 # BODY_FILE is the file written in step 568 gh pr create \69 --title "type(scope): [TICKET] description" \70 --body-file "$BODY_FILE" \71 --base <determined-base-branch> \72 --web73 ```74 - Do not combine `--reviewer`, `--assignee`, or `--label` with `--web`: they conflict. The user adds those in the web UI.7576## Argument Parsing7778- `--base branch` / `-b branch`: target branch, defaults to repo default79- `--draft` / `-d`: adds `--draft` to `gh pr create`8081## Examples8283```bash84git-create-pr # uses repo default base branch85git-create-pr --base develop # target a specific base branch86git-create-pr --draft # create as draft PR87git-create-pr -b develop -d # both88```8990After pushing, the PR opens in the browser pre-filled with title and body. Add reviewers/labels there.9192**Precondition failure** (dirty tree, stop before any analysis):93```94Working tree has uncommitted changes:95 M README.md96Commit or stash before opening a PR. Not proceeding.97```98No `git checkout`, `git push`, or `gh pr create` runs after this: the turn ends here.