Address review

From gittower/git-flow-next · View interactive version

Address review is an AI agent skill from the GitHub repository gittower/git-flow-next. Fetch PR review feedback, evaluate it, implement accepted changes, and update the PR after confirmation

How to use this skill

Skill file

Address Review

Fetch review comments from a PR (Copilot, human, or any reviewer), evaluate each one against the project's development philosophy, write the evaluation as a plan artifact, and implement the accepted changes. All public actions (push, PR comment, description update) wait for user confirmation.

Arguments

/address-review <pr-number> [--plan-only]

Instructions

1. Fetch PR Context

Fetch all review data in parallel:

From the PR details, extract the head branch name and head SHA (short form for filenames).

2. Identify New Comments

Compare reviews by submitted_at timestamp. Focus on the most recent review round — comments from earlier rounds that were already addressed (check for existing reply comments or commits after the review) should be noted as "previously addressed" and skipped.

Group comments by review round (same pull_request_review_id).

Also skip items that are:

3. Checkout the Branch

Ensure the PR branch is checked out locally:

git fetch origin <head-branch>
git checkout <head-branch>

4. Read Relevant Source Files

For each comment, read the file and lines referenced in the path and diff_hunk fields. Understand the full context — don't evaluate comments in isolation.

5. Evaluate Each Comment

For every comment, assign a verdict and a severity.

Verdict — accept when the comment identifies:

Verdict — dismiss when the comment:

Verdict — partial when:

Severity (for accepted and partial items, per REVIEW_CRITERIA.md categories):

6. Write the Plan Artifact

Always write the evaluation before doing anything else — this is the audit trail for the review round.

Determine the output folder:

# Extract issue number from branch name if present (feature/42-something -> 42)
# Look for existing .ai/issue-<number>-* folder, fall back to .ai/pr-<number>/

Write to .ai/<folder>/review-plan-<head-sha>.md:

# Review Plan: PR #<number> (round <N>)

## Source
- PR: #<number> - <title> (<link>)
- Review: <reviewer> on <date>
- Revision: `<full-head-sha>`
- Branch: `<branch-name>`

## Evaluation

| # | File | Verdict | Severity | Summary |
|---|------|---------|----------|---------|
| 1 | path/to/file.go | accept | must fix | <one-line reason> |
| 2 | path/to/other.go | dismiss | — | <one-line reason> |
| 3 | docs/file.md | partial | should fix | <concern valid, simpler fix> |

## Tasks

### Task 1: <derived from accepted comment>
**Files**: `<path/to/file.go>`
**Changes**:
- [ ] <specific change>

**Details**: <what to change and why; for partial accepts, describe the simpler fix>

## Dismissed

- #2 — <why, referencing project philosophy where relevant>

If no actionable feedback was found, write the plan with an empty Tasks section noting the review was clean (approval or comments without action items), report that, and stop.

7. Plan-Only Stop

If --plan-only was given: report the path to the plan artifact, summarize the verdicts, and stop. Suggest /implement .ai/<folder>/review-plan-<sha>.md as the next step.

8. Implement Accepted Changes

Without --plan-only, proceed directly — no confirmation needed for local work:

  1. Make the code changes for all accepted and partially-accepted tasks
  2. Run go build ./... to verify compilation
  3. Run go test ./... (or the relevant test subset) to verify tests pass
  4. Update the checkboxes in the plan artifact as tasks complete

Keep changes minimal and focused — fix what the review identified, don't refactor surrounding code.

9. Commit Locally

Use the /commit skill pattern (read .claude/skills/commit/SKILL.md):

Do NOT push yet.

10. Prepare Public Actions

Draft everything that will touch GitHub, but do not execute yet.

Route each reply by where the feedback lives:

So a review round may produce inline replies, a single combined comment, or both — depending on which kinds of feedback it contained. If there are no general comments, post no combined comment; if there are no inline comments, post no inline replies.

Also draft:

11. Confirmation Gate

Present to the user in one block:

Then ask: "Push and post?"

Wait for confirmation. The user may adjust verdicts, edit the comment, or ask for changes — apply them and re-present. Nothing is pushed or posted until confirmed.

12. Execute Public Actions

After confirmation:

  1. Push to the remote branch
  2. Update the PR description if drafted:

```bash

gh api repos/gittower/git-flow-next/pulls/<number> -X PATCH -f body="<updated body>"

```

  1. Post the replies (verify each body against the posting checklist first — the PR-description PATCH and inline replies go through gh api, so no hook reminder fires):

```bash

gh api repos/gittower/git-flow-next/pulls/<number>/comments/<comment-id>/replies -f body="<reply>"

```

  1. Resolve the handled inline threads. A REST reply does not resolve the thread — resolution is a GraphQL mutation keyed by the thread's node ID (not the comment ID). Map each handled comment to its thread, then resolve it.

Fetch the thread IDs once (map databaseId of the first comment → thread id):

```bash

gh api graphql -f query='

query($owner:String!,$repo:String!,$pr:Int!){

repository(owner:$owner,name:$repo){

pullRequest(number:$pr){

reviewThreads(first:100){

nodes{ id isResolved comments(first:1){ nodes{ databaseId path } } }

}

}

}

}' -f owner=gittower -f repo=git-flow-next -F pr=<number>

```

Then resolve each thread we replied to with a verdict (accept, dismiss, or partial):

```bash

gh api graphql -f query='

mutation($threadId:ID!){

resolveReviewThread(input:{threadId:$threadId}){ thread{ isResolved } }

}' -f threadId=<thread-node-id>

```

Skip threads flagged as genuinely open at the gate, and any already isResolved.

  1. Update pr_summary.md in .ai/ if it exists

13. Report

Output a final summary:

Notes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.