/gh-workflow:commenting-on-prsfrom gh-workflow
Posts inline review comments on GitHub pull request diffs using the GitHub reviews API. Handles requests to add code review comments, inline feedback, line-level annotations, or inline notes to specific lines of a pull request diff. Applicable when a user wants to comment on code changes, annotate a diff, leave review feedback on a PR, post a pull request review, or add line comments to changed files. Accepts file path, line number, and comment body for each comment; batches multiple comments into a single review API call.
Ships in gh-workflow. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Post inline review comments on GitHub PR diffs using the reviews API.
!`gh pr view --json number,headRefOid,url 2>&1 || echo "ERROR: No open PR for current branch"`
!`gh pr diff 2>&1 || echo "No diff available"`
If no input arguments are provided (no comments specified), return an error message to the caller:
"Error: arguments required. Provide the desired comments — each with file path, line number, and comment body."
Do not proceed with the workflow.
If the PR Context above shows ERROR, stop and inform the user.
Use the reviews endpoint (NOT the single-comment endpoint):
gh api \
--method POST \
"repos/{owner}/{repo}/pulls/{number}/reviews" \
--input - <<'EOF'
{
"commit_id": "<full 40-char SHA from headRefOid>",
"event": "COMMENT",
"comments": [
{
"path": "path/to/file.ts",
"line": 42,
"side": "RIGHT",
"body": "Your comment here (supports GitHub Flavored Markdown)."
}
]
}
EOF
Use {owner} and {repo} from the PR URL. Batch multiple comments into the comments array — one review with N comments is preferred over N separate API calls.
If the API returns 422, re-examine the diff for the correct line/path values and retry once. If it fails again, report the raw error to the user and stop.
A successful response returns HTTP 200. Output the html_url from the response.
path, line, and sideFrom the diff in PR Context:
path: The file path from the diff header (diff --git a/... b/...). Use the b/ path without the b/ prefix.line: Absolute line number in the file. Must be within a changed hunk visible in the diff.side: "RIGHT" for added/modified lines (+ prefix in diff). "LEFT" for deleted lines (- prefix).| Endpoint | Line field | Behavior |
|---|---|---|
POST .../pulls/{pr}/comments | position (diff hunk offset) | Hard to compute; line/side fields are rejected with HTTP 422 |
POST .../pulls/{pr}/reviews | line (absolute file line number) | Intuitive; supports side for left/right |
Always use the reviews endpoint.
See examples.md for real API call transcripts.
commit_id must be the full 40-character SHA from headRefOid. Short SHAs return 422.line must be within a changed hunk in the diff. Lines outside the diff return 422.path must exactly match the diff header. Invalid paths return 422.event: "COMMENT" only. Do not use "REQUEST_CHANGES" or "APPROVE" unless the user explicitly asks.What SKILL.md sets; muted values are Claude Code's defaults
haikuOther plugins' skills for the same job
npx claudepluginhub ibara1454/agent-marketplace --plugin gh-workflow5 skills in this plugin
/agent-browserBrowser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction./dogfoodSystematically explore and test a web application to find bugs, UX issues, and other problems. Use when asked to "dogfood", "QA", "exploratory test", "find issues", "bug hunt", "test this app/site/platform", or review the quality of a web application. Produces a structured report with full reproduction evidence -- step-by-step screenshots, repro videos, and detailed repro steps for every issue -- so findings can be handed directly to the responsible teams./drafting-prCreates a draft pull request from current working changes. Handles branching, committing, pushing, and opening the PR with the project's PR template. Triggers on requests like "create a draft PR," "open a draft pull request," "push my changes and open a PR," "ship this as a PR," "submit a draft for review," "PR this," or any variation of branching and opening a draft PR against main./uploading-attachmentsUpload one or more image attachments to GitHub PRs without commits. Supports single or multiple file paths. Uses browser login for authentication. Triggers on requests like "upload this image to the PR," "attach this screenshot to the pull request," "add this image to GitHub without committing," "get a CDN URL for this image," "upload assets for the PR comment," or any variation of uploading images or attachments to GitHub.