About gh-cli
gh-cli is a usage guide that supplements the official gh command documentation for people handling GitHub tasks. It covers bounded list output, JSON for scripts, and submitting inline PR comments through gh api.
Key features
- 01Limit results on list commands
- 02Use --json and jq for scripts
- 03Add inline PR comments with gh api
- 04Read the diff before reviewing
Use cases
- 01Trim PR, issue, and run listings
- 02Process gh output in scripts
- 03Comment on specific lines in a PR diff
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ fredrikaverpil/ dotfiles --skill gh-cliAfter installing, type/gh-cliin Claude Code to confirm it loaded.
Details
From the project READMEgh CLI
gh --help and https://cli.github.com/manual cover the command surface. This
skill covers only what they don't.
Conventions
- Pass
--limit Non every list command (pr list,issue list,run list). The defaults dump far more than a terminal needs. --json FIELDSwhen the output feeds a script; pipe tojqfrom 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:
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.