From pr-monitor
Monitor GitHub pull requests and automatically resume when new commits are detected
How this skill is triggered — by the user, by Claude, or both
Slash command
/pr-monitor:pr-monitorThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Set up automated monitoring of GitHub pull requests that triggers Claude Code to auto-resume and
Set up automated monitoring of GitHub pull requests that triggers Claude Code to auto-resume and review changes when new commits are detected.
Before starting, ensure:
gh) is installed and authenticatedUse this skill when:
Get PR information:
If user provides PR URL, extract repo and PR number:
# Example URL: https://github.com/owner/repo/pull/123
# Extract: owner/repo and PR number 123
If user provides repo and PR number, verify PR exists:
gh pr view PR_NUMBER --repo OWNER/REPO --json number,title,state,headRefOid
If in a git repository, list open PRs:
gh pr list --json number,title,headRefOid --limit 20
Create state file for the Stop hook to monitor:
Get repository path:
# If already in repo
REPO_PATH=$(pwd)
# If remote repo, clone first
gh repo clone OWNER/REPO
cd REPO
REPO_PATH=$(pwd)
Get current commit SHA:
CURRENT_SHA=$(gh pr view PR_NUMBER --json headRefOid --jq '.headRefOid')
Create monitoring state file:
# Format: /tmp/claude_monitor_pr_<repo-name>_<pr-number>
# Extract repo name from path
REPO_NAME=$(basename "$REPO_PATH")
STATE_FILE="/tmp/claude_monitor_pr_${REPO_NAME}_${PR_NUMBER}"
# Write state file with 3 lines: repo_path, pr_number, last_sha
cat > "$STATE_FILE" <<'EOF'
$REPO_PATH
$PR_NUMBER
$CURRENT_SHA
EOF
Confirm monitoring active:
echo "✓ Monitoring enabled for PR #$PR_NUMBER"
echo "✓ State file: $STATE_FILE"
echo "✓ Current commit: ${CURRENT_SHA:0:8}"
cat "$STATE_FILE"
If requested, perform initial review of current PR state:
Get PR details:
gh pr view PR_NUMBER --json title,body,commits,files
View recent changes:
gh pr diff PR_NUMBER
Provide initial feedback:
The Stop hook will now automatically monitor the PR:
When Claude Code would normally stop:
You can continue working on other tasks - monitoring happens automatically in the background.
When new commits are detected, Claude will automatically:
Resume with notification:
Review new changes:
# Get updated PR information
gh pr view PR_NUMBER --json commits,headRefOid,files
# Get diff of new changes
gh pr diff PR_NUMBER
# Compare with previous state if needed
git diff OLD_SHA NEW_SHA
Provide feedback:
# Comment on PR
gh pr comment PR_NUMBER --body "FEEDBACK_TEXT"
# Or request changes via review
gh pr review PR_NUMBER --comment --body "REVIEW_TEXT"
Update monitoring state:
When monitoring is no longer needed:
Remove state file:
rm /tmp/claude_monitor_pr_${REPO_NAME}_${PR_NUMBER}
Confirm stopped:
echo "✓ Monitoring stopped for PR #$PR_NUMBER"
Monitoring will also auto-stop if:
Common issues and solutions:
Hook not triggering:
ls -la /tmp/claude_monitor_pr_*echo '{"stop_hook_active": false}' | bash /path/to/Stop.shPR not accessible:
gh is authenticated: gh auth statusgh pr view PR_NUMBER --repo OWNER/REPOMultiple PRs monitored:
ls -la /tmp/claude_monitor_pr_*cat /tmp/claude_monitor_pr_REPO_PRrm /tmp/claude_monitor_pr_REPO_PRPolling-based, not real-time:
Requires Claude Code running:
State files in /tmp:
GitHub API rate limits:
Monitor selectively:
Provide context in feedback:
Use with other tools:
# 1. User asks to monitor PR #2 in claude-skills repo
cd /path/to/claude-skills
# 2. Get current state
gh pr view 2 --json headRefOid,title,commits
# 3. Create monitoring state
REPO_PATH=$(pwd)
PR_NUMBER=2
CURRENT_SHA=$(gh pr view 2 --json headRefOid --jq '.headRefOid')
REPO_NAME=$(basename "$REPO_PATH")
cat > /tmp/claude_monitor_pr_${REPO_NAME}_${PR_NUMBER} <<EOF
$REPO_PATH
$PR_NUMBER
$CURRENT_SHA
EOF
# 4. Confirm
echo "✓ Now monitoring PR #2 in claude-skills"
echo "✓ Current commit: ${CURRENT_SHA:0:8}"
# 5. Wait for updates (automatic via Stop hook)
# When Copilot pushes new commits, Claude auto-resumes and reviews
After enabling monitoring, verify:
State file created:
ls -la /tmp/claude_monitor_pr_*
State file format correct:
cat /tmp/claude_monitor_pr_REPO_PR
# Should show 3 lines: repo_path, pr_number, sha
PR accessible:
gh pr view PR_NUMBER --repo OWNER/REPO
Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub cajias/claude-skills --plugin pr-monitor