Read-only commands (pre-approved, run freely)
gh issue list ... — list issues with filters (state, label, author,
assignee, search)
gh issue view <n> (incl. --comments) — one issue's body and
metadata; --comments adds the conversation
gh pr list ... — list PRs with filters (state, label, author, base,
head)
gh pr view <n> (incl. --comments) — one PR's body and metadata;
--comments adds issue comments + review summaries (NOT inline
review comments — see gh api below)
gh pr diff <n> — show the diff of a PR
gh pr checks <n> — CI / check status of a PR
gh repo view [owner/repo] — repo metadata (description, default
branch, README)
gh run list ... — list workflow runs (CI history)
gh run view <id> (incl. --log) — one run's status; --log adds
the full log
gh search <type> ... — search across GitHub: issues, prs,
code, commits, repos
Read-only gh api endpoints (pre-approved, exact form only)
gh pr view --comments shows issue comments and review summaries but
NOT inline (line-level) review comments. For those, use gh api. The
following three GET endpoints are pre-approved:
gh api repos/<owner>/<repo>/issues/<n>/comments — issue/PR conversation comments
gh api repos/<owner>/<repo>/pulls/<n>/comments — inline review comments on code lines
gh api repos/<owner>/<repo>/pulls/<n>/reviews — review summaries
The patterns are deliberately exact (no trailing *). Any extra flag
or query string — --paginate, ?per_page=100, -q, --jq, etc. —
falls through to an approval prompt. Do NOT widen, split, or otherwise
reshape the call to slip past this; if the bare form is not enough,
accept the prompt.
Write operations
A write operation is any gh invocation that changes state on GitHub.
Writes are NOT pre-approved — every write surfaces an approval prompt.
In scope: writes you may run when the user explicitly asks
When the user explicitly requests one of these, construct the natural
command and run it. The harness will prompt for approval; that prompt
is the user's confirmation.
gh pr <subcommand> — typical writes: create, close, reopen,
comment, edit, merge, review, ready
gh issue <subcommand> — typical writes: create, close,
reopen, comment, edit
Out of scope
Any other write — gh repo writes, gh release ..., gh run cancel / delete / rerun, gh secret ..., gh workflow ..., gh api with
-X POST | PATCH | DELETE | PUT or --method ..., etc. — has no
current use case. Do not execute these.
Rules
Never execute a write unless the user explicitly asks for that
write. Phrases like "add a comment", "comment on the PR", "merge
it", "close this issue" are explicit. Inferring writes from context
("ship this", "let them know") is NOT explicit — ask first.
When the user does ask (in-scope writes), run the natural
command. Example: gh pr comment 123 --body "...". The command
is not in the allow-list, so the harness surfaces an approval
prompt. That prompt is the user's confirmation. Do not try to
skip it.
Never reshape a write to evade pattern matching. Prohibited:
- Hiding the body via
--body-file -, here-docs, or stdin pipes
to disguise the visible command shape.
- Splitting one API call into several to slip under allow-list
rules.
- Using a different channel (web URL,
git push of a
PR-creating commit, etc.) to achieve the same write without
going through the prompt.
If a write requires approval, let it require approval.
If unsure whether a command writes, treat it as a write.
1---2name: gh-cli3description: Use the GitHub CLI (`gh`) to fetch information from GitHub: issues, PRs, comments, reviews, workflow runs, repos, and search. A curated set of read-only `gh` subcommands and read-only `gh api` endpoints are pre-approved and run without prompts. The sandbox lets `gh *` reach the network unsandboxed. Write operations (anything that changes state on GitHub) are NOT pre-approved and MUST NOT be executed unless the user explicitly asks for that write. Even when explicitly requested, run the natural command and let the harness's approval prompt fire — NEVER reshape the command to evade pattern matching. Use this skill whenever you need information from GitHub. Proactively invoke it (do NOT answer from memory or prior conversation) when the user references a GitHub issue, PR, review, comment, action run, or repo, or asks things like "show me the comments", "what's in PR #N", "what did the reviewer say".4---56## Read-only commands (pre-approved, run freely)78- `gh issue list ...` — list issues with filters (state, label, author,9 assignee, search)10- `gh issue view <n>` (incl. `--comments`) — one issue's body and11 metadata; `--comments` adds the conversation12- `gh pr list ...` — list PRs with filters (state, label, author, base,13 head)14- `gh pr view <n>` (incl. `--comments`) — one PR's body and metadata;15 `--comments` adds issue comments + review summaries (NOT inline16 review comments — see `gh api` below)17- `gh pr diff <n>` — show the diff of a PR18- `gh pr checks <n>` — CI / check status of a PR19- `gh repo view [owner/repo]` — repo metadata (description, default20 branch, README)21- `gh run list ...` — list workflow runs (CI history)22- `gh run view <id>` (incl. `--log`) — one run's status; `--log` adds23 the full log24- `gh search <type> ...` — search across GitHub: `issues`, `prs`,25 `code`, `commits`, `repos`2627## Read-only `gh api` endpoints (pre-approved, exact form only)2829`gh pr view --comments` shows issue comments and review summaries but30NOT inline (line-level) review comments. For those, use `gh api`. The31following three GET endpoints are pre-approved:3233- `gh api repos/<owner>/<repo>/issues/<n>/comments` — issue/PR conversation comments34- `gh api repos/<owner>/<repo>/pulls/<n>/comments` — inline review comments on code lines35- `gh api repos/<owner>/<repo>/pulls/<n>/reviews` — review summaries3637The patterns are deliberately exact (no trailing `*`). Any extra flag38or query string — `--paginate`, `?per_page=100`, `-q`, `--jq`, etc. —39falls through to an approval prompt. Do NOT widen, split, or otherwise40reshape the call to slip past this; if the bare form is not enough,41accept the prompt.4243## Write operations4445A write operation is any `gh` invocation that changes state on GitHub.46Writes are NOT pre-approved — every write surfaces an approval prompt.4748### In scope: writes you may run when the user explicitly asks4950When the user explicitly requests one of these, construct the natural51command and run it. The harness will prompt for approval; that prompt52is the user's confirmation.5354- `gh pr <subcommand>` — typical writes: `create`, `close`, `reopen`,55 `comment`, `edit`, `merge`, `review`, `ready`56- `gh issue <subcommand>` — typical writes: `create`, `close`,57 `reopen`, `comment`, `edit`5859### Out of scope6061Any other write — `gh repo` writes, `gh release ...`, `gh run cancel /62delete / rerun`, `gh secret ...`, `gh workflow ...`, `gh api` with63`-X POST | PATCH | DELETE | PUT` or `--method ...`, etc. — has no64current use case. Do not execute these.6566### Rules67681. **Never execute a write unless the user explicitly asks for that69 write.** Phrases like "add a comment", "comment on the PR", "merge70 it", "close this issue" are explicit. Inferring writes from context71 ("ship this", "let them know") is NOT explicit — ask first.72732. **When the user does ask (in-scope writes), run the natural74 command.** Example: `gh pr comment 123 --body "..."`. The command75 is not in the allow-list, so the harness surfaces an approval76 prompt. **That prompt is the user's confirmation. Do not try to77 skip it.**78793. **Never reshape a write to evade pattern matching.** Prohibited:80 - Hiding the body via `--body-file -`, here-docs, or stdin pipes81 to disguise the visible command shape.82 - Splitting one API call into several to slip under allow-list83 rules.84 - Using a different channel (web URL, `git push` of a85 PR-creating commit, etc.) to achieve the same write without86 going through the prompt.8788 If a write requires approval, let it require approval.89904. If unsure whether a command writes, treat it as a write.