github-cli

A guide for using GitHub CLI, a command-line tool for working with GitHub repositories and collaboration features. It covers account checks, repository information, issues, pull requests, and Actions.

In plain words
What is it for?
Use it to view repositories, issues, pull requests, checks, workflow runs, and related GitHub settings, and to plan approved GitHub changes.
Why use it?
It provides a safer, repeatable way to inspect and manage GitHub work from the terminal while checking the target repository and account first.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/donglistudio/personal-agent-foundation/github-cli
Any agent
npx skills add DongLiStudio/personal-agent-foundation --skill github-cli
Clone the repo
git clone --depth 1 https://github.com/DongLiStudio/personal-agent-foundation

Made for: Claude Code, Codex.

Per session 109 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,031 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00109 $0.01031
Opus 5 $0.00055 $0.00515
Sonnet 5 $0.00022 $0.00206
Haiku 4.5 $0.00011 $0.00103

Measured 3d ago against content hash c2a52011b502, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

github-cli scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

template/GLOBAL/.agents/skills/github-cli/SKILL.md · 63 lines

How it starts

The opening of the file, as written. The whole thing — 63 lines — stays where its author put it; the contents beside it link to each section on GitHub.

GitHub CLI

使用 gh 处理 GitHub 托管状态和协作流程。使用本地 git 处理本地仓库状态、diff、分支、commit 和 remote。优先使用官方 gh 子命令;只有高层命令无法满足时才使用 gh api

安全起步

  1. 使用 gh 前先确认目标仓库。在本地仓库中检查 git remote -v;不在仓库中时,要求或推断 OWNER/REPO,并传入 -R OWNER/REPO
  2. 执行 GitHub 操作前先检查认证:
    gh auth status
    
  3. 多账号场景下,如可用,先读取 {{AGENT_ROOT}}\GLOBAL\GITHUB_ACCOUNTS.md,再确认 active 账号与目标项目或用户意图匹配。
  4. 如果 active 账号不对,不要继续写操作。显式切换账号:
    gh auth switch --hostname github.com --user <username>
    
  5. 除非用户明确要求诊断凭据,否则不要打印或索要 token。避免使用 gh auth tokengh auth status --show-token
  6. 涉及账号新增、重新授权、默认/专属账号路由、换机恢复、安全退出、远程仓库创建或首次 push 时,读取 references/account-routing.md

先读后写

任何写操作前,先用只读命令建立上下文:

gh repo view OWNER/REPO
gh issue view 123 -R OWNER/REPO --comments
gh pr view 123 -R OWNER/REPO --comments
gh pr checks 123 -R OWNER/REPO --json bucket,completedAt,link,name,state,workflow
gh run list -R OWNER/REPO
gh run view <run-id> -R OWNER/REPO --log

优先使用 --json 配合 --jq 或模板获得机器可读结果。命令支持 --web 时,除非用户希望打开浏览器,否则不要使用。

写操作和确认

以下操作必须有明确用户意图后再执行:创建/编辑/关闭 Issue 或 PR、PR 评论/Review、push 分支、merge PR、创建/发布/删除 Release、workflow dispatch/rerun/cancel、Secret 或 Variable 变更、仓库创建/删除/归档/可见性变更、deploy key、SSH/GPG key,以及 GitHub CLI extension/skill 安装。

高影响写操作前,说明目标账号、仓库、操作和主要参数。可行时先使用非变更预览,例如 gh pr diffgh pr viewgh release viewgh workflow viewgh api --method GET

常见工作流

任务涉及 PR、Issue、Actions/CI、Release、gh api 或 GitHub CLI skills 时,读取 references/commands.md 获取具体命令模式。账号生命周期、项目路由、remote 与首次 push 读取 references/account-routing.md

错误处理

  • 如果找不到 gh,在 Windows 上先检查 %LOCALAPPDATA%\Programs\GitHub CLI\gh.exe,再询问是否安装或修复 PATH。
  • 如果尚未登录,运行 gh auth login --hostname github.com --git-protocol https --web,并把浏览器/设备授权指引返回给用户。
  • 如果缺少 scopes,先说明为什么需要该 scope,再使用 gh auth refresh --scopes <scope>
  • 如果 rate limited 或 unauthorized,先确认 active 账号、host 和仓库访问权限;不要重试破坏性命令。
  • 如果输出包含 secrets,回复前先脱敏。

Read the full file on GitHub · 63 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 63 lines · 109 tokens per session scan A c2a52011b502

Subscribe to this mod's changes

github-cli is a skill published in the GitHub repository DongLiStudio/personal-agent-foundation (11 stars, last pushed 16d ago), licensed Apache-2.0. It adds 109 tokens to every session and 1,031 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

windows-mcp-tool-tester

Automated testing skill for Windows-MCP tools. Use this skill whenever the user wants to test, validate, benchmark, or evaluate any Windows-MCP tool (App, PowerShell, Screenshot, Snapshot, Click, Type, Scroll, Move, Shortcut, Wait, MultiSelect, MultiEdit, Clipboard, Process, Notification, FileSystem, Registry…

CursorTouch/Windows-MCP · 139 tokens

facts-discover

Scan the codebase and classify every fact by lifecycle stage — tag @draft, @spec, or @implemented based on what the code actually shows. Add missing facts, fix inaccurate ones, remove obsolete ones. Use when asked to discover facts, bootstrap or update a fact sheet, scan the codebase for truths, sync facts to match…

av/harbor · 82 tokens

anneal

Use when the user wants to systematically fix AI code slop — duplicated logic, over-engineering, silent error swallowing, convention drift, cargo-cult patterns, and other LLM-introduced architectural decay — over a specified duration.

av/harbor · 49 tokens

new-service

Add a new service to Harbor — scaffold the compose config, environment variables, metadata, documentation, and cross-service integrations. Use this skill whenever the user wants to add a new service to Harbor, integrate a new tool/app/model server, create a compose configuration for a new project, or onboard any…

av/harbor · 139 tokens

harbor

CLI toolkit for managing containerized LLM services. Use when the user wants to start, stop, configure, or manage AI/LLM services like Ollama, Open WebUI, llama.cpp, vLLM, LiteLLM, ComfyUI, and 250+ others. Triggers on requests to "run a model", "start ollama", "set up an LLM", "configure harbor", "manage services"…

av/harbor · 114 tokens

bughunt

Fully autonomous bug hunting pipeline — discover bugs in a scoped area using parallel subagents, independently triage each finding, fix confirmed issues with subagents, then audit all fixes against repo constraints and target platforms. Runs end-to-end without user interaction.

av/harbor · 52 tokens