address-reviews
npx skills add https://github.com/jacehwang/harness --skill address-reviews
Agent 安装分布
Skill 文档
Context
- Current branch: !
git branch --show-current - PR info: !
gh pr view --json number,title,url,state,author 2>/dev/null || echo "none" - Repository: !
gh repo view --json nameWithOwner --jq '.nameWithOwner' 2>/dev/null
Your task
Collect, classify, and plan responses to GitHub PR review comments.
Step 1: Detect PR
- Check the PR info from the context above
- If the user passed a PR number as an argument, use that instead
- If no PR is found, inform the user and stop
Extract {owner}, {repo}, and {number} from the PR info for subsequent API calls.
Step 2: Collect review data
Fetch review feedback and commit history using gh api. Run all four calls in parallel.
Each REST call MUST include --paginate to retrieve all pages.
- Reviews â top-level verdicts (APPROVED, CHANGES_REQUESTED, etc.)
gh api --paginate repos/{owner}/{repo}/pulls/{number}/reviews \ --jq '[.[] | {id, user: .user.login, state, body, submitted_at}]' - Inline comments â file/line-level code comments
gh api --paginate repos/{owner}/{repo}/pulls/{number}/comments \ --jq '[.[] | {id, user: .user.login, body, path, line, diff_hunk, created_at, in_reply_to_id}]' - Conversation comments â general PR discussion
gh api --paginate repos/{owner}/{repo}/issues/{number}/comments \ --jq '[.[] | {id, user: .user.login, body, created_at}]' - Commits â timestamps for filtering
gh api --paginate repos/{owner}/{repo}/pulls/{number}/commits \ --jq '[.[] | {sha: .sha, date: .commit.committer.date}]'
Step 3: Filter by timestamp â “Needs action” vs “Likely addressed”
Determine the latest commit timestamp from the commits list. Classify each comment:
- Needs action:
created_at(orsubmitted_at) is after the latest commit â not yet addressed - Likely addressed: timestamp is before the latest commit â a subsequent commit likely handled it
Focus exclusively on “Needs action” comments going forward. Report “Likely addressed” as a count only.
Step 4: Cross-reference resolution status
Fetch thread resolution via GraphQL:
gh api graphql -f query='
query($owner: String!, $repo: String!, $number: Int!) {
repository(owner: $owner, name: $repo) {
pullRequest(number: $number) {
reviewThreads(first: 100) {
nodes {
isResolved
comments(first: 1) {
nodes { databaseId }
}
}
}
}
}
}' -f owner='{owner}' -f repo='{repo}' -F number='{number}'
A comment requires action only when both conditions are true:
- Timestamp says “Needs action” (Step 3)
- Thread is unresolved (Step 4)
Among the remaining actionable comments, classify each as:
- Actionable feedback â requires a code change â plan it
- Question â requires a reply only, no code change â note “reply only”
- Praise / acknowledgment â skip entirely, do not include in output
Early exit: If all “Needs action” comments are resolved, inform the user and stop.
Present a summary:
- Total comments (all) â filtered as noise â likely addressed â resolved â actionable
- File-by-file breakdown of actionable comments with brief excerpts
- Group by reviewer
Step 5: Read source files and enter plan mode
Before entering plan mode, read the source files referenced by inline comments using the Read tool. The diff_hunk shows only the diff context â you need the current file content to plan accurate changes.
Then call EnterPlanMode.
In plan mode, create a plan that:
- Addresses each actionable comment, prioritized by file
- Specifies concrete changes (what to modify, where) referencing current source code
- Uses
file_path:line_numberformat for all source references - Groups related comments that can be addressed together
- Marks “question” items separately with suggested reply text