| name | pr |
| description | Create pull requests. Triggers: /pr, "create pr", "open pr", "draft pr", "сделай PR", "оформи PR", "пулл реквест". Skip for inspecting an existing PR's state, comments, or CI; those are plain `gh` commands (see Reference).
|
PR
Create a pull request from the current branch.
// Gather state (parallel)
status = Bash(git status)
branch = Bash(git rev-parse --abbrev-ref HEAD)
default_branch = Bash(gh repo view --json defaultBranchRef -q .defaultBranchRef.name)
upstream = Bash(git rev-parse --abbrev-ref @{upstream} 2>/dev/null)
// Gather diff and log (depend on default_branch)
diff = Bash(git diff <default_branch>...HEAD)
log = Bash(git log <default_branch>..HEAD --oneline)
// Guards
if branch == default_branch: stop, ask user to create a feature branch (see /git-branch)
if uncommitted changes in status: Skill(commit)
// Push
if no upstream: Bash(git push -u origin <branch>)
else if ahead: Bash(git push)
// Existing PR
existing = Bash(gh pr view --json url,state -q '.url' 2>/dev/null)
// Template (deterministic resolution via pr-template) — shared by create and update paths
out = Bash(pr-template)
mode = first line of out, stripped of "MODE: " prefix // single | multi | default — see Reference §PR creation details
rest = lines after the first
if mode == "multi":
chosen = AskUserQuestion("pick a template", options = rest)
template_content = Read(<git-root>/chosen)
else:
template_content = rest // single or default — both deliver content directly
if existing:
show URL, AskUserQuestion("update or stop?")
if stop: stop
// update path — reuses template resolved above
title = do("regenerate conventional commit-style title from diff and log")
body = do("regenerate body from diff and log, filling template_content sections; preserve every heading, emoji, and section verbatim")
AskUserQuestion("confirm updated title and body")
Bash(rm -f /tmp/claude/pr.md)
Write(/tmp/claude/pr.md, body)
Bash(gh pr edit --title "<title>" --body-file /tmp/claude/pr.md)
Bash(rm -f /tmp/claude/pr.md)
show PR URL, stop
title = do("generate conventional commit-style title: '<prefix>: <message>' (see /commit skill for prefix and message rules)")
body = do("fill template_content placeholders from diff and log; preserve every heading, emoji, and section verbatim")
AskUserQuestion("confirm title, body, base branch, draft status")
Bash(rm -f /tmp/claude/pr.md)
Write(/tmp/claude/pr.md, body)
Bash(gh pr create --title "<title>" --body-file /tmp/claude/pr.md --draft)
Bash(rm -f /tmp/claude/pr.md)
show PR URL
Reference
PR creation details
Inspecting an existing PR
Checking a PR's state, comments, or CI sits outside this skill's workflow — run gh directly. <pr> is a number, URL, or branch; omit it to act on the PR for the current branch.
- State and metadata:
gh pr view <pr> — title, body, state, labels, reviewers. Add --json state,mergeable,reviewDecision,statusCheckRollup for a machine-readable summary.
- CI checks:
gh pr checks <pr> — one line per check with pass/fail/pending. gh pr checks <pr> --watch blocks until checks settle.
- A failing run's logs:
gh run view <run-id> --log-failed — only the failed steps. Get <run-id> from the gh pr checks output.
- Review comments and threads:
gh pr view <pr> --comments — issue comments plus review threads in one stream.
- The diff:
gh pr diff <pr>.
When CI fails: classify each failure as mechanical (lint, format, types — fixable by editing and re-pushing) or semantic (tests, infrastructure — needs diagnosis). Fix mechanical failures with a fix: commit via the /commit skill, then git push.
Rules
- Run git commands separately. Chained commands (
&&, ;) bypass the permissions allowlist.
- Auto-detect base branch. Use
gh repo view. Ask the user only when detection fails.
- Commit first when the tree is dirty. Route uncommitted changes through the /commit skill first.