github-browser
Use this skill when you need to browse, explore, or read content from GitHub repositories. Triggers: reading repo files, viewing issues/PRs, searching code on GitHub, exploring repo structure, reading PR diffs/reviews, or when given a GitHub URL to investigate. This skill teaches you the optimal gh CLI commands for each scenario.
GitHub Browser Skill
Browse and read GitHub content efficiently using gh CLI. Read-only operations only.
Prerequisites
Before running any command, verify authentication:
gh auth status
If not authenticated, tell the user to run gh auth login.
URL Parsing
When given a GitHub URL, parse it to determine the action:
| URL Pattern | Type | Action |
|---|---|---|
github.com/{owner}/{repo} | Repo root | View repo overview |
github.com/{owner}/{repo}/tree/{branch}/{path} | Directory | List directory contents |
github.com/{owner}/{repo}/blob/{branch}/{path} | File | Read file content |
github.com/{owner}/{repo}/issues/{n} | Issue | View issue details |
github.com/{owner}/{repo}/pull/{n} | PR | View PR details |
github.com/{owner}/{repo}/pull/{n}/files | PR diff | View changed files |
Decision Tree
"I want to understand a repo"
- Quick overview →
gh repo view {owner}/{repo} - File tree → See repo-exploration.md
- Read a specific file → See repo-exploration.md
"I want to read an issue or PR"
- List issues →
gh issue list -R {owner}/{repo} - Read issue →
gh issue view {n} -R {owner}/{repo} --comments - List PRs →
gh pr list -R {owner}/{repo} - Read PR →
gh pr view {n} -R {owner}/{repo} --comments - PR diff / review comments → See issues-and-prs.md
"I want to search"
- Search code →
gh search code "query" -R {owner}/{repo} - Search issues →
gh search issues "query" -R {owner}/{repo} - Search repos →
gh search repos "query" - Advanced search → See search.md
"I want to research a topic / find repos in an ecosystem"
STOP — don't just keyword search. First think about search strategy:
- Parse intent — what does "related to X" mean? Uses X in code? Part of X org? Mentions X in description?
- Use multiple channels (at least 2-3):
- Repo search (name/description):
gh search repos "X" --sort stars - Code search (actual usage):
gh search code "import X" --language python - Dependency search:
gh search code "X" --filename requirements.txt - Topic search:
gh search repos --topic X --sort stars - Org browsing:
gh api orgs/{X-org}/repos?sort=stars&per_page=30
- Repo search (name/description):
- Cross-reference — repos appearing in multiple channels are more relevant
- Iterate — discover new orgs/topics from results, search again
→ See search-strategy.md for full playbook
Core Command Quick Reference
Repo
# Repo overview (README + metadata)
gh repo view {owner}/{repo}
# File tree (recursive)
gh api repos/{owner}/{repo}/git/trees/{branch}?recursive=1 --jq '.tree[] | .path'
# Read a file (≤1MB)
gh api repos/{owner}/{repo}/contents/{path} --jq '.content' | base64 -d
# Read a file from a specific branch
gh api repos/{owner}/{repo}/contents/{path}?ref={branch} --jq '.content' | base64 -d
# List directory
gh api repos/{owner}/{repo}/contents/{path} --jq '.[].name'
Issues & PRs
# List open issues
gh issue list -R {owner}/{repo}
# View issue with comments
gh issue view {n} -R {owner}/{repo} --comments
# List open PRs
gh pr list -R {owner}/{repo}
# View PR with comments
gh pr view {n} -R {owner}/{repo} --comments
# PR changed files summary
gh pr diff {n} -R {owner}/{repo} --stat
# PR full diff
gh pr diff {n} -R {owner}/{repo}
# CI/checks status
gh pr checks {n} -R {owner}/{repo}
Search
# Search code in a repo
gh search code "query" -R {owner}/{repo}
# Search code by language
gh search code "query" -R {owner}/{repo} --language go
# Search issues/PRs
gh search issues "query" -R {owner}/{repo}
# Search repos
gh search repos "query" --language python
Detailed References
For complex scenarios, refer to:
- Repo exploration — file trees, large files, metadata, branches, releases
- Issues and PRs — filters, PR diffs, review comments, timeline
- Search — advanced filters, JSON output, rate limits
- Search strategy — multi-channel search thinking framework for topic/ecosystem research