Community程式設計與開發github.com

GitHub

使用 GitHub CLI 管理 issues、PR、CI/檢查日誌、評論、審查、發行版、倉庫及 `gh api` 查詢。

GitHub 是什麼?

這項技能讓 AI 代理能夠透過 GitHub CLI (`gh`) 直接與 GitHub 互動,處理 issues、Pull Requests (PR)、CI/CD 工作流程及 API 查詢。它包含 PR 的非同步合併功能,透過 GitHub 的非同步合併 API 並配合 Octopool 安全防護,確保合併流程符合規章。技能也明確定義了「合併完成」的標準:代理必須確認 PR 的 GitHub 狀態為 `MERGED` 才算完成,而非僅看審查結束或 CI 通過。此外,還提供了處理 issues、CI 運行紀錄及結構化 API 查詢的指令,並強調使用 `--json` 和 `--jq` 來解析輸出,以及使用 `--body-file` 來安全地處理包含特殊字元的內容。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/clawdbot/clawdbot/tree/main/skills/github

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

GitHub 是做什麼的?

使用 gh 處理 GitHub。使用 git 處理本地提交、分支、推送與拉取。使用程式碼閱讀工具進行深度審查。

驗證

gh auth status
gh auth login

Gateway 的 HOME 目錄可能與操作者的 HOME 目錄不同。如果 gh 的驗證資訊存在於其他地方,請在 gateway 服務環境中設定 GH_CONFIG_DIR 並重新啟動。

Pull Requests (PR)

gh pr list --repo owner/repo --json number,title,state,author,url
gh pr view 55 --repo owner/repo --json title,body,author,files,commits,reviews,reviewDecision
gh pr checks 55 --repo owner/repo
gh pr diff 55 --repo owner/repo
gh pr create --repo owner/repo --title "feat: title" --body-file /tmp/pr.md

在建立或更新 PR 說明時,僅在 Runtime 行提供了 sessionUrl=<exact-url> 時,才附加這個最終頁尾。將 <sessionUrl> 替換為該網址的精確內容;請勿自行建構或修改。當 sessionUrl 不存在時,請省略頁尾。請在剛好一個頁尾之前保留任何發布標記,並確保頁尾維持在最後:

