GitHub Search Operations Skill
This skill provides comprehensive search capabilities across GitHub including searching for code, issues, pull requests, repositories, and users.
Available Operations
1. Search Code
Search for code across GitHub repositories.
2. Search Issues and Pull Requests
Search for issues and PRs with advanced filters.
3. Search Repositories
Find repositories matching specific criteria.
4. Search Users
Find GitHub users and organizations.
Usage Examples
Search Code
Basic code search:
bash
1gh search code "function authenticate" --limit 20
Search in specific language:
bash
1gh search code "async function" --language javascript --limit 30
Search in specific repository:
bash
1gh search code "TODO" --repo owner/repo-name
Search in organization:
bash
1gh search code "API_KEY" --owner myorg
Search with extension filter:
bash
1gh search code "class.*Component" --extension tsx
Search by file path:
bash
1gh search code "config" --path "src/config"
Complex code search:
bash
1gh search code "useState" --language typescript --extension tsx --owner facebook
Search with size filter:
bash
1gh search code "import React" --size ">1000"
JSON output for processing:
bash
1gh search code "security vulnerability" --json path,repository,url --jq '.[] | {file: .path, repo: .repository.fullName}'
Search Issues and Pull Requests
Search all issues:
bash
1gh search issues "memory leak" --limit 30
Search in specific repository:
bash
1gh search issues "bug" --repo owner/repo-name
Search open issues only:
bash
1gh search issues "crash" --state open
Search closed issues:
bash
1gh search issues "fixed" --state closed
Search by label:
bash
1gh search issues "bug" --label "critical"
Multiple labels:
bash
1gh search issues "" --label "bug" --label "security"
Search by author:
bash
1gh search issues "feature" --author username
Search by assignee:
bash
1gh search issues "" --assignee username
Search in organization:
bash
1gh search issues "todo" --owner myorg
Search by date:
bash
1gh search issues "bug" --created ">2025-01-01"
2gh search issues "feature" --updated "<2025-01-01"
Search by comments count:
bash
1gh search issues "help wanted" --comments ">10"
Search PRs only:
bash
1gh search prs "feat:" --state open --limit 20
Complex issue search:
bash
1gh search issues "is:open is:issue label:bug assignee:@me"
Search with reactions:
bash
1gh search issues "good first issue" --reactions ">5"
JSON output:
bash
1gh search issues "security" --json number,title,state,url --jq '.[] | "\(.number): \(.title)"'
Search Repositories
Basic repository search:
bash
1gh search repos "machine learning" --limit 20
Search by language:
bash
1gh search repos "web framework" --language python
Search by stars:
bash
1gh search repos "react" --stars ">10000"
Search by forks:
bash
1gh search repos "kubernetes" --forks ">1000"
Search by size (KB):
bash
1gh search repos "starter template" --size "<1000"
Search in organization:
bash
1gh search repos "" --owner microsoft
Search by topic:
bash
1gh search repos "topic:docker topic:kubernetes"
Search archived repositories:
bash
1gh search repos "old-project" --archived
Search by license:
bash
1gh search repos "utility library" --license mit
Search by creation date:
bash
1gh search repos "created:>2025-01-01"
Search by last update:
bash
1gh search repos "updated:>2025-01-01" --stars ">100"
Search by number of followers:
bash
1gh search repos "followers:>1000"
Complex repository search:
bash
1gh search repos "stars:>5000 language:python topic:machine-learning"
JSON output:
bash
1gh search repos "awesome" --json name,owner,stars,url --jq '.[] | "\(.owner.login)/\(.name) - \(.stars) stars"'
Search Users
Basic user search:
bash
1gh search users "john doe" --limit 10
Search by location:
bash
1gh search users "location:seattle"
Search by language:
bash
1gh search users "language:python"
Search by followers:
bash
1gh search users "followers:>1000"
Search by repositories:
bash
1gh search users "repos:>50"
Search organizations:
bash
1gh search users "type:org"
Search individual users:
bash
1gh search users "type:user"
Search by creation date:
bash
1gh search users "created:>2020-01-01"
Complex user search:
bash
1gh search users "location:california language:javascript followers:>100"
JSON output:
bash
1gh search users "location:london" --json login,name,url --jq '.[] | "\(.login): \(.name)"'
Advanced Search Queries
GitHub Search Syntax
Boolean operators:
bash
1# AND (default)
2gh search code "class AND function"
3
4# OR
5gh search code "bug OR error"
6
7# NOT
8gh search code "NOT deprecated"
Exact phrase matching:
bash
1gh search code '"exact phrase here"'
Wildcards:
bash
1gh search repos "test*"
Range queries:
bash
1gh search repos "stars:10..50"
2gh search issues "created:2025-01-01..2025-12-31"
Qualifiers:
bash
1# Search code
2gh search code "repo:owner/name path:src/ language:js"
3
4# Search issues
5gh search issues "is:open is:issue label:bug assignee:@me"
6
7# Search PRs
8gh search prs "is:pr is:open review:approved"
9
10# Search repos
11gh search repos "stars:>1000 forks:>500 language:python"
Common Patterns
Find Vulnerable Code
bash
1# Search for exposed API keys
2gh search code "API_KEY" --language javascript
3
4# Search for TODO security items
5gh search code "TODO.*security" --owner myorg
6
7# Find hardcoded passwords
8gh search code "password.*=.*['\"]" --language python
9
10# Search for SQL injection vulnerabilities
11gh search code "query.*=.*+.*req\." --language javascript
Find Examples and Documentation
bash
1# Find usage examples
2gh search code "import MyLibrary" --language typescript
3
4# Find configuration examples
5gh search code "filename:config.yml" --owner popular-org
6
7# Find test examples
8gh search code "describe.*test" --path "test/" --language javascript
Project Discovery
bash
1# Find active projects
2gh search repos "stars:>100 pushed:>2025-01-01" --language rust
3
4# Find good first issues
5gh search issues "label:good-first-issue state:open"
6
7# Find projects needing help
8gh search issues "label:help-wanted state:open" --sort comments
9
10# Find trending repositories
11gh search repos "created:>2025-01-01" --sort stars
Competitive Analysis
bash
1# Find similar projects
2gh search repos "web framework language:python stars:>1000"
3
4# Find what competitors are building
5gh search repos "owner:competitor-org"
6
7# Track competitor issues
8gh search issues "org:competitor-org is:open"
9
10# See popular forks
11gh search repos "fork:true" --sort stars
Team Collaboration
bash
1# Find your open issues
2gh search issues "assignee:@me state:open"
3
4# Find PRs needing review
5gh search prs "review-requested:@me state:open"
6
7# Find team's open PRs
8gh search prs "team:myorg/myteam state:open"
9
10# Find stale issues
11gh search issues "updated:<2024-01-01 state:open"
Sorting and Filtering
Sort Options
For repositories:
--sort stars: Sort by star count
--sort forks: Sort by fork count
--sort updated: Sort by last update
--sort help-wanted-issues: Sort by help wanted issues
bash
1gh search repos "javascript framework" --sort stars --order desc
For issues:
--sort comments: Sort by comment count
--sort created: Sort by creation date
--sort updated: Sort by update date
--sort reactions: Sort by reaction count
bash
1gh search issues "bug" --sort comments --order desc
For code:
--sort indexed: Sort by when indexed (default)
Limit results:
bash
1gh search repos "python" --limit 100
Get more results (max 100):
bash
1gh search code "function" --limit 100
JSON Output
Basic JSON:
bash
1gh search repos "docker" --json name,description,stars
Pipe to jq for processing:
bash
1gh search repos "kubernetes" --json name,stars,url \
2 | jq '.[] | select(.stars > 1000) | {name, stars}'
Extract specific fields:
bash
1gh search issues "bug" --json number,title,state --jq '.[] | "\(.number): \(.title) [\(.state)]"'
Error Handling
Rate Limiting
bash
1# Check rate limit status
2gh api rate_limit
3
4# If rate limited, wait or authenticate
5gh auth login
No Results Found
bash
1# Verify query syntax
2gh search repos "test" --limit 1
3
4# Try broader query
5gh search repos "test*" --limit 10
Search Timeout
bash
1# Try more specific query
2gh search code "function" --repo owner/specific-repo
3
4# Use fewer qualifiers
Best Practices
- Be specific: Use multiple qualifiers to narrow results
- Use quotes: For exact phrase matching
- Filter early: Apply language, repo, or org filters
- Limit results: Use
--limit to get manageable result sets
- Save queries: Document frequently used search queries
- Use JSON output: For programmatic processing
- Check rate limits: Monitor API usage
- Sort appropriately: Use
--sort to find most relevant results
- Combine with other tools: Pipe to jq, grep, etc.
- Test queries: Start broad, then refine
Integration with Other Skills
- Use
repository-management after finding repos to clone or fork
- Use
issue-management to work with found issues
- Use
pull-request-management for found PRs
- Use
code-review to review found code
References