Iterate on PR Feedback
Fetch review comments, address each issue, and request re-review.
Workflow
- •Identify PR - Get PR number from branch or argument
- •Fetch review comments - Get all unresolved feedback
- •Address each comment - Fix issues, apply suggestions
- •Commit and push - Save changes to PR branch
- •Request re-review - Comment with configurable review command
Step 1: Identify PR
If $ARGUMENTS is provided, use it as the PR number. Otherwise, detect from current branch:
bash
if [ -n "$ARGUMENTS" ]; then
PR_NUMBER="$ARGUMENTS"
else
PR_NUMBER=$(gh pr view --json number --jq '.number' 2>/dev/null)
if [ -z "$PR_NUMBER" ]; then
echo "ERROR: No PR found for current branch"
echo "Usage: /sdlc:iterate <PR_NUMBER>"
exit 1
fi
fi
Step 2: Fetch Review Comments
Get all review comments from the PR:
bash
gh api repos/{owner}/{repo}/pulls/$PR_NUMBER/comments --jq '.[] | {path: .path, line: .line, body: .body, id: .id}'
Also check for review summaries:
bash
gh pr view $PR_NUMBER --json reviews --jq '.reviews[] | {author: .author.login, body: .body, state: .state}'
Parse the comments to identify:
- •High priority issues (bugs, security, data loss)
- •Medium priority suggestions (improvements, best practices)
- •Low priority style/formatting comments
Step 3: Address Each Comment
For each review comment:
- •Read the file and understand the context
- •Apply the suggested fix or improvement
- •If the suggestion is unclear, use best judgment
- •Track which comments were addressed
Important: If a comment requires clarification or you disagree with the suggestion, note it for the summary but still make a reasonable fix.
Step 4: Commit and Push
Stage all changes and create a commit:
bash
git add -A git commit -m "$(cat <<'EOF' Address PR review feedback <list of addressed items> Co-Authored-By: Claude <noreply@anthropic.com> EOF )" git push
Step 5: Request Re-Review
Get the configured review command (same pattern as review skill) and comment on the PR:
bash
# Get review command: git config > env var > default
REVIEW_CMD=$(git config --get sdlc.review-command 2>/dev/null)
if [[ -z "$REVIEW_CMD" ]]; then
REVIEW_CMD=${SDLC_REVIEW_COMMAND:-"/gemini review"}
fi
Summarize what was addressed and request re-review:
bash
gh pr comment $PR_NUMBER --body "$(cat <<EOF ## Feedback Addressed <bulleted list of changes made> $REVIEW_CMD EOF )"
Output
Report completion:
code
PR #<number> updated Addressed <N> review comments Re-review requested via: <REVIEW_CMD>