All skills
Skillintermediate

GitHub CLI Mapping

Use these mappings for PR review workflows with GitHub CLI.

Claude Code Knowledge Pack7/10/2026

Overview

GitHub CLI Mapping

Use these mappings for PR review workflows with GitHub CLI.

Read-Only Policy

  • Treat this workflow as read-only.
  • Use only read/list/view/search/diff/check operations.
  • Enable the read-only shell environment first: source "<SKILL_DIR>/scripts/activate-gh-readonly.sh".
  • After sourcing, call gh normally; it is intercepted by the read-only wrapper.
  • Do not run mutating operations (edit, comment, review, merge, or gh api with POST/PATCH/PUT/DELETE).

Prerequisites

  • Confirm auth: gh auth status
  • Resolve repository context:
    • Preferred: run inside the repository root.
    • Alternative: add -R <owner>/<repo> to commands.

Backend Review Operation Mapping

Allowed operationGitHub CLI equivalent
search_codegh search code "<query>"
get_commitgh api repos///commits/
get_file_contentsgh api repos///contents/?ref= (content is usually base64 in .content)
get_issuegh issue view <ISSUE_NUMBER> [--comments] [--json <fields>]
get_megh api user
get_pull_requestgh pr view <PR_NUMBER> [--json <fields>]
get_pull_request_commentsPR conversation comments: gh pr view <PR_NUMBER> --comments; issue comments API: gh api repos///issues/<PR_NUMBER>/comments --paginate; inline review comments: gh api repos///pulls/<PR_NUMBER>/comments --paginate
get_pull_request_diff`gh pr diff <PR_NUMBER> [--patch
get_pull_request_filesgh api repos///pulls/<PR_NUMBER>/files --paginate
get_pull_request_reviewsgh api repos///pulls/<PR_NUMBER>/reviews --paginate
get_pull_request_statusgh pr checks <PR_NUMBER> [--json <fields>]
list_commitsgh api repos///commits --paginate
list_pull_requestsgh pr list [flags]
search_issuesgh search issues "<query>"

Notes

  • Prefer gh pr view --json ... and gh pr checks --json ... when structured output is needed.
  • Prefer gh api when no first-class subcommand exists.
  • Use --paginate for list endpoints when full history matters.
  • Keep requests scoped to required fields to reduce noise.
  • If asked to post review comments or change PR state, refuse and keep the process read-only.