| name | search-operations |
| description | Search GitHub - find code, issues, users, and repositories across GitHub using gh CLI |
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:
gh search code "function authenticate" --limit 20
Search in specific language:
gh search code "async function" --language javascript --limit 30
Search in specific repository:
gh search code "TODO" --repo owner/repo-name
Search in organization:
gh search code "API_KEY" --owner myorg
Search with extension filter:
gh search code "class.*Component" --extension tsx
Search by file path:
gh search code "config" --path "src/config"
Complex code search:
gh search code "useState" --language typescript --extension tsx --owner facebook
Search with size filter:
gh search code "import React" --size ">1000"
JSON output for processing:
gh search code "security vulnerability" --json path,repository,url --jq '.[] | {file: .path, repo: .repository.fullName}'
Search Issues and Pull Requests
Search all issues:
gh search issues "memory leak" --limit 30
Search in specific repository:
gh search issues "bug" --repo owner/repo-name
Search open issues only:
gh search issues "crash" --state open
Search closed issues:
gh search issues "fixed" --state closed
Search by label:
gh search issues "bug" --label "critical"
Multiple labels:
gh search issues "" --label "bug" --label "security"
Search by author:
gh search issues "feature" --author username
Search by assignee:
gh search issues "" --assignee username
Search in organization:
gh search issues "todo" --owner myorg
Search by date:
gh search issues "bug" --created ">2025-01-01"
gh search issues "feature" --updated "<2025-01-01"
Search by comments count:
gh search issues "help wanted" --comments ">10"
Search PRs only:
gh search prs "feat:" --state open --limit 20
Complex issue search:
gh search issues "is:open is:issue label:bug assignee:@me"
Search with reactions:
gh search issues "good first issue" --reactions ">5"
JSON output:
gh search issues "security" --json number,title,state,url --jq '.[] | "\(.number): \(.title)"'
Search Repositories
Basic repository search:
gh search repos "machine learning" --limit 20
Search by language:
gh search repos "web framework" --language python
Search by stars:
gh search repos "react" --stars ">10000"
Search by forks:
gh search repos "kubernetes" --forks ">1000"
Search by size (KB):
gh search repos "starter template" --size "<1000"
Search in organization:
gh search repos "" --owner microsoft
Search by topic:
gh search repos "topic:docker topic:kubernetes"
Search archived repositories:
gh search repos "old-project" --archived
Search by license:
gh search repos "utility library" --license mit
Search by creation date:
gh search repos "created:>2025-01-01"
Search by last update:
gh search repos "updated:>2025-01-01" --stars ">100"
Search by number of followers:
gh search repos "followers:>1000"
Complex repository search:
gh search repos "stars:>5000 language:python topic:machine-learning"
JSON output:
gh search repos "awesome" --json name,owner,stars,url --jq '.[] | "\(.owner.login)/\(.name) - \(.stars) stars"'
Search Users
Basic user search:
gh search users "john doe" --limit 10
Search by location:
gh search users "location:seattle"
Search by language:
gh search users "language:python"
Search by followers:
gh search users "followers:>1000"
Search by repositories:
gh search users "repos:>50"
Search organizations:
gh search users "type:org"
Search individual users:
gh search users "type:user"
Search by creation date:
gh search users "created:>2020-01-01"
Complex user search:
gh search users "location:california language:javascript followers:>100"
JSON output:
gh search users "location:london" --json login,name,url --jq '.[] | "\(.login): \(.name)"'
Advanced Search Queries
GitHub Search Syntax
Boolean operators:
# AND (default)
gh search code "class AND function"
# OR
gh search code "bug OR error"
# NOT
gh search code "NOT deprecated"
Exact phrase matching:
gh search code '"exact phrase here"'
Wildcards:
gh search repos "test*"
Range queries:
gh search repos "stars:10..50"
gh search issues "created:2025-01-01..2025-12-31"
Qualifiers:
# Search code
gh search code "repo:owner/name path:src/ language:js"
# Search issues
gh search issues "is:open is:issue label:bug assignee:@me"
# Search PRs
gh search prs "is:pr is:open review:approved"
# Search repos
gh search repos "stars:>1000 forks:>500 language:python"
Common Patterns
Find Vulnerable Code
# Search for exposed API keys
gh search code "API_KEY" --language javascript
# Search for TODO security items
gh search code "TODO.*security" --owner myorg
# Find hardcoded passwords
gh search code "password.*=.*['\"]" --language python
# Search for SQL injection vulnerabilities
gh search code "query.*=.*+.*req\." --language javascript
Find Examples and Documentation
# Find usage examples
gh search code "import MyLibrary" --language typescript
# Find configuration examples
gh search code "filename:config.yml" --owner popular-org
# Find test examples
gh search code "describe.*test" --path "test/" --language javascript
Project Discovery
# Find active projects
gh search repos "stars:>100 pushed:>2025-01-01" --language rust
# Find good first issues
gh search issues "label:good-first-issue state:open"
# Find projects needing help
gh search issues "label:help-wanted state:open" --sort comments
# Find trending repositories
gh search repos "created:>2025-01-01" --sort stars
Competitive Analysis
# Find similar projects
gh search repos "web framework language:python stars:>1000"
# Find what competitors are building
gh search repos "owner:competitor-org"
# Track competitor issues
gh search issues "org:competitor-org is:open"
# See popular forks
gh search repos "fork:true" --sort stars
Team Collaboration
# Find your open issues
gh search issues "assignee:@me state:open"
# Find PRs needing review
gh search prs "review-requested:@me state:open"
# Find team's open PRs
gh search prs "team:myorg/myteam state:open"
# Find stale issues
gh 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
gh 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
gh search issues "bug" --sort comments --order desc
For code:
--sort indexed: Sort by when indexed (default)
Pagination
Limit results:
gh search repos "python" --limit 100
Get more results (max 100):
gh search code "function" --limit 100
Output Formats
JSON Output
Basic JSON:
gh search repos "docker" --json name,description,stars
Pipe to jq for processing:
gh search repos "kubernetes" --json name,stars,url \
| jq '.[] | select(.stars > 1000) | {name, stars}'
Extract specific fields:
gh search issues "bug" --json number,title,state --jq '.[] | "\(.number): \(.title) [\(.state)]"'
Error Handling
Rate Limiting
# Check rate limit status
gh api rate_limit
# If rate limited, wait or authenticate
gh auth login
No Results Found
# Verify query syntax
gh search repos "test" --limit 1
# Try broader query
gh search repos "test*" --limit 10
Search Timeout
# Try more specific query
gh search code "function" --repo owner/specific-repo
# 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
--limitto 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
--sortto 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-managementafter finding repos to clone or fork - Use
issue-managementto work with found issues - Use
pull-request-managementfor found PRs - Use
code-reviewto review found code