Skip to content

Instantly share code, notes, and snippets.

@connorads
Last active August 19, 2025 09:47
Show Gist options
  • Save connorads/55d4ba09c9336ef5553e4fb14827d06e to your computer and use it in GitHub Desktop.
Save connorads/55d4ba09c9336ef5553e4fb14827d06e to your computer and use it in GitHub Desktop.
Generate a prompt to review a GitHub PR and then paste it into ChatGPT, Claude or Gemini etc.
# 🔮 Generate a prompt to review a GitHub PR and then paste it into ChatGPT, Claude or Gemini etc.
# Copy paste this into your .zshrc, restart your shell and run
# pr-prompt https://github.com/connorads/lockbot/pull/148
# But replace with a PR you want to review 👆
# You need to have the GitHub CLI installed
# brew install gh jq
# gh login
# Function to create a prompt to review a GitHub PR
pr-prompt() {
local url=$1
if [[ $url != https://github.com/*/pull/* ]]; then
echo "usage: gh-pr-prompt <PR-url>" >&2
return 1
fi
local owner_repo pr_number
owner_repo=${url#https://github.com/}
owner_repo=${owner_repo%/pull/*}
pr_number=${url##*/}
{
echo "Please review this PR: $url"
echo
echo "## Description"
gh pr view "$url" -R "$owner_repo" --json body \
--jq '.body // "No description provided"'
echo
echo "## Diff"
gh pr diff "$url" -R "$owner_repo"
echo
echo "## Comments"
gh api "repos/$owner_repo/issues/$pr_number/comments?per_page=100" --paginate \
--jq '.[] | "\(.user.login) (\(.created_at)):\n\(.body)\n---"' 2>/dev/null || true
} | pbcopy
echo "✅ PR review prompt copied to clipboard"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment