github-ops
Workflow for repository reconnaissance and operations using GitHub CLI (gh). Optimizes token usage by using structured API queries instead of blind file fetching.
Best use case
github-ops is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Workflow for repository reconnaissance and operations using GitHub CLI (gh). Optimizes token usage by using structured API queries instead of blind file fetching.
Teams using github-ops should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/github-ops/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How github-ops Compares
| Feature / Agent | github-ops | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Workflow for repository reconnaissance and operations using GitHub CLI (gh). Optimizes token usage by using structured API queries instead of blind file fetching.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# GitHub Ops Skill
Provides structured guidance for repository reconnaissance using `gh api` and `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.
## ⚡ Essential Reconnaissance Commands
Use these commands to understand a repository structure before fetching content.
### 1. List Repository Root
```bash
gh api repos/{owner}/{repo}/contents --jq '.[].name'
```
### 2. List Specific Directory
```bash
gh api repos/{owner}/{repo}/contents/{path} --jq '.[].name'
```
### 3. Fetch File Content (Base64 Decoded)
```bash
gh api repos/{owner}/{repo}/contents/{path} --jq '.content' | base64 -d
```
### 4. Search for Pattern in Repository
```bash
gh search code "{pattern}" --repo {owner}/{repo}
```
### 5. Get Repository Metadata
```bash
gh repo view {owner}/{repo} --json description,stargazerCount,updatedAt
```
## 🔄 Token-Efficient Workflow
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.
## 🛡️ Platform Safety (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.
## Iron Laws
1. **ALWAYS** follow the Map → Identify → Fetch sequence before reading any file — blindly fetching files by guessed path wastes tokens, triggers 404s, and produces hallucinated repo structure.
2. **NEVER** fetch a file without first listing its parent directory or confirming it exists via `gh api` — large files fetched unnecessarily can exhaust the context window.
3. **ALWAYS** use `--jq` to filter `gh api` JSON output to only the fields needed — unfiltered API responses contain hundreds of irrelevant fields that inflate token usage.
4. **NEVER** use `gh search code` without a scoping qualifier (repo, org, or path) — unscoped code search returns results from all of GitHub, producing irrelevant noise.
5. **ALWAYS** prefer `gh api` structured queries over reading repository files directly when repository metadata is needed — API queries are faster, structured, and don't require authentication context for public repos.
## Anti-Patterns
| Anti-Pattern | Why It Fails | Correct Approach |
| ---------------------------------------------- | --------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| Guessing file paths and fetching them directly | High 404 rate; wasted tokens on non-existent paths | Map root tree first: `gh api repos/{owner}/{repo}/git/trees/HEAD --jq '.tree[].path'` |
| Fetching entire files for a single field | Large files exhaust context; slow and imprecise | Use `--jq` to extract only the required field from API response |
| Unscoped `gh search code` queries | Returns GitHub-wide results; noise overwhelms signal | Always add `--repo owner/name` or `--owner org` scope qualifier |
| Reading binary or generated files | Binary content is unreadable; generated files change frequently | Identify file type first; skip binaries; read source files only |
| Sequential API calls for each file | Unnecessary round-trips inflate latency | Batch: use `gh api` trees or search to identify multiple targets, then fetch in parallel |
## Assigned Agents
- **artifact-integrator**: Lead agent for repository onboarding.
- **developer**: PR management and exploration.
## 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.Related Skills
python-github-actions
Complete Python GitHub Actions system. PROACTIVELY activate for: (1) uv-based CI workflows (10-100x faster), (2) Matrix testing across Python versions, (3) Dependency caching with setup-uv, (4) Parallel test execution, (5) Reusable workflows, (6) Publishing to PyPI with trusted publishing, (7) Code coverage with codecov, (8) Security scanning. Provides: Workflow templates, caching config, matrix strategies, composite actions. Ensures fast, reliable CI/CD pipelines.
phoenix-github
Manage GitHub issues, labels, and project boards for the Arize-ai/phoenix repository. Use when filing roadmap issues, triaging bugs, applying labels, managing the Phoenix roadmap project board, or querying issue/project state via the GitHub CLI.
github
Access GitHub repositories via the GitHub REST API. Use this skill when the user wants to interact with GitHub including reading files, creating/updating files, listing repos, managing branches, viewing commits, working with issues, or managing pull requests. All scripts use PEP 723 inline metadata for dependencies and run via `uv run`. Requires GITHUB_TOKEN environment variable (a Personal Access Token with appropriate scopes).
github-workflow-automation
Advanced GitHub Actions workflow automation with AI swarm coordination, intelligent CI/CD pipelines, and comprehensive repository management
github-search
Search GitHub for repos, code, and usage examples using gh CLI. Capabilities: repo discovery, code search, finding library usage patterns, issue/PR search. Actions: search, find, discover repos/code/examples. Keywords: gh, github, search repos, search code, find examples, how to use library, stars, language filter. Use when: finding repositories, searching code patterns, discovering how libraries are used, exploring open source.
github-release-management
Comprehensive GitHub release orchestration with AI swarm coordination for automated versioning, testing, deployment, and rollback management
github-multi-repo
Multi-repository coordination, synchronization, and architecture management with AI swarm orchestration
github-issues
Create, manage, triage, and close GitHub issues. Search existing issues, add labels, assign people, and link to PRs. Works with gh CLI or falls back to git + GitHub REST API via curl.
github-issue
Work on a GitHub issue end-to-end: checkout main, create branch, research best practices, plan implementation, write tests first (TDD), implement, run code review, QA validation, then create PR. Use when given a GitHub issue URL or number to implement.
github-issue-creator
Convert raw notes, error logs, voice dictation, or screenshots into crisp GitHub-flavored markdown issue reports. Use when the user pastes bug info, error messages, or informal descriptions and wan...
github-expert
Complete GitHub expertise covering GitHub Actions, CI/CD workflows, automation, repository management, and best practices. Use when setting up GitHub Actions, creating workflows, managing pull requests, configuring automation (Dependabot, CodeQL), or implementing GitHub best practices. Includes workflow generators, templates, and production-ready configurations.
github-copilot-cli-expert
Expert knowledge of GitHub Copilot CLI - installation, configuration, usage, custom agents, MCP servers, and version management. Use when asking about copilot cli, copilot commands, installing copilot, updating copilot, copilot features.