Create a pull request in the background
Creates a pull request in the background while you continue working.
/plugin marketplace add bendrucker/claude/plugin install pull-request@bendruckerCreate a pull request for the current branch, running the push and PR creation in the background so I can continue working. Works with GitHub and GitLab (load the gitlab skill for GitLab repositories).
Before spawning any background agent, capture the current git state:
git rev-parse --show-toplevel # Worktree/repo root
git branch --show-current # Current branch
git rev-parse HEAD # Current commit SHA
git status --porcelain # Check for uncommitted changes
gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name' # Base branch
If git status --porcelain shows uncommitted changes:
fix-typo, add-feature)git checkout -b <topic-branch>git add -Agit checkout <original-branch>Do not background until changes are committed on a topic branch and you've returned to the original branch.
Use the Task tool with run_in_background: true and subagent_type: "general-purpose".
Pass this prompt to the agent, substituting the captured values:
Create a pull request with the following pre-captured state:
- Working directory: <captured worktree root>
- Branch: <captured branch name>
- Commit SHA: <captured commit SHA>
- Base branch: <captured base branch>
## Instructions
1. Change to the working directory
2. Push the branch: `git push -u origin <branch>`
3. Load the pull-request skill for formatting guidelines
4. Write the PR body to `tmp/pr-body-<branch>.md` following the skill format:
- Start with 1-3 sentences summarizing the change (NO leading ## header)
- Use `## Changes` for bulleted list of changes
- Use `## Testing` only if tests were added or manual testing is needed
5. Create the PR: `gh pr create --base <base-branch> --head <branch> --title "..." --body-file tmp/pr-body-<branch>.md`
6. Return the PR URL
## Constraints
- Do NOT make any commits - only push and create PR
- Use the captured working directory path (important for worktrees)
- MUST use `--body-file` with a temp file - heredocs fail in sandbox environments
- Follow the pull-request skill for title and body formatting
After spawning the background agent, inform me that:
If I provided arguments ($ARGUMENTS), pass them to the background agent as additional context for the PR description.