---
[View the OpenClaw team session](https://raw.githubusercontent.com/clawdbot/clawdbot/main/<sessionUrl>)

URL 可以直接使用:gh pr view https://github.com/owner/repo/pull/55。

非同步合併

當儲存庫提供了原生的合併工作流程時,請使用它。對於其他地方需要授權的程式化合併,請透過 gh api 使用 GitHub 的非同步合併 API;gh pr merge 不會選用此 API。請提供已審查的 HEAD SHA,保留必要的審查與檢查,並先檢查堆疊歸屬:提交一個堆疊中的 PR 也會合併或排入其下方開啟的 PR,而這些 PR 需要它們自己的審查與授權。

gh api -H 'X-Octopool-Require: merge-async-v1' \
  --method PUT repos/owner/repo/pulls/55/merge-async \
  -H 'X-GitHub-Api-Version: 2026-03-10' \
  -f sha=REVIEWED_HEAD_SHA -f merge_method=squash -f merge_action=direct_merge
gh api -H 'X-Octopool-Require: merge-async-v1' \
  repos/owner/repo/pulls/55/merge-async/REQUEST_UUID \
  -H 'X-GitHub-Api-Version: 2026-03-10' -H 'Cache-Control: max-age=0'

請在 api 之後立即保留 Octopool 防護標頭。受保護的舊版包裝器會拒絕該標頭,以防止它們在重新寫入合併權限之前被處理;如果被拒絕,請使用包含非同步防護的 Octopool 構建版本。受支援的包裝器會保留 SHA、方法、動作與繞過設定,並且只會重寫提交文字。原生的 gh 可以傳遞此標頭。請勿為了繞過拒絕而移除它、停用政策或選擇原始二進位檔。

在輪詢之前,請從 202 回應中保留 details.uuid。pending 表示等待;merged 包含 details.sha,但仍需最終的 PR/HEAD 驗證。enqueued 表示已排入佇列,而非已合併:請監控 PR 本身。為了遵循已設定的佇列,請使用 merge_action=default(或明確使用 merge_queue 排入佇列),並省略僅限直接合併的 method、title 與 message 欄位。未經授權,切勿啟用 bypass_rules。

若狀態為 failed,請回報 details.message。409 狀態表示已存在請求;請檢查其 UUID 與選項,不要重新提交。遺失的回應、輪詢錯誤以及 24 小時後的結果過期均需進行協調,絕不能盲目重試或使用同步回退。請使用有限的等待時間進行輪詢,並讀取最新資料。非同步處理不會為未滿足的檢查啟用自動合併;當該行為獲得授權時,請使用原生工作流程或 gh pr merge --auto。

合併所有權

當使用者要求 landing 或合併一個 PR 時,最終結果必須是經驗證的 GitHub 狀態,而非審查、工作人員輪次或 CI 觀察的結束。

  • 保持工作活躍,直到 gh pr view ... --json state,mergedAt,mergeCommit 證明 state 為 MERGED。
  • 將審查結果、合併衝突、失敗的檢查與要求的變更視為範圍內的持續工作。修補它們,重新執行必要的閘道檢查,並重新評估確切的更新後 HEAD。
  • 待處理的檢查是等待狀態,而非完成。請使用儲存庫支援的等待或合併工作流程;不要根據部分通過的綠色檢查就宣稱成功。
  • 如果工作已委派給持久化 session,並且該 session 在合併前停止,請繼續同一個 session,而不是將其報告視為最終結果。
  • 只有在繼續需要新的授權、無效的憑證或無法安全推斷的產品決策時,才將狀態視為受阻而停止。請回報確切的阻礙因素,並將 PR 保留為未合併狀態。

Issues

gh issue list --repo owner/repo --state open --json number,title,labels,url
gh issue view 42 --repo owner/repo --json title,body,comments,labels,state
gh issue create --repo owner/repo --title "Bug: ..." --body-file /tmp/issue.md
gh issue comment 42 --repo owner/repo --body-file /tmp/comment.md
gh issue close 42 --repo owner/repo --comment "Fixed in ..."

CI / 執行

gh run list --repo owner/repo --limit 10
gh run view <run-id> --repo owner/repo --json status,conclusion,headSha,url
gh run view <run-id> --repo owner/repo --log-failed
gh run rerun <run-id> --repo owner/repo --failed

API

gh api repos/owner/repo/pulls/55 --jq '.title, .state, .user.login'
gh api repos/owner/repo/labels --jq '.[].name'
gh api --cache 1h repos/owner/repo --jq '{stars: .stargazers_count, forks: .forks_count}'

請使用 --json 搭配 --jq 來取得結構化輸出。請使用 --body-file 來處理包含反引號、shell 程式碼片段、環境變數名稱或用戶文字的評論或說明。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

1password

Set up and use 1Password CLI for sign-in, desktop integration, and reading or injecting secrets.

acp-router

Route plain-language requests for Claude Code, Cursor, Copilot, OpenClaw ACP, OpenCode, Gemini CLI, Qwen, Kiro, Kimi, iFlow, Factory Droid, Kilocode, or explicit ACP harness work into either OpenClaw ACP runtime sessions or direct acpx-driven sessions ("telephone game" flow). For coding-agent thread requests, read this skill first, then use only `sessions_spawn` for thread creation. Codex chat binding defaults to the native Codex app-server plugin unless ACP is explicit or background spawn needs ACP.

add-model-provider

Add and live-prove a model provider with non-interactive config one-liners, without exposing credentials.

agent-transcript

Requested GitHub PR/issue agent transcripts: redact, trim, preview, and insert safely.

apple-notes

Create, view, edit, delete, search, move, or export Apple Notes via the memo CLI on macOS.

apple-reminders

List, add, edit, complete, or delete Apple Reminders and reminder lists via remindctl.

auto-qa

Run OpenClaw-wide autonomous QA and live/stress campaigns across independent subsystem lanes, with verified fixes and a resumable evidence report.

autoreview

Structured code review through the shared OpenClaw agent-skills installation.

bear-notes

Create, search, and manage Bear notes via grizzly CLI.

blacksmith-testbox

Run Blacksmith Testbox for CI-parity checks, secrets, hosted services, migrations, or builds local cannot reproduce.

block-kit

Use proactively for structured or interactive Slack replies, and when asked to author or validate native Slack Block Kit JSON.

blogwatcher

Monitor blogs and RSS/Atom feeds for updates using the blogwatcher CLI.

blucli

BluOS CLI (blu) for discovery, playback, grouping, and volume.

bluebubbles

Send and manage iMessages via BlueBubbles, including attachments, tapbacks, edits, replies, and groups.

browser-automation

Use when controlling web pages with the OpenClaw browser tool, especially multi-step flows, login checks, tab management, or recovery from stale refs/timeouts.

camsnap

Capture frames or clips from RTSP/ONVIF cameras and local webcams, including USB pan/tilt/zoom control.

canvas

Present HTML on connected OpenClaw node canvases, navigate/eval/snapshot, and debug canvas host URLs.

channel-message-flows

Use when running QA Lab channel message flow evidence.

clawdtributor

Clawtributor PRs here, last week or another window: discover conversation refs, recheck GitHub, rank by impact.

clawhub

Search ClawHub for plugins by default, or skills when explicitly requested; install, verify, update, uninstall, publish, or sync skills.

相關技能