github-kb

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

GitHub KB — 本地知識庫與 GitHub 助手

GitHub KB — Local Knowledge Base & GitHub Assistant

本地倉庫根目錄

Local Repository Root Directory

所有本地 clone 都存放於:
~/workspaces/github/
知識庫索引維護於:
@~/workspaces/github/AGENTS.md
每次觸發時先讀取此檔案,確認哪些 repo 已在本地。若檔案不存在或目錄不存在,請參閱下方「目錄不存在」段落。

All local clones are stored in:
~/workspaces/github/
The knowledge base index is maintained at:
@~/workspaces/github/AGENTS.md
Read this file first each time the skill is triggered to confirm which repos are local. If the file or directory does not exist, refer to the "Directory Does Not Exist" section below.

工作流程:回答 GitHub / Repo 相關問題

Workflow: Answer GitHub / Repo Related Questions

第一步 — 優先查詢本地

Step 1 — Prioritize Local Queries

在連線 GitHub 之前,先確認使用者提到的 repo 是否已 clone 在本地:
bash
ls ~/workspaces/github/
若本地已有,優先直接讀取檔案——速度更快、可離線使用、不消耗 API 配額。
Before connecting to GitHub, confirm whether the repo mentioned by the user has been cloned locally:
bash
ls ~/workspaces/github/
If it exists locally, prioritize reading files directly—it's faster, usable offline, and doesn't consume API quotas.

第二步 — 若本地沒有,使用 gh CLI 查詢 GitHub

Step 2 — If Not Local, Use gh CLI to Query GitHub

bash
undefined
bash
undefined

搜尋 repository

Search repository

gh search repos <關鍵字> --limit 10
gh search repos <keyword> --limit 10

查看 repo 詳情

View repo details

gh repo view <owner>/<repo>
gh repo view <owner>/<repo>

列出 issues

List issues

gh issue list --repo <owner>/<repo> --state open --limit 20
gh issue list --repo <owner>/<repo> --state open --limit 20

搜尋 issues

Search issues

gh search issues <關鍵字> --repo <owner>/<repo>
gh search issues <keyword> --repo <owner>/<repo>

列出 PRs

List PRs

gh pr list --repo <owner>/<repo> --state open --limit 20
gh pr list --repo <owner>/<repo> --state open --limit 20

查看特定 PR

View specific PR

gh pr view <編號> --repo <owner>/<repo>
gh pr view <number> --repo <owner>/<repo>

搜尋程式碼

Search code

gh search code <關鍵字> --repo <owner>/<repo>

優先使用 `gh` 而非直接呼叫 `curl`——`gh` 會自動處理身份驗證。

---
gh search code <keyword> --repo <owner>/<repo>

Prioritize using `gh` instead of directly calling `curl`—`gh` handles authentication automatically.

---

工作流程:Clone 新的 Repository

Workflow: Clone New Repository

當使用者說要下載或 clone 某個 repo:
  1. 確認 repo 名稱 — 若 owner/repo 不明確,先向使用者確認。
  2. Clone 到本地根目錄:
    bash
    git clone https://github.com/<owner>/<repo>.git ~/workspaces/github/<repo>
  3. 產生一句話摘要 — 讀取 repo 的 README 或頂層檔案,寫出一句話描述(≤ 120 字元)。
  4. 更新知識庫索引 — 將 repo 條目新增至
    ~/workspaces/github/AGENTS.md
    - **<repo>** (`<owner>/<repo>`): <一句話摘要>
    條目依字母順序排列。

When the user says to download or clone a repo:
  1. Confirm Repo Name — If the owner/repo is unclear, confirm with the user first.
  2. Clone to Local Root Directory:
    bash
    git clone https://github.com/<owner>/<repo>.git ~/workspaces/github/<repo>
  3. Generate One-Sentence Summary — Read the repo's README or top-level files and write a one-sentence description (≤ 120 characters).
  4. Update Knowledge Base Index — Add the repo entry to
    ~/workspaces/github/AGENTS.md
    :
    - **<repo>** (`<owner>/<repo>`): <one-sentence summary>
    Entries are sorted alphabetically.

知識庫索引格式

Knowledge Base Index Format

~/workspaces/github/AGENTS.md
使用以下結構:
markdown
undefined
~/workspaces/github/AGENTS.md
uses the following structure:
markdown
undefined

GitHub 本地知識庫

GitHub Local Knowledge Base

此目錄存放本地 clone 的 GitHub repositories。
This directory stores locally cloned GitHub repositories.

Repositories

Repositories

  • repo-name (
    owner/repo-name
    ): 這個 repo 的一句話說明。
  • another-repo (
    owner/another-repo
    ): 另一個 repo 的一句話說明。

更新索引時:
- 每個 repo 一條記錄,依字母順序排列於 `## Repositories` 下
- 格式:`- **<名稱>** (\`<owner>/<名稱>\`): <摘要>`
- 摘要使用與使用者相同的語言撰寫

---
  • repo-name (
    owner/repo-name
    ): One-sentence description of this repo.
  • another-repo (
    owner/another-repo
    ): One-sentence description of another repo.

When updating the index:
- One entry per repo, sorted alphabetically under `## Repositories`
- Format: `- **<name>** (`<owner>/<name>`): <summary>`
- Write the summary in the same language as the user.

---

目錄不存在

Directory Does Not Exist

若執行時
~/workspaces/github/
不存在:
  1. 告知使用者:「找不到本地 GitHub 目錄
    ~/workspaces/github
    。」
  2. 詢問是否要建立:
    mkdir -p ~/workspaces/github
  3. 使用者同意後,建立目錄並建立空白的
    AGENTS.md
    索引。
  4. 繼續執行使用者原本的請求。

If
~/workspaces/github/
does not exist during execution:
  1. Inform the user: "Local GitHub directory
    ~/workspaces/github
    not found."
  2. Ask if the user wants to create it:
    mkdir -p ~/workspaces/github
  3. After the user agrees, create the directory and a blank
    AGENTS.md
    index.
  4. Continue executing the user's original request.

注意事項

Notes

  • 使用者以簡稱提到 repo 時(例如「claude-code 那個 repo」),先嘗試比對本地
    AGENTS.md
    的記錄,再詢問確認。
  • 查詢使用者自己的 issue 或 PR 時,若未指定 owner,預設使用
    ricky1698
  • gh auth status
    失敗,提醒使用者執行
    gh auth login
  • Clone 時預設使用 HTTPS,除非使用者明確要求 SSH。
  • When the user mentions a repo by nickname (e.g., "the claude-code repo"), first try matching records in the local
    AGENTS.md
    before asking for confirmation.
  • When querying the user's own issues or PRs, if no owner is specified, use
    ricky1698
    by default.
  • If
    gh auth status
    fails, remind the user to run
    gh auth login
    .
  • Use HTTPS by default when cloning, unless the user explicitly requests SSH.