github-ops

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

GitHub Ops Skill

GitHub 操作技能

Provides structured guidance for repository reconnaissance using
gh api
and
gh search
.
提供使用
gh api
gh search
进行仓库侦察的结构化指导。

Overview

概述

Repository reconnaissance often fails when agents guess file paths or attempt to fetch large files blindly. This skill enforces a structured
Map -> Identify -> Fetch
sequence using the GitHub CLI to minimize token waste and improve reliability.
当Agent盲目猜测文件路径或尝试拉取大文件时,仓库侦察往往会失败。本技能通过GitHub CLI强制执行
映射 -> 识别 -> 拉取
的结构化流程,以减少Token浪费并提升可靠性。

⚡ Essential Reconnaissance Commands

⚡ 核心侦察命令

Use these commands to understand a repository structure before fetching content.
在拉取内容之前,使用这些命令了解仓库结构。

1. List Repository Root

1. 列出仓库根目录

bash
gh api repos/{owner}/{repo}/contents --jq '.[].name'
bash
gh api repos/{owner}/{repo}/contents --jq '.[].name'

2. List Specific Directory

2. 列出指定目录

bash
gh api repos/{owner}/{repo}/contents/{path} --jq '.[].name'
bash
gh api repos/{owner}/{repo}/contents/{path} --jq '.[].name'

3. Fetch File Content (Base64 Decoded)

3. 拉取文件内容(Base64解码)

bash
gh api repos/{owner}/{repo}/contents/{path} --jq '.content' | base64 -d
bash
gh api repos/{owner}/{repo}/contents/{path} --jq '.content' | base64 -d

4. Search for Pattern in Repository

4. 在仓库中搜索模式

bash
gh search code "{pattern}" --repo {owner}/{repo}
bash
gh search code "{pattern}" --repo {owner}/{repo}

5. Get Repository Metadata

5. 获取仓库元数据

bash
gh repo view {owner}/{repo} --json description,stargazerCount,updatedAt
bash
gh repo view {owner}/{repo} --json description,stargazerCount,updatedAt

🔄 Token-Efficient Workflow

🔄 高效使用Token的工作流

  1. Map Tree: List the root and core directories (
    commands
    ,
    src
    ,
    docs
    ).
  2. Identify Entrypoints: Look for
    README.md
    ,
    gemini-extension.json
    ,
    package.json
    , or
    SKILL.md
    .
  3. Targeted Fetch: Download only the entrypoints first.
  4. Deep Dive: Use
    gh search code
    to find logic patterns rather than reading every file.
  1. 映射目录树:列出根目录和核心目录(
    commands
    src
    docs
    )。
  2. 识别入口点:查找
    README.md
    gemini-extension.json
    package.json
    SKILL.md
  3. 定向拉取:先仅下载入口点文件。
  4. 深度探索:使用
    gh search code
    查找逻辑模式,而非读取每个文件。

🛡️ Platform Safety (Windows)

🛡️ 平台安全(Windows)

  • When using
    base64 -d
    , ensure the output is redirected to a file using the
    Write
    tool if it's large.
  • Avoid Linux-style
    /dev/stdin
    patterns in complex pipes.
  • Use native paths for any local storage.
  • 使用
    base64 -d
    时,如果输出内容较大,请确保使用Write工具将其重定向到文件。
  • 在复杂管道中避免使用Linux风格的
    /dev/stdin
    模式。
  • 任何本地存储都使用原生路径。

Assigned Agents

分配的Agent

  • artifact-integrator: Lead agent for repository onboarding.
  • developer: PR management and exploration.
  • artifact-integrator:仓库接入的主导Agent。
  • developer:PR管理与探索。

Memory Protocol (MANDATORY)

内存协议(强制要求)

Before starting: Read
.claude/context/memory/learnings.md
After completing:
  • New pattern ->
    .claude/context/memory/learnings.md
  • Issue found ->
    .claude/context/memory/issues.md
  • Decision made ->
    .claude/context/memory/decisions.md
ASSUME INTERRUPTION: If it's not in memory, it didn't happen.
开始前: 读取
.claude/context/memory/learnings.md
完成后:
  • 新发现的模式 ->
    .claude/context/memory/learnings.md
  • 发现的问题 ->
    .claude/context/memory/issues.md
  • 做出的决策 ->
    .claude/context/memory/decisions.md
假设会被中断:如果未记录到内存中,就视为未发生。