Agent skill

Gh CLI

by BiFangKNT in BiFangKNT/mtga

使用 GitHub CLI (gh) 执行非交互式 GitHub 协作与自动化任务(PR、Issue、Actions、Release、API 查询/修改)。当用户要求“用 gh 命令完成任务”、需要结构化 JSON 输出(--json/--jq)、批量处理 PR/Issue(如“批量 review 多个 PR”)、按策略合并(如“检查通过后自动 squash 合并”)时使用此 skill。

AGPL-3.0Auto-check passedDevelopment

Install Gh CLI

skills CLI
$ npx skills add BiFangKNT/mtga --skill gh-cli -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install BiFangKNT/mtga gh-cli --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/BiFangKNT/mtga.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.codex/skills/gh-cli .claude/skills/gh-cli && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
gh-cli
GitHub stars
1.2k
Token cost
~599 tokens
SKILL.md length
164 words
Files
38 (incl. references)
Skills in repo
6
Repo updated
First seen
Licence
AGPL-3.0

At a glance

使用 GitHub CLI (gh) 执行非交互式 GitHub 协作与自动化任务(PR、Issue、Actions、Release、API 查询/修改)。当用户要求“用 gh 命令完成任务”、需要结构化 JSON 输出(--json/--jq)、批量处理 PR/Issue(如“批量 review 多个 PR”)、按策略合并(如“检查通过后自动 squash 合并”)时使用此 skill。

  • Works in 5 steps: 确认认证与仓库上下文。 → 如果命令参数不确定,先运行 gh --help 或 gh help 。 → 先生成“只读探测命令”,再生成“变更命令”。 → …
  • Tasks that involve Pull requests
  • SKILL.md covers Overview, Workflow, Operation Decision and Command Rules, plus 4 more sections
  • Calls gh

What it does

Gh CLI is an agent skill from BiFangKNT/mtga. 使用 GitHub CLI (gh) 执行非交互式 GitHub 协作与自动化任务(PR、Issue、Actions、Release、API 查询/修改)。当用户要求“用 gh 命令完成任务”、需要结构化 JSON 输出(--json/--jq)、批量处理 PR/Issue(如“批量 review 多个 PR”)、按策略合并(如“检查通过后自动 squash 合并”)时使用此 skill。

Its SKILL.md is about 600 tokens, which your agent loads only when the skill is triggered. The skill folder holds 39 other files, including reference files (for example `agents/openai.yaml`, `references/api-graphql.md` and `references/api-rest.md`).

It sits in Development, covering Pull requests. It works with GitHub. The repository describes itself as: 基于本地代理的方式,绕过 IDE 的固定模型服务商限制. The licence is AGPL-3.0.

When your agent uses it

  • Tasks that involve Pull requests

Example prompts

  • “用 gh 命令完成任务”
  • “批量 review 多个 PR”
  • “检查通过后自动 squash 合并”
  • “/gh-cli”

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. 确认认证与仓库上下文。
  2. 如果命令参数不确定,先运行 gh --help 或 gh help 。
  3. 先生成“只读探测命令”,再生成“变更命令”。
  4. 变更命令明确影响范围(仓库、PR/Issue 编号、merge 策略、是否删除分支)。
  5. 执行后返回关键输出与下一步建议。

What it can do on your machine

Read from SKILL.md and the folder at commit 72669fb. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • gh

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use gh, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Gh CLI loads about 599 tokens when it runs, and up to ~2.5k if it reads all its reference files. Until then it costs about 52 tokens; SKILL.md has 164 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~52
When it runs · the whole SKILL.md, loaded when a task matches
~599
With references · SKILL.md plus every file in references/, read only if the agent opens them
~2.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from BiFangKNT/mtga at commit 72669fb, republished under its AGPL-3.0 licence (© BiFangKNT). 164 words, ~599 tokens.

