name: gh-fetch description: Fetch content from GitHub repos using gh CLI
GitHub Fetch Skill
Use this skill when the user wants to:
- Get files from a GitHub repo
- List files in a repo
- Explore repo structure
- Fetch command definitions from repos
- Save files from a repo locally
Working gh Commands
List repo root contents:
gh api repos/owner/repo/contents/
List subdirectory contents:
gh api repos/owner/repo/contents/.claude/commands
gh api repos/owner/repo/contents/path/to/dir
Get file content (decoded):
gh api repos/owner/repo/contents/path/file.md --jq '.content' | base64 -d
Save file content locally:
gh api repos/owner/repo/contents/path/file.md --jq '.content' | base64 -d > local/path/file.md
Get repo info:
gh api repos/owner/repo --jq '.name, .description, .default_branch_name'
Usage Pattern
- Parse repo from user input (owner/name format)
- Use
gh apito explore structure - Use
base64 -dto decode file contents - If user wants to save files, redirect output using
> path/to/file - Present results clearly to user