Prompt file imported from akiojin/llmlb (
.claude/commands/gwt-pr.md). Copyright stays with the author.
GitHub PR Command
Use this command to draft or update a GitHub PR with the gh CLI.
Usage
/gwt:gwt-pr [optional context]
Steps
- Load
.claude/skills/gwt-pr/SKILL.mdand follow the workflow. - Ensure
gh auth statussucceeds before running PR commands. - Run the local working tree preflight from the skill (
git status --porcelain); if changes exist, confirm with the user before push/PR operations. - Run the branch sync preflight from the skill (
git rev-list --left-right --count "HEAD...origin/$base"); if the branch is behind, mergeorigin/$baseinto the current branch and push before PR creation. - If that merge produces conflicts, inspect the conflict carefully and only ask the user when it cannot be resolved with high confidence.
- When all PRs for the head are merged, validate merge commit ancestry before counting post-merge commits.
- If the merge commit is missing or not an ancestor of
HEAD, compareorigin/<head>..HEADbefore any base-branch fallback. - If both upstream and base comparisons fail, stop with
MANUAL CHECK; do not create a PR by guesswork. - Generate or update the PR body using the provided templates.
- If
gh pr createorgh pr editfails withwas submitted too quicklyor a secondary rate limit, retry through the REST pull-request endpoint withgh api repos/<owner>/<repo>/pulls.
Examples
/gwt:gwt-pr create draft for current branch
/gwt:gwt-pr update PR body only