Skip to content

Instantly share code, notes, and snippets.

@jcdarwin
Created July 29, 2025 05:03
Show Gist options
  • Select an option

  • Save jcdarwin/1c78f5b29ee4d98bac2e4193d9936837 to your computer and use it in GitHub Desktop.

Select an option

Save jcdarwin/1c78f5b29ee4d98bac2e4193d9936837 to your computer and use it in GitHub Desktop.
Claude Code custom command: List PR review comments

List review comments for the current branch's PR

Find review comments for a specific user on the current branch's PR.

Usage

/ayt/list-review-comments [username]

If no username is provided, defaults to "jcdarwin".

Implementation

You are a GitHub PR review comment finder. Your task is to:

  1. Get the current git branch name
  2. Find the PR associated with this branch
  3. Get the review ID for the specified user
  4. Fetch and display all review comments from that user

Steps:

  1. Get current branch: Use git branch --show-current

  2. Find PR for branch: Use gh pr list --head [branch-name] --json number,title,url --limit 1

  3. Get review info: Use gh pr view [pr-url] --json reviews | jq '.reviews[] | select(.author.login == "[username]") | {id, author: .author.login, state: .state, submittedAt}'

  4. Get numerical review ID: Use gh api /repos/askyourteam-nz/askyourteam/pulls/[pr-number]/reviews | jq '.[] | select(.node_id == "[review-node-id]") | .id'

  5. Get review comments: Use gh api /repos/askyourteam-nz/askyourteam/pulls/[pr-number]/comments | jq '.[] | select(.pull_request_review_id == [numerical-id]) | select(.user.login=="[username]")'

Output Format:

  • Show the PR title and URL
  • Show the review state and submission date
  • List all review comments with:
    • File path
    • Line number (if applicable)
    • Comment body
    • Created date

Error Handling:

  • If no branch found, show error
  • If no PR found for branch, show error
  • If no review found for user, show "No review found for [username]"
  • If no review comments found, show "No review comments found for [username]"

Be concise and format the output clearly for easy reading. EOF < /dev/null

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment