---
name: gh-cli-266f3a1c16e5
description: GitHub CLI (gh) conventions and the inline PR review recipe. Use when working with GitHub repositories, PRs, issues, actions, `gh api`, or any GitHub operations from the command line.
---

# gh CLI

`gh --help` and https://cli.github.com/manual cover the command surface. This
skill covers only what they don't.

## Conventions

- Pass `--limit N` on every list command (`pr list`, `issue list`, `run list`).
  The defaults dump far more than a terminal needs.
- `--json FIELDS` when the output feeds a script; pipe to `jq` from there.

## Reviewing a PR with line-level comments

`gh pr review` only submits an overall body. Inline comments need `gh api`,
which posts the comments and the summary in one call. Read the diff first
(`gh pr diff NUMBER`), then:

```bash
gh api repos/{owner}/{repo}/pulls/NUMBER/reviews --input - <<'EOF'
{
  "commit_id": "LATEST_COMMIT_SHA",
  "event": "COMMENT",
  "body": "Overall: solid changes with a few suggestions.",
  "comments": [
    {
      "path": "src/example.go",
      "line": 42,
      "side": "RIGHT",
      "body": "This variable is unused."
    }
  ]
}
EOF
```

`side` is `RIGHT` for additions, `LEFT` for deletions; multi-line comments add
`start_line` and `start_side`. A `body` may contain a GitHub suggestion block
(```` ```suggestion ````) to propose replacement code.

`event` is `COMMENT`, `APPROVE`, or `REQUEST_CHANGES` — ask me which one before
submitting, and default to `COMMENT`.


---
Source attribution: fredrikaverpil
Original project: https://github.com/fredrikaverpil/dotfiles/blob/f7f0329b62954fa245c4f8a216960af2cad9f725/stow/shared/.claude/skills/gh-cli/SKILL.md
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Mega AI Hub.

## Upstream license notice

MIT License

Copyright (c) 2021 Fredrik Averpil

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



# Mega AI Hub resource metadata

Creator / publisher: fredrikaverpil
Original project: https://github.com/fredrikaverpil/dotfiles/blob/f7f0329b62954fa245c4f8a216960af2cad9f725/stow/shared/.claude/skills/gh-cli/SKILL.md
Attribution basis: Source repository record

Fields of work: Sales, Development & Engineering, Product Management
Roles: Sales Development Rep (SDR), Sales Engineer, Backend Developer, Frontend Developer, Product Manager
Specialties: Git, Backend, Cross Platform
Tools: GitHub
Country applicability: Country not specified
Classification basis: Source category, role and specialization labels
Instruction SHA-256: 24e4ab3a6ade4b3c85d70e8e8fce819363acf21a9dc606ada337ce2c4d091202
