Scripts for automating PR review loops: - poll_pr_comments.sh: Poll for new comments without wasting tokens - wait_for_checks.sh: Wait for CI checks to complete - fetch_pr_comments.sh: Fetch and format PR comments Includes SKILL.md for use as a Claude Code skill.
4 KiB
| name | description |
|---|---|
| implement-review-loop | Implement code from a plan, create PRs with Graphite CLI (gt create/submit), wait for code reviews, and iterate on feedback. Use when the user says "implement", "implement the plan", "create PR", "review loop", or wants to go from plan to merged PR. This skill handles the full cycle - implement code, create branch with Graphite, submit PR, wait for reviews (without wasting tokens), read comments, fix code, and push updates. |
Implement Review Loop
End-to-end workflow for implementing code from a plan, creating PRs with Graphite, and iterating on review feedback.
Prerequisites
- Graphite CLI installed (
gt --version) - GitHub CLI installed (
gh --version) - Repository initialized with Graphite (
gt initif not) - Devin Review available via npx (
npx devin-review)
Workflow Overview
Plan -> Implement -> Create Branch (gt) -> Submit PR -> Wait for Review -> Read Comments -> Fix -> Push -> Repeat
Phase 1: Implement the Plan
- Read the current plan (from context, file, or conversation)
- Implement all changes specified in the plan
- Run tests and linting to verify implementation
- Stage changes:
git add <specific-files>
Phase 2: Create Branch and PR with Graphite
Create branch with auto-generated name from commit message:
gt create --all --message "feat: <description from plan>"
Submit the PR with auto-generated description:
gt submit --ai --stack
Or with manual title/description:
gt submit --edit-title --edit-description
Capture the PR URL from output for later use.
Phase 3: Request Code Review (Optional)
Run Devin Review for AI-powered code review:
cd /path/to/repo
npx devin-review https://github.com/owner/repo/pull/123
This creates an isolated worktree and sends diff to Devin for analysis.
Phase 4: Wait for Reviews (Token-Efficient)
Use the polling script to wait without consuming tokens:
./scripts/poll_pr_comments.sh owner/repo 123 --timeout 60 --interval 30
The script:
- Polls GitHub API every 30 seconds (configurable)
- Returns when new comments are detected
- Exits after timeout with no-comments status
- Does NOT consume Claude context while waiting
For CI checks:
./scripts/wait_for_checks.sh owner/repo 123 --timeout 15
Phase 5: Read and Address Comments
Fetch all comments for review:
./scripts/fetch_pr_comments.sh owner/repo 123
This outputs:
- Inline review comments with file:line locations
- PR-level comments
- Review decision status
For each comment:
- Read the feedback
- Implement the fix
- Stage the changes
Phase 6: Push Updates
Amend current commit and push:
gt modify --all
gt submit
Or create a new fixup commit:
gt create --all --message "fix: address review feedback"
gt submit
Phase 7: Loop Until Approved
Repeat phases 4-6 until:
- All comments are resolved
- PR is approved
- Ready to merge
Quick Reference
| Task | Command |
|---|---|
| Create branch | gt create -am "feat: description" |
| Submit PR | gt submit --ai --stack |
| View PR | gt pr |
| Amend changes | gt modify -a |
| Push updates | gt submit |
| Poll comments | ./scripts/poll_pr_comments.sh repo pr |
| Fetch comments | ./scripts/fetch_pr_comments.sh repo pr |
| Devin review | npx devin-review <pr-url> |
Bundled Scripts
poll_pr_comments.sh
Polls for new PR comments without consuming context:
./scripts/poll_pr_comments.sh <owner/repo> <pr-number> [--timeout <min>] [--interval <sec>]
wait_for_checks.sh
Waits for GitHub checks to complete:
./scripts/wait_for_checks.sh <owner/repo> <pr-number> [--timeout <min>]
fetch_pr_comments.sh
Fetches and formats all PR comments:
./scripts/fetch_pr_comments.sh <owner/repo> <pr-number> [--unresolved-only]