| name | github-explorer |
| description | General-purpose GitHub exploration and analysis tool for searching issues, creating PRs, analyzing git history, and reviewing PR comments |
| license | MIT |
GitHub Explorer Skill
Description
This skill provides interactive GitHub exploration and analysis capabilities using the GitHub CLI (gh) and git commands. It enables searching and filtering issues, creating pull requests with custom templates, analyzing file history with git blame, and reviewing PR comments and feedback. Use this skill when you need flexible, exploratory interactions with GitHub repositories.
Usage
Invoke this skill when you need to:
- Search for issues with specific labels, assignees, or text queries
- List and filter issues across repositories
- Create pull requests with customized content and templates
- Analyze who authored specific lines of code and when
- Review pull request comments and identify actionable feedback
- Investigate code history and track changes to specific functions
- Parse and analyze PR review threads
Prerequisites
This skill requires the following tools to be installed and configured:
-
GitHub CLI (gh): Version 2.0 or higher
-
Git: Any recent version
- Check installation:
git --version
-
jq: JSON processor for parsing API responses
-
GitHub Authentication: Must be logged in to gh CLI
- Check status:
gh auth status
- Login:
gh auth login
Instructions
Feature 1: Search and List Issues
Use this feature to find and explore GitHub issues across repositories.
Step 1: List Issues in Current Repository
gh issue list --state open
gh issue list --state all
gh issue list --state open --limit 20
Step 2: Filter Issues by Labels
gh issue list --label "bug" --state open
gh issue list --label "bug,high-priority" --state open
gh issue list --label "enhancement" --state open --limit 10
Step 3: Filter Issues by Assignee
gh issue list --assignee @me --state open
gh issue list --assignee username --state open
gh issue list --assignee @me --label "bug,high-priority" --state open
Step 4: Search Issues with Text Queries
gh search issues "authentication error"
gh search issues "docker configuration" --repo owner/repo
gh search issues "api timeout" --owner orgname
gh search issues "memory leak" --state open --label "bug" --limit 10
Step 5: View Issue Details
gh issue view 123
gh issue view 123 --comments
gh issue view 123 --json title,body,state,labels,assignees,createdAt
Step 6: Parse and Format Issue Data
gh issue list --json number,title,state,labels,assignees,createdAt --limit 10 | \
jq -r '.[] | "\(.number): \(.title) [\(.state)]"'
gh issue list --json number,title,assignees --limit 20 | \
jq -r '.[] | "\(.number)\t\(.title)\t\(.assignees[0].login // "unassigned")"'
gh issue list --state all --json labels --jq '[.[].labels[].name] | group_by(.) | map({label: .[0], count: length}) | sort_by(.count) | reverse'
Feature 2: Create Pull Requests
Use this feature to create pull requests with custom content and templates.
Step 1: Review Current Branch Changes
Before creating a PR, review what changes will be included:
git diff main...HEAD --stat
git diff main...HEAD
git log main...HEAD --oneline
git log main...HEAD --pretty=fuller
Step 2: Create Basic Pull Request
gh pr create --fill
gh pr create --title "Fix authentication bug" --body "This PR fixes the token validation issue"
gh pr create --base develop --head feature-branch
Step 3: Create PR with Custom Template
gh pr create --title "Add user profile feature" --body "$(cat <<'EOF'
## Summary
- Implemented user profile page
- Added avatar upload functionality
- Created profile editing form
## Changes Made
- New UserProfile component
- Profile API endpoints
- Avatar storage in GCS
## Related Issues
Fixes #42
Relates to #38
## Testing
- [ ] Manual testing completed
- [ ] Unit tests added
- [ ] Integration tests passing
🤖 Generated with an agent-assisted workflow.
EOF
)"
Step 4: Create Draft or WIP Pull Requests
gh pr create --draft --title "WIP: Refactor authentication"
gh pr create --title "Fix login bug" --body "Ready for review"
Step 5: Link PR to Issues
gh pr create --title "Fix memory leak" --body "Fixes #123"
gh pr create --title "Bug fixes" --body "$(cat <<'EOF'
## Summary
Multiple bug fixes
## Issues
Fixes #123
Fixes #124
Relates to #125
EOF
)"
Step 6: Advanced PR Creation
REPO_URL=$(gh repo view --json url --jq .url)
CURRENT_BRANCH=$(git branch --show-current)
COMMITS=$(git log main...HEAD --pretty=format:"- %s")
gh pr create --title "Feature: $(git log -1 --pretty=%s)" --body "$(cat <<EOF
## Changes in this PR
$COMMITS
## Branch
\`$CURRENT_BRANCH\`
## Repository
$REPO_URL
🤖 Generated with an agent-assisted workflow.
EOF
)"
Feature 3: Git Blame Analysis
Use this feature to analyze file history and identify code authors.
Step 1: Basic Git Blame
git blame path/to/file.py
git blame -L 50,100 path/to/file.py
git blame -L 50,100 path/to/file.py --date=short
Step 2: Enhanced Blame Output
git blame --show-email path/to/file.py
git blame -L 10,20 path/to/file.py --abbrev=40
git blame -w path/to/file.py
git blame --follow path/to/file.py
Step 3: Analyze File History
git log -L 50,100:path/to/file.py --pretty=fuller --patch
git log -S "function_name" --source --all --pretty=fuller path/to/file.py
git log --follow --oneline path/to/file.py
git blame path/to/file.py | awk '{print $2}' | sort | uniq -c | sort -nr
Step 4: Link Blame to GitHub Commits
COMMIT_HASH=$(git blame -L 50,50 path/to/file.py | awk '{print $1}')
REPO_URL=$(gh repo view --json url --jq .url)
echo "$REPO_URL/commit/$COMMIT_HASH"
Step 5: Format Blame Output
git blame -L 10,20 path/to/file.py | \
awk '{printf "Line %s: %s %s %s\n", substr($0, index($0, ")") + 1, 4), $2, $3, $4}'
echo "Line,Author,Date,Commit" > blame_output.csv
git blame -L 1,100 path/to/file.py --date=short | \
awk '{print NR "," $2 "," $3 "," $1}' >> blame_output.csv
Step 6: Advanced History Analysis
git log -S "critical_function" --source --all -p path/to/file.py
git log --stat path/to/file.py
git blame path/to/file.py | awk '{print $2, $3}' | sort | uniq -c | sort -nr
COMMIT=$(git blame -L 50,50 path/to/file.py | awk '{print $1}')
git diff $COMMIT path/to/file.py
Feature 4: Analyze PR Comments
Use this feature to analyze pull request review comments and feedback.
Step 1: View PR with Comments
gh pr view 123 --comments
gh pr view 123 --json title,body,state,comments
Step 2: Check PR Review Status
gh pr checks 123
gh pr reviews 123
gh pr view 123 --json reviewDecision
Step 3: Get Detailed Review Comments
gh api repos/:owner/:repo/pulls/123/comments | jq '.'
gh api repos/:owner/:repo/pulls/123/comments --jq '.[] | {
author: .user.login,
body: .body,
path: .path,
line: .line,
created: .created_at
}'
gh api repos/:owner/:repo/pulls/123/comments --jq '.[] | select(.path == "src/main.py") | {author: .user.login, line: .line, body: .body}'
Step 4: Analyze Conversation Threads
gh api repos/:owner/:repo/pulls/123/reviews --jq '.[] | {
author: .user.login,
state: .state,
body: .body,
submitted: .submitted_at
}'
gh pr view 123 --json reviews --jq '.reviews[] | select(.state == "CHANGES_REQUESTED")'
gh pr view 123 --json reviews --jq '.reviews | group_by(.state) | map({state: .[0].state, count: length})'
Step 5: Track Comment Authors
gh api repos/:owner/:repo/pulls/123/comments --jq 'group_by(.user.login) | map({author: .[0].user.login, count: length})'
gh api repos/:owner/:repo/pulls/123/comments --jq '[.[].user.login] | unique'
gh api repos/:owner/:repo/pulls/123/comments --jq 'group_by(.user.login) | map({author: .[0].user.login, count: length}) | sort_by(.count) | reverse | .[0]'
Step 6: Identify Actionable Feedback
gh pr reviews 123 --json author,state,body | \
jq '.[] | select(.state == "CHANGES_REQUESTED")'
gh api repos/:owner/:repo/pulls/123/comments --jq '[.[].path] | unique'
gh api repos/:owner/:repo/pulls/123/comments --jq 'group_by(.path) | map({file: .[0].path, comment_count: length})'
gh pr diff 123
gh pr diff 123 -- path/to/file.py
Error Handling
Authentication Errors
If you encounter authentication issues:
gh auth status
gh auth login
gh api user
gh repo view
Rate Limiting
GitHub API has rate limits. If you encounter rate limit errors:
gh api rate_limit
gh api rate_limit --jq '.resources.core | {
limit: .limit,
remaining: .remaining,
reset: .reset,
reset_time: (.reset | strftime("%Y-%m-%d %H:%M:%S"))
}'
Rate limits:
- Authenticated requests: 5,000 per hour
- Unauthenticated requests: 60 per hour
- GraphQL API: 5,000 points per hour
Repository Context Errors
If commands fail because you're not in a git repository:
if ! git rev-parse --is-inside-work-tree 2>/dev/null; then
echo "Error: Not in a git repository"
echo "Navigate to a git repository or initialize one with: git init"
exit 1
fi
gh repo view --json nameWithOwner,url
gh repo clone owner/repo
Missing Issues or PRs
If an issue or PR doesn't exist:
if gh issue view 123 2>/dev/null; then
gh issue view 123
else
echo "Issue #123 not found"
echo "Available issues:"
gh issue list --limit 10
fi
gh pr list --state all --limit 20
Permission Errors
If you lack permissions for certain operations:
- For PR creation: Ensure you have write access to the repository
- For issue access: Check repository visibility (private vs public)
- For API operations: Verify your authentication scope
gh api repos/:owner/:repo | jq '.permissions'
gh auth refresh -s repo,read:org
Success Criteria
This skill succeeds when:
- GitHub CLI is properly installed and authenticated (
gh auth status shows active login)
- Issue searches return relevant, filtered results matching the specified criteria
- PR creation completes successfully with properly formatted title and body
- Git blame analysis identifies correct authors and timestamps for code sections
- PR comment analysis retrieves and parses all review threads and feedback
- All bash commands execute without errors
- JSON parsing with
jq produces readable, formatted output
- Rate limits are monitored and respected
- Repository context is verified before operations that require it
- Error messages are clear and provide actionable next steps
Notes
Best Practices
- Always authenticate first: Run
gh auth login and gh auth status before using this skill
- Use JSON output for parsing: Add
--json flags to gh commands when you need structured data
- Parse with jq: Use
jq for filtering and formatting JSON API responses
- Verify repository context: Check you're in the correct repository with
gh repo view
- Monitor rate limits: Check
gh api rate_limit if you're making many requests
- Test commands incrementally: Start with simple commands before building complex queries
GitHub API Rate Limits
Be mindful of GitHub's API rate limits:
- 5,000 requests/hour for authenticated users
- 60 requests/hour for unauthenticated requests
- Use
gh api rate_limit to check current usage
- The
gh CLI automatically handles authentication
Complementary with git-pr-workflow Skill
This skill complements the existing git-pr-workflow skill:
- Use github-explorer when: You need to explore issues, analyze code history, review PR feedback, or manually craft custom PRs
- Use git-pr-workflow when: You want fully automated PR creation, CI monitoring, and auto-merge
Example combined workflow:
- Use
github-explorer to find bugs: gh issue list --label "bug"
- Fix the bugs in your code
- Use
git-pr-workflow to automatically create a PR, monitor CI, and merge
Working with Multiple Repositories
To work across different repositories:
gh issue list --repo owner/repo
gh pr list --repo owner/other-repo
gh repo clone owner/repo
cd repo
gh search issues "bug" --owner orgname
Output Formatting Tips
For better readability:
- Use
--json with jq for structured data
- Pipe to
grep for text filtering
- Use
column -t for table formatting
- Export to CSV for spreadsheet analysis
Resources