Agent skill

Gh CLI

by caarlos0 in caarlos0/dotfiles

Use GitHub CLI efficiently for pull requests, CI checks, workflow runs, logs, and merge status.

MITAuto-check passedDevelopment

Install Gh CLI

skills CLI
$ npx skills add caarlos0/dotfiles --skill gh-cli -a claude-code

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

GitHub CLI
$ gh skill install caarlos0/dotfiles 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/caarlos0/dotfiles.git skills-src && mkdir -p .claude/skills && cp -r skills-src/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
220
Token cost
~2.5k tokens
SKILL.md length
1,491 words
Files
1
Skills in repo
20
Repo updated
First seen
Licence
MIT

At a glance

Use GitHub CLI efficiently for pull requests, CI checks, workflow runs, logs, and merge status.

  • Diagnosing a failed check
  • SKILL.md covers Fetch once, with a clear target, Wait for checks, not a timer, Interpret the result and Wait for PR changes, merges,…, plus 2 more sections
  • Calls gh; reaches github.com
  • Monitoring a pull request

What it does

Gh CLI is an agent skill from caarlos0/dotfiles. Use GitHub CLI efficiently for pull requests, CI checks, workflow runs, logs, and merge status. Use when running gh, waiting for CI, commits, reviews or merges, diagnosing a failed check, or monitoring a pull request.

Its SKILL.md is about 2.5k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Pull requests. It works with GitHub. The licence is MIT.

When your agent uses it

  • Diagnosing a failed check
  • Monitoring a pull request

Example prompts

  • “/gh-cli”

Requirements

  • Python 3

What it can do on your machine

Read from SKILL.md and the folder at commit 278c761. 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

    Hosts in commands or code, which the agent is likely to contact:

    • github.com

    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 2.5k tokens when it runs. Until then it costs about 56 tokens; SKILL.md has 1,491 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~56
When it runs · the whole SKILL.md, loaded when a task matches
~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 caarlos0/dotfiles at commit 278c761, republished under its MIT licence (© caarlos0). 1,491 words, ~2,530 tokens.

