添加审查评论
karanmrn2026-10-26查看 40复制 252
向 GitHub pull request 添加审查评论。
📘如何使用这个技能
- 1复制技能内容·点击上方「Copy SKILL.md」复制全部内容,或 Download 下载到本地
- 2打开你的 AI 客户端·支持 Claude Code、Trae、Cursor、ChatGPT、DeepSeek、Kimi 等任意 AI 助手
- 3粘贴为系统提示/知识文件·Claude Code:放入 .claude/skills/ 目录;普通对话:作为首条消息发送并说「请严格按这份技能文档执行」
- 4直接提出你的需求·AI 会按技能定义的工作流、格式和约束来处理,无需再解释背景
💡 提示:技能生效后,每次对话只需一句需求,AI 会按 SKILL.md 的流程执行。
SKILL.md1821 chars
--- name: add-review-comment description: Add a review comment to a GitHub pull request. --- # Add Review Comment Adds a review comment to a specific line in a GitHub pull request. ## Step 1: Locate the line to comment on Use the `fetch-diff` skill (optionally piped through `grep`) to locate the line to comment on. ## Step 2: Post the comment **Single-line comment:** ```bash gh api repos/<owner>/<repo>/pulls/<pr_number>/comments \ # Body must end with "🤖 Generated with Claude" on a separate line -f body=<comment> \ -f path=<file_path> \ -F line=<line_number> \ -f side=<side> \ -f commit_id="$(gh pr view <pr_number> --repo <owner>/<repo> --json headRefOid -q .headRefOid)" \ --jq '.html_url' ``` **Multi-line comment:** ```bash gh api repos/<owner>/<repo>/pulls/<pr_number>/comments \ # Body must end with "🤖 Generated with Claude" on a separate line -f body=<comment> \ -f path=<file_path> \ -F start_line=<first_line> \ -f start_side=<side> \ -F line=<last_line> \ -f side=<side> \ -f commit_id="$(gh pr view <pr_number> --repo <owner>/<repo> --json headRefOid -q .headRefOid)" \ --jq '.html_url' ``` ## Parameters - `line`: Line number in the file (for multi-line, the last line) - `side`: `RIGHT` for added/modified lines (+), `LEFT` for deleted lines (-) - `start_line`/`start_side`: For multi-line comments, the first line of the range ## Best Practices - Use suggestion blocks (three backticks + "suggestion") for simple fixes that maintainers can apply with one click ```` ```suggestion <suggested code here> ``` ```` Note: Preserve original indentation exactly in suggestion blocks - For repetitive issues, leave one representative comment instead of flagging every instance - For bugs, explain the potential problem and suggested fix clearly