SKILL.md
Get PR Details
Retrieves and displays pull request information including title, description, changed files, and review comments.
Prerequisites
!```bash CURRENTBRANCH=$(git branch --show-current) [ -n "$CURRENTBRANCH" ] || CURRENT_BRANCH="detached-$(git rev-parse --short=12 HEAD)"
GitHub is the source of truth for PR state — no local status file required.
This works for both standard and fork workflows.
if git remote get-url upstream >/dev/null 2>&1; then UPSTREAMREPO=$(git remote get-url upstream | sed 's/.github.com[:/]//' | sed 's/.git$//') FORKOWNER=$(git remote get-url origin | sed 's/.github.com[:/]//' | sed 's/.git$//' | cut -d'/' -f1) PR=$(gh pr list --repo "$UPSTREAMREPO" --head "$FORKOWNER:$CURRENTBRANCH" --state open --json number,url,state -q '.[0]') else PR=$(gh pr list --head "$CURRENTBRANCH" --state open --json number,url,state -q '.[0]') fi
if [ -z "$PR" ] || [ "$PR" = "null" ]; then echo "[ERROR] No open pull request found for branch '$CURRENT_BRANCH'. Create one with /pr:create first." exit 1 fi echo "[OK] PR #$(printf '%s' "$PR" | jq -r .number): $(printf '%s' "$PR" | jq -r .url)"
## PR Information
Fetched in a single `gh pr view` call (plus one `gh api` call for inline code comments) to keep API usage and tokens low:
!```bash
PR=$(gh pr view --json number,title,headRefName,baseRefName,body,files,reviews,comments)
N=$(printf '%s' "$PR" | jq -r '.number')
echo "Title:"
printf '%s' "$PR" | jq -r '.title'
echo; echo "Branch:"
printf '%s' "$PR" | jq -r '"\(.headRefName) → \(.baseRefName)"'
echo; echo "Description:"
printf '%s' "$PR" | jq -r '.body'
echo; echo "Changed files:"
printf '%s' "$PR" | jq -r '.files[].path'
echo; echo "Review comments:"
printf '%s' "$PR" | jq -r '.reviews[] | "**\(.author.login)** (\(.state)) - \(.submittedAt):\n\(.body)\n"'
echo; echo "Inline review comments (code comments):"
gh api repos/:owner/:repo/pulls/"$N"/comments --jq '.[] | "**\(.user.login)** on \(.path):\(.line) - \(.created_at) [comment_id:\(.id)]:\n\(.body)\n"'
echo; echo "PR comments:"
printf '%s' "$PR" | jq -r '.comments[] | "**\(.author.login)** - \(.createdAt):\n\(.body)\n"'
Instructions
IMPORTANT: You MUST output a summary to the user. After gathering the PR information above, display a formatted summary that includes:
- PR Title - The pull request title
- Branch - Source branch → target branch
- Description - The PR description/body (summarized if lengthy)
- Changed Files - List of files modified in this PR
- Review Comments - Summary of overall review feedback (if any)
- Inline Review Comments - Code-specific comments attached to lines (if any)
- PR Comments - Summary of general comments (if any)
Format the output clearly using markdown so the user can see the PR details at a glance. This summary should always be visible in your response to the user.
Always pass
--jsonwith explicit fields togh pr view/gh pr list; bare calls fail on the Projects (classic) deprecation.