Cli Gh

作者 paulrberg7f1d9025caf7無授權條款97 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫今天更新

Use for GitHub CLI automation: repository reads, workflow runs, search, codespaces, releases, configuration, or gh command syntax. Use yeet for contribution writes to PRs, issues, comments, or discussions.

AI 產生的概覽

指導 GitHub CLI(gh)的使用,涵蓋儲存庫讀取、工作流程執行、搜尋、發行、Codespaces 以及 CI 失敗排查。

功能
提供使用 GitHub CLI 的路由與權限規則,包括何時將拉取請求、議題、留言和討論的撰寫交給另一個技能,以及何時將儲存庫重新命名交給另一個技能。它涵蓋唯讀檢查、一般的可逆寫入,並嚴格禁止破壞性操作,唯一例外是刪除標籤且需明確核准。它也記錄了一套 CI 失敗排查流程:列出失敗的執行、擷取失敗步驟的行、檢查工具鏈版本漂移,並在修復後監看新的執行。
適用情境
適用於 GitHub CLI 自動化工作,例如儲存庫讀取、工作流程執行檢查、搜尋、Codespaces、發行、設定,或解析 gh 指令語法。也適用於被詢問 CI 為何失敗或需要修復失敗執行的情況。
執行需求
需要安裝並已驗證的 GitHub CLI(gh);涉及 gh 2.98+ 的旗標。使用 gh run list、gh run view、gh run watch 等 shell 指令,以及 ripgrep(rg)過濾日誌。不附帶指令碼,僅為說明文件。

GitHub CLI

This skill is coordination-exempt: skip the ai-coord gate for its declared work.

Routing

Use yeet to author or update a pull request, issue, issue comment, or discussion. yeet owns semantic analysis, repository templates, Paul's writing voice, idempotency, and direct posting. Route repository renames through repo-rename so GitHub and local continuity change together.

Authority

  • Read and inspect without confirmation.
  • Execute reversible or ordinary GitHub writes only when the user explicitly requested that outcome.
  • Never delete repositories, releases/assets, workflow runs/caches, secrets/variables, keys, codespaces, extensions, or gists.
  • Label deletion is the sole destructive exception: show the target repo, exact labels, commands, and issue/PR impact, then require approval in a subsequent message before gh label delete ... --yes.

Workflow

  1. Resolve the repository explicitly when cwd is ambiguous. Let the first required read-only command validate authentication. Run gh auth status only for auth diagnosis.

  2. Use installed gh <command> <subcommand> --help to resolve flags, JSON fields, and command behavior. CLI JSON field names can differ from API fields. Prefer --json with --jq for structured output.

  3. Preview broad writes with the repository, exact targets, commands, and issue/PR impact. An already requested ordinary write does not require a second approval.

CI Failure Triage

Use this workflow when the user asks why CI fails or asks to fix a failing run. Keep each command output bounded.

  1. Find the failing runs for the branch or the commit:

    sh
    gh run list --branch <branch> --status failure --limit 5gh run list --commit <sha> --status failure --limit 5
  2. Extract only the failed-step lines. Never print the raw log.

    sh
    gh run view <run-id> --log-failed | rg --no-config -n 'error|FAIL|panic|✗' | head -80
  3. Check toolchain drift before you change code. Compare the versions pinned in .github/workflows/*.yml with the local --version output. Common cases are Foundry (forge), Bun (bun), Node.js (node), and Rust (rustc).

  4. If the user requested a fix, fix the cause and push the commit.

  5. Get the new run ID with gh run list --commit <new-sha> --limit 5. Then watch that run:

    sh
    gh run watch <run-id> --exit-status --compact
  6. Report the run URL from gh run view <run-id> --json url --jq .url and the final run status.

Notable Flags (gh 2.98+)

  • gh pr checkout --worktree <path> and gh issue develop --checkout --worktree <path> check out into a linked git worktree instead of switching the current branch.
  • gh search issues --search-type semantic|hybrid ranks by relevance: issues only, one page, no --sort/--order, not on GitHub Enterprise Server.
  • gh config set api_host <gateway> --host <host> routes that host's API traffic through a gateway. The feature is experimental and is not a security boundary.
  • gh auth login and gh auth refresh copy OAuth device codes to the clipboard by default (2.101+). To opt out, run gh config set clipboard disabled.
  • --attach '<file>#<alt>' on issue/PR create, edit, and comment uploads images or videos. Route those writes through yeet.

Completion

Complete when command output verifies the requested GitHub data or state. After a write, fetch the resulting resource. On a partial or ambiguous failure, check whether it changed before retrying. Report the verified state and URL or stable identifier. Include the concrete error and next action when incomplete, and distinguish an unknown result from a confirmed failure.

來源與署名

來源:paulrberg/agent-skills位於skills/cli-gh提交7f1d902

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架