APM

>Agent Skill

@ll7/gh-pr-comment-fixer

skillgit-workflow

Fix GitHub PR review comments using the gh CLI: fetch review threads, implement requested changes, run the full test suite, commit and push fixes, then resolve the review threads. Use when asked to address PR comments or review feedback on the current branch.

gittestingapi-design
apm::install
$apm install @ll7/gh-pr-comment-fixer
apm::skill.md
---
name: gh-pr-comment-fixer
description: "Fix GitHub PR review comments using the gh CLI: fetch review threads, implement requested changes, run the full test suite, commit and push fixes, then resolve the review threads. Use when asked to address PR comments or review feedback on the current branch."
---

# Gh Pr Comment Fixer

## Overview

Use the gh CLI to retrieve PR review comments for the current branch, apply fixes, verify with
the full test suite, and resolve the review threads after pushing.

## Workflow

1. Identify the PR for the current branch.
   - Prefer `gh pr view --json number,headRefName` and confirm it matches the branch.

2. Retrieve review threads and comments.
   - Use GraphQL for review threads:
     `gh api graphql -F owner=<owner> -F repo=<repo> -F number=<pr_number> -f query='query($owner:String!,$repo:String!,$number:Int!){repository(owner:$owner,name:$repo){pullRequest(number:$number){reviewThreads(first:100){nodes{id isResolved comments(first:20){nodes{id body path line url}}}}}}}'`
   - Use `gh pr view --json comments` for top-level discussion comments.
   - Summarize the requested changes and note any questions or ambiguities.

3. Evaluate each comment.
   - Decide if it is reasonable, needs clarification, or should be declined.
   - If clarification is needed, ask before changing code.

4. Implement fixes.
   - Make minimal, targeted edits.
   - Add or update tests if the change warrants it.
   - Keep commit scope aligned with a single comment or logical group.

5. Run the full test suite.
   - Use the repo standard test command unless instructed otherwise.
   - Report failures and decide whether to continue or request input.

6. Commit and push fixes.
   - Use a conventional commit message.
   - Mention which comments were addressed.

7. Resolve review threads.
   - Use `gh pr review --comment` for replies and `gh api` or `gh pr review` to resolve threads.
   - Resolve only after the fix is pushed.

## Notes

- Prefer `gh pr view` and `gh pr diff` over manual web browsing.
- If no PR exists for the current branch, ask the user to open one or provide a PR number.
- Post multiline comments using a body file, not escaped `\n`:
  - Preferred helper: `scripts/dev/gh_comment.sh pr --current <<'EOF' ... EOF`
  - Alternative: `gh pr comment <num> --body-file <file>`