From sdlc
Monitor a PR for review feedback and address it in an autonomous loop. Handles both automated (CodeRabbit, Codacy, etc.) and human reviewer feedback. Auto-detects PR from current branch. Waits for review checks, fetches unresolved threads, spawns a handler agent per round, optionally runs code-simplifier on changes, and repeats until clean. Triggers: 'handle PR feedback', 'address review comments', 'pr feedback', 'fix review comments', 'respond to reviews'.
npx claudepluginhub jerrod/agent-plugins --plugin sdlcThis skill is limited to using the following tools:
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Compares coding agents like Claude Code and Aider on custom YAML-defined codebase tasks using git worktrees, measuring pass rate, cost, time, and consistency.
Log skill invocation:
AUDIT_SCRIPT=$(find . -name "audit-trail.sh" -path "*/sdlc/*" 2>/dev/null | head -1)
[ -z "$AUDIT_SCRIPT" ] && AUDIT_SCRIPT=$(find "$HOME/.claude" -name "audit-trail.sh" -path "*/sdlc/*" 2>/dev/null | sort -V | tail -1)
bash "$AUDIT_SCRIPT" log ship sdlc:pr-feedback started --context="PR #$PR_NUMBER"bash "$AUDIT_SCRIPT" log ship sdlc:pr-feedback completed --context="<summary>"Monitor a PR for review feedback (automated and human), address it, and repeat until clean.
PR_NUMBER=$(gh pr view --json number -q '.number' 2>/dev/null)
If that fails (no PR for current branch), fall back to $ARGUMENTS:
/sdlc:pr-feedback [PR number]— or push a branch and open a PR first.
REPO=$(gh repo view --json nameWithOwner -q '.nameWithOwner')
OWNER=$(echo "$REPO" | cut -d/ -f1)
REPO_NAME=$(echo "$REPO" | cut -d/ -f2)
CURRENT_USER=$(gh api user --jq '.login')
PR_URL=$(gh pr view "$PR_NUMBER" --json url -q '.url')
IS_DRAFT=$(gh pr view "$PR_NUMBER" --json isDraft -q '.isDraft')
LAST_PUSH_SHA=$(git rev-parse HEAD)
Initialize: ROUND=0, CUMULATIVE_TABLE="" (collects assessment rows across all rounds).
One-time CI check before polling. Run gh pr checks "$PR_NUMBER" --json name,state,conclusion.
FAILURE (names containing "build", "compile", "typecheck"): Warn — "CI has a build failure. Address that first, or proceed with feedback anyway?" Wait for input.If IS_DRAFT == true:
If IS_DRAFT == false (Ready for Review), use the full polling logic below.
Three layers: (1) detect review environment, (2) use bot-specific signals when available, (3) fall back to generic thread polling.
Gather two signals:
Signal 1 — PR checks:
gh pr checks "$PR_NUMBER" --json name,state
Signal 2 — Bot comments on this PR:
gh api "repos/OWNER/REPO/issues/PR_NUMBER/comments" \
--jq '[.[] | select(.user.type == "Bot") | {login: .user.login, body_start: (.body[0:200])}]'
Classify the environment:
| Condition | Classification | Behavior |
|---|---|---|
| Check name matches a known bot | Known bot | Use bot-specific polling (Phase B1) |
| Bot comments from an unrecognized bot | Unknown bot | Use generic polling (Phase B2) |
| No bot checks AND no bot comments | No AI reviewer | Use short generic polling (Phase B3) |
Known review-bot check name patterns (case-insensitive):
coderabbit, codacy, sonar, deepsource, copilot, claudereview (but NOT peer-review, review-app, or CI-flavored variants like review-deploy)If known bot checks are PENDING/IN_PROGRESS/QUEUED, poll every 15 seconds until terminal state. Timeout: 15 minutes. Then proceed to Phase B1.
Do NOT wait for non-review checks (CI builds, tests, deployments).
A bot's check can complete minutes before it finishes posting review comments. Poll actively.
Core loop (all variants share this structure):
Critical: thread stability is the primary exit. If unresolved threads are found and the count is stable across two consecutive fetches, exit the loop immediately. Bot comment status is secondary — used only when thread count is zero.
Bot "still processing" detection (checked only when a known bot is detected):
Fetch the bot's latest issue comment and look for signals:
Implementation note — avoid double jq parsing: Extract scalar values in a single --jq filter pass: gh api ... --jq '... | .body | length' — not $(echo "$json" | jq ...).
Timeout by environment:
| Environment | Max polling time |
|---|---|
| Known bot (B1) | 15 minutes |
| Unknown bot (B2) | 15 minutes |
| No AI reviewer (B3) | 2 minutes |
Use gh api graphql to query repository.pullRequest.reviewThreads(first: 100). For each thread, fetch: id, isResolved, and comments with author.login, body, path, line, databaseId, url.
Filter: isResolved == false only. Include threads from ALL authors.
Reviewer type detection: Cross-check against REST API:
gh api repos/OWNER/REPO/pulls/PR_NUMBER/comments --paginate --jq '[.[] | {id, user_type: .user.type}]'
user.type == "Bot" → Bot; otherwise → Human. REST is authoritative (GraphQL may strip [bot] suffix).
If zero unresolved threads remain: proceed to Exit Summary. If unresolved threads exist: proceed to Step 4.
Increment: ROUND += 1
Log: "Round ROUND: Found N unresolved review threads. Delegating to handler..."
Spawn the handler agent:
Agent(subagent_type="sdlc:pr-feedback-handler")
Pass context in the agent prompt:
The agent will:
After the agent returns:
CUMULATIVE_TABLECheck if code-simplifier is available before attempting to use it. This is not a hard dependency.
To detect: attempt to reference code-simplifier:code-simplifier as a subagent type. If the plugin is not installed, skip this step silently and proceed to Step 6.
If available AND the handler made code changes (ACTION items):
Agent(subagent_type="code-simplifier:code-simplifier") targeting files modified this roundrefactor: simplify PR feedback changesIf code-simplifier is not installed: Proceed directly to Step 6. No error, no warning.
This is the ONLY push in the entire round. Neither the handler nor the code simplifier push.
git push
Update LAST_PUSH_SHA to current HEAD. Loop back to Step 1.
"Completed 5 feedback rounds. Some threads may still be unresolved. Re-invoke
/sdlc:pr-feedbackto continue."
When exiting (success, timeout, or round limit), present:
## PR Feedback Summary
- **PR**: #<number> (<PR_URL>)
- **Rounds completed**: N
- **Total threads addressed**: M (X automated, Y human)
- **Remaining unresolved**: K
- **Final status**: [Clean / Timed out / Round limit reached]
### Cumulative Assessment
(table of all feedback items across all rounds)