A

Advanced Iterate Pr

Comprehensive skill designed for iterate, until, passes, need. Includes structured workflows, validation checks, and reusable patterns for sentry.

SkillClipticssentryv1.0.0MIT
0 views0 copies

Advanced Iterate PR

A pull request iteration skill for systematically reviewing, refining, and improving pull requests through structured feedback cycles, automated checks, and collaborative workflows.

When to Use

Choose Advanced Iterate PR when:

  • Iterating on pull request feedback from code reviewers
  • Managing complex PR review cycles with multiple rounds of changes
  • Automating PR quality checks and ensuring all feedback is addressed
  • Tracking review comments and their resolution status across iterations

Consider alternatives when:

  • Creating a new PR from scratch — use standard git workflow
  • Performing one-time code review — use a code review tool
  • Managing release branches — use a release management tool

Quick Start

# View all review comments on current PR gh pr view --comments gh pr checks # Address review feedback and push updates git add -p # Stage specific changes addressing feedback git commit -m "fix(auth): address review feedback on token validation - Add null check for expired tokens per @reviewer comment - Extract validation logic into separate function - Add unit tests for edge cases" git push
import subprocess import json import re class PRIterator: def __init__(self, pr_number): self.pr_number = pr_number self.comments = [] self.resolved = [] self.pending = [] def fetch_comments(self): """Fetch all review comments from GitHub""" result = subprocess.run( ["gh", "api", f"repos/:owner/:repo/pulls/{self.pr_number}/comments"], capture_output=True, text=True ) self.comments = json.loads(result.stdout) self._categorize_comments() def _categorize_comments(self): for comment in self.comments: if comment.get("resolved", False): self.resolved.append(comment) else: self.pending.append(comment) def create_iteration_checklist(self): """Generate a checklist from pending review comments""" checklist = [] for c in self.pending: checklist.append({ "file": c.get("path", ""), "line": c.get("line", 0), "reviewer": c["user"]["login"], "comment": c["body"][:200], "addressed": False }) return checklist def push_iteration(self, message): """Commit and push with iteration tracking""" iteration = len(self.get_iterations()) + 1 full_message = f"review(iteration-{iteration}): {message}" subprocess.run(["git", "add", "-A"]) subprocess.run(["git", "commit", "-m", full_message]) subprocess.run(["git", "push"]) def get_iterations(self): """Count previous iteration commits""" result = subprocess.run( ["git", "log", "--oneline", "--grep=review(iteration"], capture_output=True, text=True ) return result.stdout.strip().split("\n") if result.stdout.strip() else [] def summarize_changes(self): """Summarize what was changed in this iteration""" result = subprocess.run( ["git", "diff", "--stat", "HEAD~1"], capture_output=True, text=True ) return { "pending_comments": len(self.pending), "resolved_comments": len(self.resolved), "changes": result.stdout.strip() }

Core Concepts

PR Iteration Workflow

PhaseActionsTools
Review ReceivedRead all comments, categorize by prioritygh pr view --comments
Plan ChangesCreate checklist from feedbackCustom scripts
ImplementMake targeted changes per commentEditor + git
VerifyRun tests, lint, type checkCI pipeline
RespondReply to each comment with resolutiongh pr comment
PushPush iteration with descriptive commitgit push
Request Re-reviewNotify reviewers of updatesgh pr edit --add-reviewer

Automated PR Quality Gates

#!/bin/bash # pr-quality-check.sh — Run before requesting re-review echo "=== PR Quality Check ===" # Check all CI passes gh pr checks --fail-fast || { echo "CI checks failing"; exit 1; } # Verify no unresolved conversations pending=$(gh api "repos/:owner/:repo/pulls/$1/comments" \ --jq '[.[] | select(.resolved == false)] | length') if [ "$pending" -gt 0 ]; then echo "Warning: $pending unresolved review comments" fi # Check for fixup commits that need squashing fixups=$(git log --oneline origin/main..HEAD | grep -c "fixup\|squash") if [ "$fixups" -gt 0 ]; then echo "Warning: $fixups fixup commits need squashing before merge" fi # Verify branch is up to date with base git fetch origin main behind=$(git rev-list HEAD..origin/main --count) if [ "$behind" -gt 0 ]; then echo "Branch is $behind commits behind main — rebase recommended" fi echo "=== Quality Check Complete ==="

Configuration

OptionDescriptionDefault
pr_numberPull request number to iterate onAuto-detect from branch
base_branchBase branch for comparison"main"
auto_resolveMark comments resolved after pushfalse
squash_fixupsAuto-squash fixup commits before mergetrue
require_all_resolvedBlock merge if comments unresolvedtrue
notify_reviewersAuto-request re-review after pushtrue
iteration_prefixCommit message prefix for iterations"review"
max_iterationsWarning threshold for iteration count5

Best Practices

  1. Address all review comments explicitly by replying to each one with what you changed or why you disagree — silent pushes leave reviewers wondering if their feedback was seen or ignored
  2. Group related changes into single iteration commits rather than making one commit per comment; this keeps the history clean and makes re-review faster for the reviewer
  3. Rebase onto the latest base branch before pushing iteration updates to avoid merge conflicts that complicate the review and to ensure your changes work with the latest codebase
  4. Use fixup commits during iteration then squash them before merging so the final commit history is clean while the review process maintains a clear trail of what changed per iteration
  5. Set a reasonable iteration limit — if a PR requires more than 3-4 rounds of review, it may be too large or the requirements may be unclear; consider splitting the PR or scheduling a synchronous discussion

Common Issues

Review fatigue after multiple iterations: Each iteration round takes reviewer energy and context-switching time. Minimize iterations by thoroughly self-reviewing before requesting the first review, addressing all comments in a single batch, and having a clear conversation about disagreements rather than going back and forth.

Losing track of which comments are addressed: In large PRs with 20+ comments, it is easy to miss some. Create a local checklist from all pending comments, check them off as you address each one, and reference the comment in your commit message so reviewers can verify quickly.

Merge conflicts accumulating between iterations: Long-running PRs diverge from main as other changes merge. Rebase at the start of each iteration cycle, resolve conflicts once, and push the updated branch. If conflicts are frequent, it signals the PR should be merged sooner or split into smaller pieces.

Community

Reviews

Write a review

No reviews yet. Be the first to review this template!

Similar Templates