Address PR Review Comments Command
Fetches all pending review comments from a GitHub pull request and systematically addresses each one. Creates a structured todo list from reviewer feedback, implements fixes, and marks comments as resolved. Streamlines the PR review cycle.
Command
/address-pr-comments
Description
Fetches all pending review comments from the current branch's pull request using the GitHub CLI, then systematically addresses each comment. The command creates a prioritized task list from reviewer feedback, implements the necessary changes, and provides a summary of what was fixed.
Behavior
Arguments
$ARGUMENTS-- Optional PR number (e.g.,123). If omitted, uses the PR for the current branch.
Steps
-
Identify the PR:
# If PR number provided gh pr view $PR_NUMBER --json number,title,url # If no PR number, find PR for current branch gh pr list --head $(git rev-parse --abbrev-ref HEAD) --json number,title,url -
Fetch all review comments:
gh api repos/{owner}/{repo}/pulls/{number}/comments \ --jq '.[] | {id, path, line, body, user: .user.login, created_at}' -
Categorize and prioritize:
- Must fix: Comments requesting changes ("please change", "this should be", "bug")
- Consider: Suggestions and alternatives ("consider", "alternatively", "nit")
- Questions: Clarification requests ("why", "what", "could you explain")
-
Address each comment:
- Read the referenced file and line
- Understand the reviewer's concern
- Implement the fix or improvement
- Note what was changed and why
-
Generate summary:
- List each comment and what was done
- Flag any comments that need human judgment
- Suggest reply text for each comment
Output Format
## PR Review Comments Addressed ### Fixed (3) | Comment | File | Change Made | |---------|------|-------------| | "Add null check" by @reviewer | src/api.ts:42 | Added guard clause | | "Use const instead of let" by @reviewer | src/utils.ts:15 | Changed to const | | "Missing error handling" by @reviewer | src/db.ts:88 | Added try-catch | ### Needs Discussion (1) | Comment | File | Reason | |---------|------|--------| | "Consider using Redis" by @reviewer | src/cache.ts:12 | Architecture decision - needs team input | ### Suggested Replies - @reviewer on src/api.ts:42 -- "Done - added null check with early return" - @reviewer on src/cache.ts:12 -- "Good point. Created a follow-up issue #456 to evaluate Redis"
Examples
# Address comments on current branch's PR /address-pr-comments # Address comments on a specific PR /address-pr-comments 142 # Address only comments from a specific reviewer /address-pr-comments 142 --reviewer=seniordev
Reviews
No reviews yet. Be the first to review this template!
Similar Templates
Git Commit Message Generator
Generates well-structured conventional commit messages by analyzing staged changes. Follows Conventional Commits spec with scope detection.
React Component Scaffolder
Scaffolds a complete React component with TypeScript types, Tailwind styles, Storybook stories, and unit tests. Follows project conventions automatically.
CI/CD Pipeline Generator
Generates GitHub Actions workflows for CI/CD including linting, testing, building, and deploying. Detects project stack automatically.