Fix PR Comments
Automatically address feedback from GitHub pull request comments.
What it does
- •Reads PR comments: Uses
/pr:get-detailsskill to fetch and display all comments (both PR-level and code review comments) from the current pull request - •Filters addressed comments: Skips comment threads where the last reply starts with "Claude Replied:" (these have already been addressed)
- •Parses feedback: Analyzes each unresolved comment to understand what needs to be fixed
- •Reads affected files: Uses the Read tool to examine files mentioned in comments
- •Applies fixes: Makes the necessary code changes using the Edit or Write tools
- •Commits and pushes changes: Uses the
/git:commitskill to stage, commit with a descriptive message, and push changes to the remote branch - •Replies to comments: Uses
gh api -X POST repos/:owner/:repo/pulls/{pr}/comments/{comment_id}/repliesto reply directly to each review comment thread, confirming the fix. IMPORTANT: All replies must start with "Claude Replied:" to mark the thread as resolved and prevent re-triggering
Prerequisites
Check PR Status:
!if [ -s /tmp/.pr_status ]; then echo "[OK] PR exists: $(cat /tmp/.pr_status)"; else echo "[WARN] No PR created yet"; fi
Before proceeding, verify PR exists:
bash
if [ ! -s /tmp/.pr_status ]; then
echo "[ERROR] No PR has been created yet."
exit 1
fi
- •Must be run in a git repository
- •GitHub CLI (
gh) must be installed and authenticated - •Must have write access to the repository
- •Pull request must exist for the current branch
- •Requires
/pr:get-detailsskill to be available - •Requires
/git:commitskill to be available
Technical Details
- •Uses
/pr:get-detailsskill to fetch both PR-level and code review comments in a formatted way - •The
/pr:get-detailsskill internally usesgh pr viewandgh apito gather all comment information - •Identifying addressed comments: A comment thread is considered addressed if its last reply starts with "Claude Replied:"
- •Only processes unresolved comments (those without "Claude Replied:" in the last reply)
- •Uses
/git:commitskill to stage, commit, and push changes to the remote branch - •Replies use
gh api -X POST repos/:owner/:repo/pulls/{pr}/comments/{comment_id}/repliesto thread responses - •Reply Format: All replies must start with "Claude Replied:" to mark threads as resolved
- •Handles multiple comments in a single run
Notes
- •The command will process all unresolved review comments on the PR
- •Identifying resolved comments: If a comment thread's last reply starts with "Claude Replied:", it means the comment has been addressed and will be skipped
- •Each fix is committed separately for better tracking
- •Replies are added to the specific comment thread, not as new top-level comments
- •Reply Format: All comment replies must start with "Claude Replied:" to prevent the monitoring system from re-triggering on already-handled feedback
- •The monitoring system automatically filters out threads with "Claude Replied:" in the last reply