Agent Skillszerx-lab/zap › pr-comments

pr-comments

GitHub

获取当前分支 GitHub PR 的审查评论并展示,供用户参考。支持脚本或 CLI 回退方案,仅做信息展示,不自动修改代码或提交回复。

resources/bundled/skills/pr-comments/SKILL.md zerx-lab/zap

Trigger Scenarios

需要查看 PR 审查意见 回顾代码评审反馈

Install

npx skills add zerx-lab/zap --skill pr-comments -g -y
More Options

Non-standard path

npx skills add https://github.com/zerx-lab/zap/tree/main/resources/bundled/skills/pr-comments -g -y

Use without installing

npx skills use zerx-lab/zap@pr-comments

指定 Agent (Claude Code)

npx skills add zerx-lab/zap --skill pr-comments -a claude-code -g -y

安装 repo 全部 skill

npx skills add zerx-lab/zap --all -g -y

预览 repo 内 skill

npx skills add zerx-lab/zap --list

SKILL.md

Frontmatter
{
    "name": "pr-comments",
    "description": "Fetch and display GitHub PR review comments for the current branch."
}

Fetch PR Comments

Fetch all review comments from the current branch's GitHub PR and display them via insert_code_review_comments.

Procedure

  1. Run the bundled script (must be inside a git repo with an open PR on the current branch). Use do_not_summarize_output: true when running this shell command so the JSON output is not truncated.

    python3 <skill_dir>/scripts/fetch_github_review_comments.py
    

    The script prints JSON to stdout. If the script fails to fetch comments, run the fallback gh commands instead.

  2. Call insert_code_review_comments with the three top-level fields from the JSON output:

    • local_repository_path
    • base_branch
    • comments
  3. Stop and wait for the user. After displaying each batch of comments, you MUST ask the user how they would like to proceed. Do NOT take any further action until the user provides explicit instructions unless the user explicitly asks you to. Do NOT make code changes in response to the fetched comments unless the user tells you to. Do NOT impersonate the user by submitting review responses. Your role when fetching and displaying comments is purely informational — present the comments and wait for direction.

What the Script Handles

  • Fetches issue comments, diff comments, and reviews via gh api --paginate
  • Trims large diff hunks to a window around the commented line
  • Sets reply_metadata on reply comments
  • Sets location_metadata on top-level diff comments (filepath, trimmed diff hunk, line, side)
  • PR-level comments (issue comments and reviews) have neither location nor reply metadata

Script fallback commands

If the script fails to fetch comments, follow these steps to fetch comments directly from the GitHub API:

  1. Use the GitHub cli to find the PR number, owner name, repo name, and PR base branch for the current branch.

  2. Use the GitHub /repos/{owner_login}/{repo_name}/issues/{pr_number}/comments endpoint to fetch PR-level comments.

  3. Use the GitHub /repos/{owner_login}/{repo_name}/pulls/{pr_number}/comments endpoint to fetch line- and file-attached review comments. Remove location metadata and diff hunks from thread replies.

  4. Use the GitHub /repos/{owner_login}/{repo_name}/pulls/{pr_number}/reviews endpoint with a filter to fetch code reviews with comment text.

  5. Invoke the insert_code_review_comments tool to send the comments to the user. Include all PR-, review-, file- and line-level comments. If there are no comments on the PR, use the tool to return an empty list. DO NOT read out the comment contents without the tool.

Ensure the pager is not used by clearing the GH_PAGER environment variable. For example, on MacOS using zsh, use:

$ GH_PAGER="" gh pr view --json number,headRepository,headRepositoryOwner,baseRefName
$ GH_PAGER="" gh api /repos/{owner_login}/{repo_name}/issues/{pr_number}/comments --jq '.[] | {id, html_url, user_login: .user.login, body, created_at, updated_at}'
$ GH_PAGER="" gh api /repos/{owner_login}/{repo_name}/pulls/{pr_number}/comments --jq '.[] | {id, html_url, diff_hunk, path, user_login: .user.login, body, created_at, updated_at, start_line, original_start_line, start_side, line, original_line, side, in_reply_to_id, subject_type} | if .in_reply_to_id != null then del(.diff_hunk, .path, .line, .original_line, .start_line, .original_start_line, .side, .start_side, .subject_type) else . end'
$ GH_PAGER="" gh api /repos/{owner_login}/{repo_name}/pulls/{pr_number}/reviews --jq '.[] | {id, html_url, user_login: .user.login, body, created_at, updated_at} | select(.body != "" and .body != null)'

Adapt the instructions above for the user's operating system and shell. Then invoke the insert_code_review_comments tool.

  1. After displaying comments, follow step 3 of the Procedure above: stop and ask the user how they want to proceed. Do NOT take any action on the comments without explicit user direction.

Requirements

  • gh CLI authenticated with repo access
  • Current branch has an open pull request

Version History

  • 5d87445 Current 2026-07-24 17:36

Same Skill Collection

.agents/skills/add-feature-flag/SKILL.md
.agents/skills/add-telemetry/SKILL.md
.agents/skills/dedupe-issue-local/SKILL.md
.agents/skills/diagnose-ci-failures/SKILL.md
.agents/skills/fix-errors/SKILL.md
.agents/skills/implement-specs/SKILL.md
.agents/skills/promote-feature/SKILL.md
.agents/skills/remove-feature-flag/SKILL.md
.agents/skills/resolve-merge-conflicts/SKILL.md
.agents/skills/review-pr-local/SKILL.md
.agents/skills/review-pr/SKILL.md
.agents/skills/rust-unit-tests/SKILL.md
.agents/skills/spec-driven-implementation/SKILL.md
.agents/skills/triage-issue-local/SKILL.md
.agents/skills/update-skill/SKILL.md
.agents/skills/warp-integration-test/SKILL.md
.agents/skills/warp-ui-guidelines/SKILL.md
.agents/skills/write-product-spec/SKILL.md
.agents/skills/write-tech-spec/SKILL.md
resources/bundled/mcp_skills/figma/figma-code-connect-components/SKILL.md
resources/bundled/mcp_skills/figma/figma-create-design-system-rules/SKILL.md
resources/bundled/mcp_skills/figma/figma-create-new-file/SKILL.md
resources/bundled/mcp_skills/figma/figma-generate-library/SKILL.md
resources/bundled/mcp_skills/figma/figma-implement-design/SKILL.md
resources/bundled/skills/add-mcp-server/SKILL.md
resources/bundled/skills/create-skill/SKILL.md
resources/bundled/skills/create-tab-config/SKILL.md
resources/bundled/skills/feedback/SKILL.md
resources/bundled/skills/modify-settings/SKILL.md
resources/bundled/skills/tab-configs/SKILL.md
resources/bundled/skills/update-tab-config/SKILL.md
resources/channel-gated-skills/dogfood/triage-vulnerabilities/SKILL.md
resources/bundled/mcp_skills/figma/edit-figma-design/SKILL.md
resources/bundled/mcp_skills/figma/figma-generate-design/SKILL.md
resources/bundled/mcp_skills/figma/figma-use/SKILL.md
resources/bundled/skills/claude-api/SKILL.md

Metadata

Files
0
Version
5d87445
Hash
1306198e
Indexed
2026-07-24 17:36

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-16 23:25
浙ICP备14020137号-1 $mapa de visitantes$