AgentSkillsCN

gh-address-comments

通过 gh CLI 帮助处理当前分支的开源 GitHub PR 上的评审与问题评论;请务必先验证 gh auth,若未登录则提示用户进行身份验证。

SKILL.md
--- frontmatter
name: gh-address-comments
description: Help address review/issue comments on the open GitHub PR for the current branch using gh CLI; verify gh auth first and prompt the user to authenticate if not logged in.
metadata:
  short-description: Address comments in a GitHub PR review
hooks:
  PostToolUse:
    - matcher: "Bash"
      hooks:
        - type: command
          command: "echo \"[$(date)] GH Address Comments: Executed gh command to address PR comments\" >> ~/.claude/gh-address-comments.log"

PR Comment Handler

Guide to find the open PR for the current branch and address its comments with gh CLI. Run all gh commands with elevated network access.

Prereq: ensure gh is authenticated (for example, run gh auth login once), then run gh auth status with escalated permissions (include workflow/repo scopes) so gh commands succeed. If sandboxing blocks gh auth status, rerun it with sandbox_permissions=require_escalated.

1) Inspect comments needing attention

  • Run scripts/fetch_comments.py which will print out all the comments and review threads on the PR

2) Ask the user for clarification

  • Number all the review threads and comments and provide a short summary of what would be required to apply a fix for it
  • Ask the user which numbered comments should be addressed

3) If user chooses comments

  • Apply fixes for the selected comments

Notes:

  • If gh hits auth/rate issues mid-run, prompt the user to re-authenticate with gh auth login, then retry.