gh-cli
Drive the GitHub CLI (gh) to review a pull request — fetch the diff and context, post inline review comments anchored to specific diff lines, open conceptual…
Skill by igorilic
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/igorilic-gh-cli
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: backend
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/gh-cli
What's inside
- Skill name
gh-cli- Description
- Drive the GitHub CLI (gh) to review a pull request — fetch the diff and context, post inline review comments anchored to specific diff lines, open conceptual conversation threads, and submit a verdict (APPROVE / REQUEST_CHANGES / COMMENT). Use when reviewing or commenting on a GitHub PR. Triggers on: gh, github cli, pull request, pr review, post pr comment, gh api, review github pr.
- License
- MIT
- Instructions
- 147 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
## gh CLI — PR review & commenting
Everything here drives `gh` via the shell. `gh api repos/{owner}/{repo}/...`
auto-expands `{owner}`/`{repo}` from the current clone — in the URL **path**
and in `-F`/`--field` values (**not** `-f`/`--raw-field`, which sends the
literal string, and **not** inside an `--input` JSON body). Set
`GH_REPO=OWNER/REPO` or pass `-R OWNER/REPO` when outside the repo.
### 0. Auth check (do this first)
```bash
gh auth status # must be authenticated; token needs `repo` scope to post reviews
ME=$(gh api user -q .login) # your login — used for the self-PR fallback below
```
### 1. Resolve the target
```bash
PR=42
gh pr view "$PR" --json number,title,state,isDraft,author,headRefName,baseRefName,headRefOid,url,mergeable
HEAD_SHA=$(gh pr view "$PR" --json headRefOid -q .headRefOid) # commit_id for review comments
AUTHOR=$(gh pr view "$PR" --json author -q .author.login)
```
### 2. Fetch context (read-only)
```bash
gh pr diff "$PR" # unified diff (the change to review)
gh api --paginate repos/{owner}/{repo}/pulls/$PR/files # per-file patch hunks — validate comment line numbers against these
gh pr checks "$PR" # CI status (evidence, not a finding to re-derive)
# Existing feedback — read before posting so you never duplicate a point:
gh api --paginate repos/{owner}/{repo}/pulls/$PR/comments # inline review comments
gh api --paginate repos/{owner}/{repo}/pulls/$PR/reviews # prior reviews
gh api --paginate repos/{owner}/{repo}/issues/$PR/comments # conversation comments
# Linked issue (acceptance criteria) — PRs link via "Closes #N":
gh pr view "$PR" --json body,closingIssuesReferences
gh issue view <N> --json number,title,body,state,labels
```
### 3. Post inline comments + verdict in ONE review (the reliable path)
Bundle every line-anchored comment and the verdict into a single
`POST .../pulls/<PR>/reviews` call. The nested `comments[]` array can't be
built with `-f`/`-F`, so pass raw JSON. Build it with `jq` (safest — it
escapes bodies for you) **or** a quoted heredoc, then `--input`.
Write the static `comments[]` array with a **quoted** heredoc (so backticks
and `$` in bodies stay literal), then let `jq` inject the **computed**
`commit_id` and `event` — never hardcode the verdict, or you'll post
`REQUEST_CHANGES` on a self-PR (422). `$EVENT` and `$HEAD_SHA` come from
steps 1 and 5; on your own PR `$EVENT` is `COMMENT`.
```bash
cat > /tmp/comments.json <<'JSON'
[
{ "path": "src/auth.ts", "line": 88, "side": "RIGHT",
"body": "**🔴 CRITICAL — SQL injection.** userId is concatenated into the query; use a bound parameter (see suggestion)." },
{ "path": "src/api.ts", "start_line": 20, "start_side": "RIGHT", "line": 23, "side": "RIGHT",
"body": "**🟠 MAJOR — unhandled rejection.** Wrap this block in try/catch and return a 5xx." },
{ "path": "src/old.ts", "line": 7, "side": "LEFT",
"body": "**🟡 MINOR** — comment on a *deleted* line (LEFT = original file)." }
]
JSON
jq -n \
--arg sha "$HEAD_SHA" \
--arg event "$EVENT" \
--arg body "## diff-reviewer verdict: $EVENT — see inline comments + threads." \
--slurpfile comments /tmp/comments.json \
'{commit_id:$sha, event:$event, body:$body, comments:$comments[0]}' \
| gh api repos/{owner}/{repo}/pulls/$PR/reviews --input -
```
> `jq` escapes the bodies and injects the real `$HEAD_SHA`/`$EVENT`, so the
> verdict always matches step 5 (and the self-PR fallback). Keep `{owner}`/
> `{repo}` in the URL — they don't expand inside the JSON.
**Line/side rules (getting these wrong → HTTP 422):**
- `path` — repo-relative file path.
- `line` — the line number **in the file** the comment targets; for a
multi-line comment it is the **last** line of the range.
- `side` — `RIGHT` = added/unchanged (new file; the default), `LEFT` =
deleted (original file). Use `LEFT` for removed lines.
- Multi-line comment → **also** set `start_line` + `start_side` (the first
line/side; `start_line < line`). Single-line → omit both.
- The target line **must be part of the diff** (an added/changed/context
line inside a hunk) — validate against `pulls/$PR/files` patch hunks
first, or the whole call 422s.
- `event`: `APPROVE` | `REQUEST_CHANGES` | `COMMENT`. `body` is **required**
for `REQUEST_CHANGES`/`COMMENT`. Omitting `event` leaves the review
**PENDING** (unsubmitted, no notification) — don't forget to submit.
**Proposed fixes — suggestion blocks.** When the fix is a local edit,
include a suggestion block in the comment `body` so the author applies it in
one click. The body is a JSON string, so the block is a `\n`-delimited
fenced section like this (literal newlines shown for clarity):
````text
**🔴 CRITICAL — SQL injection.** Use a parameterised query:
```suggestion
const rows = await db.query('SELECT * FROM users WHERE id = $1', [userId]);
```
````
In JSON that body becomes:
`"...Use a parameterised query:\n\n```suggestion\n const rows = ...\n```"`
(the suggestion replaces exactly the commented line(s)).
### 4. Post a conceptual (non-line) thread
For findings not tied to one line — architecture, missing tests, PR scope:
```bash
gh pr comment "$PR" --body "**🟠 MAJOR — no tests for the new auth path.** AC-3 requires a failing-login test; none added. ..."
```
### 5. Verdict & self-PR fallback
The `event` on the review **is** the verdict. But you **cannot** `APPROVE`
or `REQUEST_CHANGES` your **own** PR (GitHub returns 422). Branch on it:
```bash
if [ "$ME" = "$AUTHOR" ]; then
EVENT="COMMENT" # always allowed on your own PR; still carries inline comments + summary
else
EVENT="REQUEST_CHANGES" # or APPROVE / COMMENT per the findings
fi
```From igorilic/agentic-orchestration, MIT.
More from igorilic/agentic-orchestration
- 0.514score
ticket
igorilic
Pull a Jira issue and scaffold a feature spec with test stubs.
SkillCFreshness: C★ 3Claude Code +9 - 0.514score
brainstorm
igorilic
Iterative spec elicitation for vague ideas.
SkillCFreshness: C★ 3Claude Code +9 - 0.514score
skip-tdd
igorilic
Temporarily bypass the TDD commit gate.
SkillCFreshness: C★ 3Claude Code +9 - 0.514score
tdd
igorilic
Strict test-driven development workflow.
SkillCFreshness: C★ 3Claude Code +9 - 0.514score
adr
igorilic
Create an Architecture Decision Record in docs/decisions/ and optionally sync to Confluence for business projects.
SkillCFreshness: C★ 3Claude Code +9 - 0.514score
explore
igorilic
Exploratory mode — spike, prototype, brainstorm.
SkillCFreshness: C★ 3Claude Code +9 - 0.514score
glab-cli
igorilic
Drive the GitLab CLI (glab) to review a merge request — fetch the diff and context, post inline discussion comments anchored to specific diff lines (via a…
SkillCFreshness: C★ 3Claude Code +9 - 0.514score
override-confidence
igorilic
Bypass the confidence gate for the next PR/MR creation.
SkillCFreshness: C★ 3Claude Code +9 - 0.514score
pipeline-github-feature
igorilic
Feature development pipeline for GitHub repositories using Claude LLMs.
SkillCFreshness: C★ 3Claude Code +9 - 0.514score
pipeline-gitlab-feature
igorilic
Full feature development pipeline for GitLab repositories using Copilot CLI agents and Jira integration.
SkillCFreshness: C★ 3Claude Code +9 - 0.514score
pipeline-gitlab-incident
igorilic
Incident response pipeline for GitLab repositories using Copilot CLI, Jira, and troubleshooter.
SkillCFreshness: C★ 3Claude Code +9 - 0.514score
pr
igorilic
Create a pull request (GitHub) or merge request (GitLab) with conventional description, test summary, and checklist.
SkillCFreshness: C★ 3Claude Code +9
Signals
- Stars
- 3
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Jun 18, 2026 (4 months ago)
- Last release
- May 4, 2026 (5 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from igorilic
- 0.514score
override-confidence
igorilic
Bypass the confidence gate for the next PR/MR creation.
SkillCFreshness: C★ 3Claude Code +9 - 0.514score
adr
igorilic
Create an Architecture Decision Record in docs/decisions/ and optionally sync to Confluence for business projects.
SkillCFreshness: C★ 3Claude Code +9 - 0.514score
brainstorm
igorilic
Iterative spec elicitation for vague ideas.
SkillCFreshness: C★ 3Claude Code +9 - 0.514score
explore
igorilic
Exploratory mode — spike, prototype, brainstorm.
SkillCFreshness: C★ 3Claude Code +9 - 0.514score
glab-cli
igorilic
Drive the GitLab CLI (glab) to review a merge request — fetch the diff and context, post inline discussion comments anchored to specific diff lines (via a…
SkillCFreshness: C★ 3Claude Code +9 - 0.514score
pipeline-github-feature
igorilic
Feature development pipeline for GitHub repositories using Claude LLMs.
SkillCFreshness: C★ 3Claude Code +9
Cite this page
gh-cli skill. Agent Mart. https://agentmart.dev/skills/igorilic-gh-cli (last updated 2026-10-24)