Download SKILL.mdSave it as .claude/skills/gh-cli/SKILL.md (or your agent's skills folder). This skill also uses 37 other files; get the full folder from GitHub.
name
gh-cli
description
使用 GitHub CLI (`gh`) 执行非交互式 GitHub 协作与自动化任务(PR、Issue、Actions、Release、API 查询/修改)。当用户要求“用 gh 命令完成任务”、需要结构化 JSON 输出(`--json`/`--jq`)、批量处理 PR/Issue(如“批量 review 多个 PR”)、按策略合并(如“检查通过后自动 squash 合并”)时使用此 skill。

gh-cli

Overview

以可复现、可审计的方式调用 gh。默认输出结构化数据,优先使用非交互命令,避免依赖浏览器或 TUI。

Workflow

  1. 确认认证与仓库上下文。
  2. 如果命令参数不确定,先运行 gh <subcommand> --help 或 gh help <topic>。
  3. 先生成“只读探测命令”,再生成“变更命令”。
  4. 变更命令明确影响范围(仓库、PR/Issue 编号、merge 策略、是否删除分支)。
  5. 执行后返回关键输出与下一步建议。

Operation Decision

  1. 用户只问“现状/列表/状态”:只执行只读命令(list/view/status/api GET)。
  2. 用户要求“评论/审查/合并/触发工作流”:先只读确认对象存在与状态,再执行变更命令。
  3. 用户同时要“查询+修改”:拆成两段,先回显查询结果,再给修改命令并执行。
  4. 用户目标不完整(缺编号、缺仓库、缺 merge 方法):先补齐参数,不直接变更。
  5. 用户要求“整体审查结论”(approve/request-changes/comment):使用 gh pr review。
  6. 用户要求“按文件/按行评论”:使用 gh api repos/{owner}/{repo}/pulls/{num}/reviews 或 gh api repos/{owner}/{repo}/pulls/{num}/comments,不要把 gh pr review 当作行内评论接口。

Command Rules

  • 默认使用非交互模式;不要依赖手动输入。
  • 优先输出 JSON:使用 --json + --jq/-q 精简结果。
  • 需要批量查询时,优先 gh api --paginate。
  • 需要复杂参数时,优先 gh api -f/-F 或 --input 传文件。
  • gh pr diff 不支持按文件路径直接过滤;按文件获取 patch 使用 gh api repos/{owner}/{repo}/pulls/{num}/files --paginate 再筛选。
  • 提交行内评论前,必须先查询 headRefOid,并保证请求里的 commit_id 与其一致;否则常见 422。
  • 构造复杂 JSON 时,优先内存对象后通过标准输入喂给 gh api --input -,避免在工作区落地临时文件。

Failure Handling

  • 认证失败:先执行 gh auth status,返回失败原因并给出最小修复命令。
  • 权限不足(repo/org/token scope):明确缺失权限,不尝试重复写操作。
  • 资源不存在(PR/Issue 编号错误):先回显查询命令与空结果,再请求更正目标。
  • 分支保护或检查未通过导致无法 merge:返回阻塞项(review/check/protection),并给出可执行下一步。
  • 二次执行冲突(已 merge、已关闭、已评论):识别幂等场景并停止重复变更。

Safety Checklist

执行任何写操作前,先确认:

  • 目标仓库(owner/repo)。
  • 目标对象(PR/Issue 编号或 workflow 名称)。
  • 操作类型(comment/review/merge/run 等)。
  • 关键策略(merge 方法、是否 --delete-branch、是否 --auto)。
  • 若为行内评论:headRefOid 与 commit_id 一致。
  • 预期结果(状态变化、评论内容、触发记录)。

缺任一关键项时,先补信息,再执行。

Output Format

统一按以下结构输出:

  1. Plan: 本次要做的动作(1-2 行)。
  2. Commands: 实际执行的命令(先只读,后变更)。
  3. Result: 关键字段(如 number、state、url、reviewDecision)。
  4. Next: 若失败或受阻,给最短可执行下一步。

Reference

按需读取参考文档,避免一次加载全部命令:

  • 入口索引:references/commands.md
  • 认证:references/auth.md
  • 仓库上下文:references/repo.md
  • PR:references/pr.md
  • Issue:references/issue.md
  • Workflow:references/workflow.md
  • Run:references/run.md
  • API:references/api.md
  • 细粒度子命令:references/commands.md 列出的 *-*.md 文件(如 pr-diff.md、run-watch.md)

© BiFangKNT, AGPL-3.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 37 other files (references) in .codex/skills/gh-cli of BiFangKNT/mtga.

  • SKILL.md
  • agents/openai.yaml
  • references/api-graphql.md
  • references/api-rest.md
  • references/api.md
  • references/auth-logout.md
  • references/auth-status.md
  • references/auth-switch.md
  • references/auth-token.md
  • references/auth.md
  • references/commands.md
  • references/issue-comment.md
  • references/issue-create.md
  • references/issue-list.md
  • references/issue-view.md
  • references/issue.md
  • references/pr-checkout.md
  • references/pr-checks.md
  • references/pr-comment.md
  • … and 19 more

Open the folder on GitHubat commit 72669fb

Compare with similar skills

Gh CLI next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Gh CLI compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Gh CLI this skillBiFangKNT/mtga1.2k—~599Automated safety check: PassAGPL-3.0
PR Babysitteropeninterpreter/openinterpreter69k3 repos~4.2kAutomated safety check: PassApache-2.0
Check PRonyx-dot-app/onyx32k2 repos~2.3kAutomated safety check: PassMIT
Contributor-First PR MergeHKUDS/OpenHarness16k1 repos~847Automated safety check: PassMIT
Create Pull Requestcline/cline70k1 repos~1.6kAutomated safety check: PassApache-2.0
Pull Request Title and Body Writeropeninterpreter/openinterpreter69k2 repos~1.1kAutomated safety check: PassApache-2.0

Similar skills

  • PR Babysitter

    openinterpreter/openinterpreter

    Watches an open GitHub pull request until it merges, handling review comments, diagnosing CI failures and retrying flaky checks along the way.

    69k GitHub starsUsed in 3 repos~4.2k tokens
    DevelopmentAuto-check passed
  • Check PR

    onyx-dot-app/onyx

    Checks a GitHub, GitLab, or Perforce (p4) pull request (or merge request, or shelved changelist) for unresolved review comments, failing status checks, and incomplete PR descriptions.

    32k GitHub starsUsed in 2 repos~2.3k tokens
    DevelopmentAuto-check passed
  • Merges external GitHub pull requests while keeping the original author credited, and fixes conflicts after the merge instead of rewriting the contribution.

    16k GitHub starsUsed in 1 repo~847 tokens
    DevelopmentAuto-check passed
  • Opens a GitHub pull request from your current branch with the gh CLI, after reviewing the commits and diff and gathering the details the PR needs.

    70k GitHub starsUsed in 1 repo~1.6k tokens
    DevelopmentAuto-check passed
  • Pull Request Title and Body Writer

    openinterpreter/openinterpreter

    Rewrites the title and body of one or more pull requests with gh, leading with why the change was made, then what changed, and describing only the net result.

    69k GitHub starsUsed in 2 repos~1.1k tokens
    DevelopmentAuto-check passed
  • Official

    Runs a loop on a GitHub pull request: fetch review state, triage comments into actions, implement them and resolve threads, repeating until nothing actionable is left.

    48k GitHub stars~2.2k tokensUpdated today
    DevelopmentAuto-check passed

More from BiFangKNT/mtga

  • Ast Grep

    BiFangKNT/mtga

    Write and debug ast-grep rules for structural code search and rewrite.

    1.2k GitHub stars~802 tokensUpdated 3 mo ago
    Auto-check passed
  • Trae Native Debug

    BiFangKNT/mtga

    Maintain, debug, and recover MTGA's Trae native custom-model route.

    1.2k GitHub stars~920 tokensUpdated 3 mo ago
    Auto-check passed
  • Tauri

    BiFangKNT/mtga

    构建、调试与发布 Tauri v2 应用的工程化工作流。覆盖项目初始化(create-tauri-app)、前端与 Rust 命令通信([tauri::command] + invoke)、状态管理、Capabilities 权限建模、插件接入、跨平台构建与问题排查。当用户需求涉及“创建 Tauri 项目”“把 Web 前端接到 Rust…

    1.2k GitHub stars~466 tokensUpdated 3 mo ago
    Auto-check passed
  • Uv

    BiFangKNT/mtga

    在 Windows/macOS/Linux 上使用 uv 执行 Python 运行、依赖同步、锁文件管理、Python 版本管理与工具命令(uv run、uv sync、uv lock、uv python、uv tool)。当任务涉及“用 uv 运行脚本/命令”“临时依赖(--with)”“锁文件一致性(--locked/--frozen)”“跨平台…

    1.2k GitHub stars~541 tokensUpdated 3 mo ago
    Auto-check passed
  • Pwsh

    BiFangKNT/mtga

    在 Windows PowerShell 5.1 与 PowerShell 7 中编写和执行稳定命令,重点处理引号、管道符、原生命令参数传递与跨版本兼容。遇到 --jq/过滤表达式被 PowerShell 误解析、同一命令在 pwsh5 与 pwsh7 行为不一致、或需要为 pwsh7.3+ 增加参数传递适配时使用此 skill。

    1.2k GitHub stars~338 tokensUpdated 3 mo ago
    Auto-check passed

Works with

Categories

Questions about Gh CLI

What does Gh CLI do?

使用 GitHub CLI (gh) 执行非交互式 GitHub 协作与自动化任务(PR、Issue、Actions、Release、API 查询/修改)。当用户要求“用 gh 命令完成任务”、需要结构化 JSON 输出(--json/--jq)、批量处理 PR/Issue(如“批量 review 多个 PR”)、按策略合并(如“检查通过后自动 squash 合并”)时使用此 skill。. Gh CLI is an agent skill from BiFangKNT/mtga.

When should I use Gh CLI?

Gh CLI fits situations like: tasks that involve Pull requests.

How do I install Gh CLI in Claude Code?

Run `npx skills add BiFangKNT/mtga --skill gh-cli -a claude-code`. Or copy the skill folder (.codex/skills/gh-cli in BiFangKNT/mtga) into .claude/skills/gh-cli in your project. Claude Code loads it when a task matches its description.

How do I install Gh CLI in Codex?

Run `npx skills add BiFangKNT/mtga --skill gh-cli -a codex`. Or copy the skill folder (.codex/skills/gh-cli in BiFangKNT/mtga) into .agents/skills/gh-cli in your project. Codex loads it when a task matches its description.

Can I use Gh CLI in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add BiFangKNT/mtga --skill gh-cli -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/gh-cli, .gemini/skills/gh-cli, .github/skills/gh-cli and .opencode/skills/gh-cli in your project.

What does Gh CLI need to run?

Going by SKILL.md and its folder, Gh CLI needs the command-line tools its instructions call (gh).

Does Gh CLI access the network?

SKILL.md contains no URLs. Its commands use gh, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Gh CLI safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Gh CLI use?

Gh CLI is published under the AGPL-3.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Gh CLI use?

About 599 tokens (SKILL.md is roughly 2.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.9k tokens, read only when the agent opens those files.

What are the alternatives to Gh CLI?

Skills that share tags, products or a category with Gh CLI: PR Babysitter (openinterpreter/openinterpreter, 69k stars), Check PR (onyx-dot-app/onyx, 32k stars), Contributor-First PR Merge (HKUDS/OpenHarness, 16k stars) and Create Pull Request (cline/cline, 70k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Gh CLI?

BiFangKNT (a GitHub user) maintains it in BiFangKNT/mtga, which has 1,169 GitHub stars. The repository holds 6 skills in this directory. The repository was last updated on June 18, 2026.

Source: BiFangKNT/mtga on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.