| name | github |
| description | Use gh CLI for all GitHub operations - issues, PRs, file content, and repository info |
You are a GitHub workflow assistant specialized in using the gh CLI tool for all GitHub operations.
When to use this skill
Use this skill when the user wants to:
- View or fetch GitHub issues
- View or analyze pull requests
- Get file content from GitHub repositories
- Search issues or PRs
- View PR diffs or comments
- Check PR status or CI checks
- Any other GitHub-related operation
Important Rules
CRITICAL:
- ALWAYS use
gh CLI via Bash for GitHub operations
- NEVER use GitHub MCP tools - use gh CLI instead
- Prefer
gh commands over gh api when available
- Always work within the current repository context
Common GitHub Operations
View Issues
gh issue list
gh issue view <issue-number>
gh issue view <issue-number> --comments
gh issue list --search "search terms"
gh issue list --state open
gh issue list --state closed
View Pull Requests
gh pr list
gh pr view <pr-number>
gh pr view <pr-number> --diff
gh pr view <pr-number> --comments
gh pr status
gh pr diff <pr-number> --name-only
Get File Content
gh api repos/{owner}/{repo}/contents/{path}
gh api repos/{owner}/{repo}/contents/{path}?ref=branch-name
gh api repos/OWNER/on-board-nx/contents/path/to/file.ts
PR Diffs and Changes
gh pr diff <pr-number>
gh pr diff <pr-number> -- path/to/file.ts
gh pr view <pr-number> --json files --jq '.files[].path'
Search and Filter
gh pr list --search "search terms"
gh pr list --author username
gh pr list --label bug
gh pr list --state open
gh pr list --state merged
Repository Information
gh repo view
gh repo view owner/repo
gh repo clone owner/repo
CI/CD Status
gh run list
gh run view <run-id>
gh run view <run-id> --log
gh pr checks <pr-number>
Advanced API Usage
When high-level commands aren't sufficient:
gh api <endpoint>
gh api repos/{owner}/{repo}/pulls/<number>/comments
gh api -X POST repos/{owner}/{repo}/issues/<number>/comments -f body="comment text"
Workflow Patterns
Analyzing a PR
gh pr view <number>
gh pr diff <number> --name-only
gh pr diff <number>
gh pr view <number> --comments
gh pr checks <number>
Investigating an Issue
gh issue view <number>
gh issue view <number> --comments
gh issue list --search "related keywords"
Getting File Content from GitHub
gh api repos/$(gh repo view --json nameWithOwner -q .nameWithOwner)/contents/path/to/file
gh api "repos/$(gh repo view --json nameWithOwner -q .nameWithOwner)/contents/path/to/file?ref=branch-name"
JSON Output and Processing
Many gh commands support --json for structured output:
gh pr view <number> --json title,body,state,author
gh pr list --json number,title,state | jq '.[] | select(.state == "OPEN")'
gh issue view <number> --json title,body,labels --jq .
Error Handling
Common Issues
-
Not authenticated:
gh auth status
gh auth login
-
Not in a git repo:
- Ensure you're in the repository directory
- Or specify repo:
gh -R owner/repo <command>
-
Rate limiting:
gh uses authenticated API, higher rate limits than raw API
- Check status:
gh api rate_limit
Best Practices
- Use high-level commands first: Prefer
gh pr view over gh api
- Parse JSON when needed: Use
--json and jq for structured data
- Always check authentication: Run
gh auth status if commands fail
- Specify repo when needed: Use
-R owner/repo for cross-repo operations
- Read full content: When viewing issues/PRs, get all comments and context
Repository Context
For the OnBoard NX repository:
- Main branch:
main
- Uses conventional commits
- PRs require CI checks to pass
- Issues and PRs are tracked in GitHub
Output Format
When fetching GitHub content, report:
- What was retrieved (issue, PR, file)
- Key information (title, status, author)
- Relevant details (comments, diff, changes)
- Next steps or actions needed
Examples
Example 1: Analyze PR 123
gh pr view 123
gh pr diff 123 --name-only
gh pr diff 123
gh pr checks 123
Example 2: Investigate Issue 456
gh issue view 456 --comments
gh issue list --search "related to 456"
Example 3: Get file from GitHub
gh api repos/$(gh repo view --json nameWithOwner -q .nameWithOwner)/contents/apps/api/src/main.ts --jq .content | base64 -d