Community研究與資料分析github.com

steipete/github-cache-hygiene

GitHub 配額與快取清理工具:gh、ghx、xcache、gitcrawl、鏡像、限制管理。

github-cache-hygiene 是什麼?

這項技能「GitHub Cache Hygiene」主要用於最佳化 GitHub 的 API 呼叫,透過本地快取與 gitcrawl 的 gh shim 機制,優先從快取回應常見的讀取請求,避免不必要的即時 API 呼叫。它支援 `gh`、`ghx`、`xcache`、`gitcrawl` 等平台,特別適合在 Peter 的機器環境中使用(gh 預設為 gitcrawl 驅動的 shim)。此技能的核心運作方式為:開發者只需正常使用 gh 指令,系統會自動判斷哪些查詢可從本地或快取取得(如 issue 搜尋、PR 列表),並在必要時(如寫入、評論、合併或需要絕對最新狀態)才發起即時 API 呼叫。此外,它還提供 xcache 工具來檢視快取命中率與後端遺漏狀況,並建議在 CI 中避免密集輪詢,改用回退策略與精確的執行識別。總體而言,這項技能能顯著減少 GitHub API 配額的消耗,提升開發者的工作效率。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/steipete/agent-scripts/tree/main/skills/github-cache-hygiene

Installed? Explore more 研究與資料分析 skills: affaan-m/uspto-database, affaan-m/scholar-evaluation, affaan-m/literature-review · View all 6 →

在你喜歡的 AI 中提問

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

說明文件

GitHub 快取衛生

目標:先透過 gitcrawl 與 gh shim 回答常見的 GitHub 讀取問題,只有在需要最新資料或有寫入需求時才花費即時 GitHub API 呼叫。

預設路徑

正常使用 gh。在 Peter 的機器上,它預期是 gitcrawl 驅動的 shim,因此支援的讀取作業可在本地或快取中完成,無需變更指令。

優先使用這些本地/快取讀取:

gitcrawl sync owner/repo --numbers 123 --with pr-details
gh search issues "<terms>" -R owner/repo --state open --json number,title,state,url,updatedAt,labels,author
gh search prs "<terms>" -R owner/repo --state open --json number,title,state,url,updatedAt,isDraft,author
gh issue list -R owner/repo --state open --author user --assignee user --label bug --json number,title,url
gh pr list -R owner/repo --state open --author user --label dependencies --json number,title,url
gh issue view 123 -R owner/repo --json number,title,state,body,comments,labels,url
gh pr view 123 -R owner/repo --json number,title,state,body,comments,labels,files,commits,statusCheckRollup,url
gh pr checks 123 -R owner/repo --json name,state,detailsUrl,workflow
gh run list -R owner/repo --branch branch-name --json databaseId,workflowName,status,conclusion,url
gh pr diff 123 -R owner/repo --patch

使用精確的引用與窄化的欄位。避免在單一 gh issue view 上進行廣泛迴圈,當一個 gh search 或 gh issue list --json ... 就能回答初步問題時,請直接使用後者。

對於 CI,請避免密集的 gh run list / gh run view 輪詢迴圈。推送或工作流程觸發後,先識別出一個確切的執行,再以回退策略進行輪詢。只在偵測到失敗的作業或用戶明確要求日誌時,才拉取完整的日誌。已完成風格的 gh run view --log、--log-failed 以及常見的 Actions REST 日誌端點會由 gitcrawl 較長時間快取,而執行狀態則保持短效期。

新鮮度

本地答案適用於探索、重複搜尋、舊討論回顧、作者/標籤分類,以及「是否已經有相關的 issue/PR?」的檢查。

在以下情況使用即時呼叫:

  • 撰寫、評論、關閉、合併、重新執行或編輯時
  • 在維護者操作前檢查最終當前狀態
  • 推送後驗證 CI 狀態
  • 本地結果遺失或明顯過時
  • 用戶要求最新/即時狀態

進行 PR 審查時,如果你知道會反覆檢查檔案、提交、檢查或執行摘要,建議先使用 gitcrawl sync owner/repo --numbers <n> --with pr-details 一次灌入精確的 PR 細節。gh shim 可在遺漏時自動灌入一個精確的 PR(使用 GITHUB_TOKEN 或 gh auth token);明確的灌入能讓意圖與成本更清楚。

寫入後,只進行一次針對性的回讀,不要進行廣泛的重新掃描。

XCache

當懷疑速率限制時,檢視快取行為:

gh xcache stats
gh xcache keys
gh xcache gc

在 gh xcache stats --json 中檢視 backend_misses_by_command 與 backend_misses_by_route,然後再新增新的即時 GitHub 迴圈。這些對應表會顯示哪些指令形狀仍在逃脫快取。

只有當過時的快取回讀誤導了決策時,才使用 gh xcache flush。

若要進行僅限本地的驗證,可暫時讓後端無法使用,對單一指令:

GITCRAWL_GH_PATH=/tmp/no-real-gh gh search issues "<terms>" -R owner/repo --json number,title,url

代理程式禮儀

按儲存庫與狀態批次處理問題。重複使用已經在對話中列印過的資料。在 CI 輪詢時退讓;僅對失敗的執行或正在審查的精確執行檢查日誌。除非正在診斷 shim 本身,否則不要以 /opt/homebrew/opt/gh/bin/gh 繞過 shim。

Individual skills in this repo

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

steipete/agent-transcript

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

steipete/beeper

Beeper cache: contact hints, room lookup, WhatsApp/iMessage traces, FTS.

steipete/browser-use

Existing Chrome automation: Chrome plugin first, mcporter fallback.

steipete/clawsweeper-status

ClawSweeper status: URLs, workflow health, active workers, ops snapshot.

steipete/clickclack

ClickClack ops: chat app, Hetzner deploy, DNS/docs/app, Docker rollout.

steipete/cloudflare-registrar

Cloudflare Registrar: domain availability, prices, registration via mcporter.

steipete/codex-debugging

Codex debugging: codex-rs core/tui/exec/cli/app-server/config.

steipete/create-cli

CLI UX/spec: args, flags, help, output, errors, config, dry-run.

steipete/discord-clawd

Discord-backed OpenClaw agent/session relay; not archive search.

steipete/domain-dns-ops

DNS/domain ops: registrars, zones, redirects, DNS/HTTP verify, manager truth.

steipete/frontend-design

Frontend UI: pages, apps, components, polished non-generic design.

steipete/github-author-context

GitHub contributor context: identity, activity, trust, company/team signal.

steipete/github-deep-review

GitHub deep review: bugs, PRs, best fix, stale-or-real, read code first.

steipete/github-project-triage

GitHub issue/PR triage: queues, CI, blockers, risk, proof, next actions.

steipete/hopper-debugger

Hopper debugging: macOS/iOS binaries, ObjC/Swift symbols, dyld, LLDB.

steipete/instruments-profiling

Instruments/xctrace profiling: macOS/iOS traces, binaries, args, exports.

steipete/mac-maintenance

Mac upkeep: brew update/upgrade, pull clean repos, empty Trash.

steipete/maintainer-orchestrator

Open-source maintainer orchestration: Codex app workers, work recovery, dependencies, vision, releases.

steipete/markdown-converter

Markdown conversion: PDF, Office, HTML, data, OCR, audio, ZIP, YouTube.

steipete/nano-banana-pro

Nano Banana/Gemini image gen/edit: text/image input, 512-4K workflows.

相關技能