Download SKILL.mdSave it as .claude/skills/gh-cli/SKILL.md (or your agent's skills folder).
name
gh-cli
description
Use GitHub CLI efficiently for pull requests, CI checks, workflow runs, logs, and merge status. Use when running gh, waiting for CI, commits, reviews or merges, diagnosing a failed check, or monitoring a pull request.
user_invocable
true

GitHub CLI

Use native gh commands before custom API queries or polling scripts. Spend time on the first actionable failure, not on repeated status reads.

Fetch once, with a clear target

  • Reuse the repository, PR number, head SHA, run ID, and job ID already known. Pass -R OWNER/REPO to PR/run commands outside the target repository. For gh api, put the repository in the endpoint; it has no -R flag.
  • Prefer gh pr checks, gh run view, and gh run list over rebuilding them with REST or GraphQL. Check subcommand help instead of guessing flags or JSON fields.
  • Select only needed --json fields and use --jq for a compact result. Filter lists by commit, workflow, event, or branch before increasing --limit. Do not fetch a list again to recover an ID it already returned.
  • Use gh api for data the native command does not expose. Use --method GET with query fields; adding -f or -F otherwise changes the method to POST. Paginate when the task needs the full set, not just a recent sample.

Wait for checks, not a timer

For PR merge readiness, start this immediately:

bash
gh pr checks NUMBER -R OWNER/REPO --required --watch --fail-fast

--required is the default scope for merge blockers. Omit it only when the user asks for all checks, or when the task explicitly covers non-required checks. Do not wait for advisory checks before handling a required failure. Still report a known regression caused by this change, even if it is optional.

  • Never use sleep N && gh ... to wait for CI, including before a native watcher. Do not replace --watch with a shell/Python loop or recurring status tool calls.
  • If a required failure is already known, read its log now. Do not start another watcher or wait for unrelated jobs to finish.
  • Run one watcher per target in an attached async shell, or let a synchronous tool wait on that same process. Reuse its shell ID and completion notification. Do useful independent work, or end the turn until notified. Do not repeatedly call read_bash, start duplicate watchers, or delegate an agent just to wait.
  • Keep watch output live and preserve its exit status. Do not pipe it through head/tail, redirect errors away, or append || true. A failed watcher is not necessarily a failed check: inspect its error before acting.
  • Use the native refresh interval. Set --interval only for a concrete latency or rate-limit need, not as another arbitrary delay.

For one workflow run, when waiting for the whole run is the actual task:

bash
gh run watch RUN_ID -R OWNER/REPO --exit-status --compact

gh run watch has no --fail-fast; --exit-status reports failure when the run finishes. It is not a substitute for PR required-check fail-fast watching.

Interpret the result

For a structured snapshot, separate from watch mode:

bash
gh pr checks NUMBER -R OWNER/REPO --required \
  --json name,bucket,state,link,workflow
  • --watch cannot be combined with --json. In plain output, exit code 8 means pending checks. With --json, a successful fetch can return zero even when checks failed; inspect bucket, not just the process exit code.
  • A cancelled check is not a pass. Watch mode can exit zero with cancelled checks, and --fail-fast does not treat cancellation as failure. Inspect the final states before claiming success. Keep skipped/neutral results distinct from passed tests.
  • "No checks reported" and "no required checks reported" are not evidence of passing CI. Inspect the PR head, workflow triggers, and the PR's actual base-branch rules to distinguish missing checks from no required checks. Do not silently drop --required after an error.
  • An auth, permission, API, or network error is not a CI result. Report it. Do not hide it in a retry loop or infer success from missing data.
  • Native watching covers reported checks, not every push, review, or merge. Use gh wait below for those events. For other states with no watcher, make one focused read per scheduled pass if a schedule is already authorized. Stop it when the goal is met or the PR is closed. Do not invent an endless polling loop.

Wait for PR changes, merges, or commits

./setup links gh wait from gh/extensions/ and removes this checkout's links to the retired push/review extensions. Use gh wait instead of writing a polling loop or repeatedly reading PR status. Run one watcher per target in an attached async shell, or wait on the same synchronous process. Reuse its shell ID and completion notification, as with CI watchers. It checks immediately, then every 30 seconds, and prints nothing while waiting.

Any PR change or default-branch commit
bash
gh wait NUMBER
gh wait https://github.com/OWNER/REPO/pull/NUMBER
gh wait

With a PR number, URL, or branch, gh wait takes a snapshot and exits on the next observed change: PR metadata updates, title/body edits, head/base changes, draft status, or review changes. Reviews are read across all pages, so changes to older reviews also count. It compares snapshots, not an event stream: changes reverted between polls can be missed. It does not watch CI checks or guarantee detection of every merge-queue transition.

With no argument, it uses the current branch's PR. On the repository's default branch (main, or its configured name), it instead waits for the remote branch head to differ from local HEAD at startup. An already different remote head counts, even if local HEAD is ahead or has diverged. It does not fetch, pull, or change the checkout. Update the checkout before starting another wait if you want to use the new head as the baseline. Detached HEAD requires an explicit PR.

Show full SKILL.md (615 more words)Show less
Completed merge
bash
gh wait --merge NUMBER
gh wait --merge https://github.com/OWNER/REPO/pull/NUMBER

--merge ignores other changes and succeeds only when the PR is merged, including an already merged PR. It fails if the PR is closed without merging. Without a PR argument, it always selects the current branch's PR, even on the default branch. Use this after enabling auto-merge when the task requires confirmation of the completed merge; auto-merge enabled is not merged.

Output and failures

gh wait prints one tab-separated EVENT<TAB>URL line on stdout. Events are changed, merged, closed, or commits; the URL identifies the PR or the new default-branch commit. With no --merge, already closed or merged PRs return their terminal event immediately. Read the changed PR before acting; changed does not mean approval or merge readiness.

It exits 0 on an event, 1 on operational failure, and 2 for invalid usage. API, auth, permission, and network errors stop it with diagnostics on stderr, including errors after waiting has started. Use a full URL or GH_REPO=OWNER/REPO for another repository; there is no -R option. gh wait --help shows usage without contacting GitHub. Options can appear before or after the PR; -- ends option parsing.

Act on changes, not a specific event type

Use gh wait NUMBER for both pushes and reviews. Check the current PR once before waiting and handle work already present. PR mode does not compare with a last-reviewed SHA or match an existing review; it only detects changes after its initial snapshot. Changes made before that snapshot do not wake it.

On changed, read the PR head and relevant discussion. Review a new head relative to the last reviewed SHA, or act on new feedback. An unrelated edit can wake the command; if there is nothing relevant to do, start a new wait. Do not assume every event is a push, a submitted review, or an approval. Stop on merged or closed; those are successful events, not API failures. This command does not replace required-check watching.

Read the failing job now

Use the failed check's link to identify its run and job. If needed, fetch the run's jobs once:

bash
gh run view RUN_ID -R OWNER/REPO --json headSha,event,attempt,status,jobs

For a completed run, read only the failed steps, narrowed to the known job:

bash
gh run view -R OWNER/REPO --job JOB_ID --log-failed

If the run is still active, gh run view --log-failed can refuse even when the failing job has finished. Fetch that completed job's log directly:

bash
gh api repos/OWNER/REPO/actions/jobs/JOB_ID/logs

Do not wait for the whole matrix merely to read an already failed job. If the log is not available, inspect job details or check annotations and state the limit. Keep large logs in session files and read the relevant section. Do not label an unavailable log a flake.

Name the exact failing step and error before changing code or rerunning. Compare the same workflow, event, and relevant code on the base branch or other heads. "Main is green" means little if that check never runs on main. A local pass or a green retry alone does not prove a flake. Retry only after identifying a transient cause and when the task permits it; do not rerun the whole suite to avoid diagnosing one failure.

Recheck only what changed

Record the PR head being checked. After a push, rerun, base update, or queue entry, do not reuse results from the old head or attempt. Use the run IDs and event for the new state; merge-queue runs can use a different SHA from the PR.

Passing checks, approval, auto-merge enabled, queue entry, and merged are different states. When the task is to merge, finish with a focused read:

bash
gh pr view NUMBER -R OWNER/REPO \
  --json headRefOid,state,mergedAt,mergeStateStatus,reviewDecision,autoMergeRequest

An enabled auto-merge request is not a completed merge. Use gh wait --merge when waiting for that merge, then confirm its final state. Report the actual blocker or confirmed merged state, not another unchanged status dump.

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

Files

Just SKILL.md in skills/gh-cli of caarlos0/dotfiles.

Open the folder on GitHubat commit 278c761

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 skillcaarlos0/dotfiles220—~2.5kAutomated safety check: PassMIT
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 yesterday
    DevelopmentAuto-check passed

More from caarlos0/dotfiles

All 20 skills in this repo
  • CLI Design

    caarlos0/dotfiles

    Design and review command-line interfaces for usability, automation, safety, accessibility, and long-term compatibility.

    220 GitHub stars~4.2k tokensUpdated yesterday
    Auto-check passed
  • Dependabot Merge

    caarlos0/dotfiles

    Review and merge open dependency pull requests from Dependabot, Renovate and similar bots across the goreleaser organization and the caarlos0 user.

    220 GitHub stars~5k tokensUpdated yesterday
    Auto-check passed
  • Tui Design

    caarlos0/dotfiles

    Design terminal user interfaces and interactive CLIs that stay usable, accessible, and scriptable.

    220 GitHub stars~3k tokensUpdated yesterday
    Auto-check passed
  • Dashboard

    caarlos0/dotfiles

    Design and review dashboards that are informative, honest, accessible, and visually polished, independent of any tool.

    220 GitHub stars~4.1k tokensUpdated yesterday
    Auto-check passed
  • Gh Doc Author

    caarlos0/dotfiles

    Author and revise clear GitHub internal documentation, including design docs, proposals, decision records, runbooks, status updates, and handoffs.

    220 GitHub stars~2.2k tokensUpdated yesterday
    Auto-check passed
  • Go Performance

    caarlos0/dotfiles

    Profile and optimize Go CPU, allocations, GC, concurrency, and I/O with benchmarks and pprof.

    220 GitHub stars~1.4k tokensUpdated yesterday
    Auto-check passed

Works with

Categories

Questions about Gh CLI

What does Gh CLI do?

Use GitHub CLI efficiently for pull requests, CI checks, workflow runs, logs, and merge status. Gh CLI is an agent skill from caarlos0/dotfiles. Use GitHub CLI efficiently for pull requests, CI checks, workflow runs, logs, and merge status.

When should I use Gh CLI?

Gh CLI fits situations like: diagnosing a failed check; monitoring a pull request.

How do I install Gh CLI in Claude Code?

Run `npx skills add caarlos0/dotfiles --skill gh-cli -a claude-code`. Or copy the skill folder (skills/gh-cli in caarlos0/dotfiles) 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 caarlos0/dotfiles --skill gh-cli -a codex`. Or copy the skill folder (skills/gh-cli in caarlos0/dotfiles) 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 caarlos0/dotfiles --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). Our summary lists: Python 3.

Does Gh CLI access the network?

SKILL.md names 1 domain. In commands or code: github.com; the agent is likely to contact it when it follows the instructions. 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 MIT 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 2.5k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

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?

caarlos0 (a GitHub user) maintains it in caarlos0/dotfiles, which has 220 GitHub stars. The repository holds 20 skills in this directory. The repository was last updated on October 7, 2026.

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