github-search
Original:🇺🇸 English
Translated
Search GitHub for repos, code, and usage examples using gh CLI. Capabilities: repo discovery, code search, finding library usage patterns, issue/PR search. Actions: search, find, discover repos/code/examples. Keywords: gh, github, search repos, search code, find examples, how to use library, stars, language filter. Use when: finding repositories, searching code patterns, discovering how libraries are used, exploring open source.
11installs
Sourcesamhvw8/dotfiles
Added on
NPX Install
npx skill4agent add samhvw8/dotfiles github-searchTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →GitHub Search
Quick Commands
| Goal | Command |
|---|---|
| Search repos | |
| Search code | |
| Search issues | |
| Search PRs | |
Direct API Search (Web-Exact Results)
For complex queries where gives different results than web:
gh search reposbash
# Template - URL-encodes query automatically
gh api "search/repositories?q=$(printf '%s' 'YOUR_QUERY_HERE' | jq -sRr @uri)&sort=updated&per_page=30" --jq '.items[].full_name'Example - Multi-language with exclusions:
bash
gh api "search/repositories?q=$(printf '%s' 'stars:>500 language:rust language:go language:TypeScript language:javascript -topic:ethereum -topic:cryptocurrency -topic:blockchain -topic:bitcoin -topic:web3' | jq -sRr @uri)&sort=updated&per_page=10" --jq '.items[].full_name'Why use this?
- is a convenience wrapper with its own query parsing
gh search repos - hits the raw API, matching web behavior exactly
gh api search/repositories - Required when combining: multiple languages + topic exclusions + star filters
Common jq extractions:
| Output | jq filter |
|---|---|
| Names only | |
| Full names | |
| With stars | |
| URLs | |
| Full JSON | (omit --jq) |
Patterns
Finding Repositories
When you see: User wants to find projects/repos by criteria
Use:
gh search reposbash
# Basic search with stars
gh search repos "stars:>500 language:rust" --sort=stars --limit=50
# Multiple languages (OR logic)
gh search repos "language:rust language:go language:typescript"
# Exclude topics
gh search repos "stars:>1000 -topic:cryptocurrency -topic:blockchain"
# By topic
gh search repos "topic:cli topic:terminal stars:>100"
# Recently updated
gh search repos "language:python pushed:>2024-01-01"Output formats:
bash
--json name,url,description,stargazersCount # JSON output
--web # Open in browserFinding Code Examples
When you see: User wants to know how to use a library
Use:
gh search codebash
# Find usage patterns
gh search code "from zod import" --limit=20
gh search code "import { z } from 'zod'" --limit=20
# In specific file types
gh search code "useQuery" extension:tsx --limit=30
# In specific paths
gh search code "tanstack/query" path:src/ extension:ts
# Exact phrase
gh search code '"createTRPCRouter"' extension:tsPro tip: Combine with repo filter for focused results:
bash
gh search code "pattern" repo:owner/repoFinding Issues/Discussions
When you see: User looking for bug reports, feature requests, or discussions
Use: or
gh search issuesgh search prsbash
# Open issues with label
gh search issues "is:open label:bug repo:facebook/react"
# PRs by author
gh search prs "author:username is:merged"
# Issues mentioning error
gh search issues '"connection refused" language:go'Query Qualifiers Reference
Repo Search
| Qualifier | Example | Description |
|---|---|---|
| | Star count |
| | Fork count |
| | Primary language |
| | Repository topic |
| | Exclude topic |
| | Last push date |
| | Creation date |
| | License type |
| | Archive status |
| | Visibility |
Code Search
| Qualifier | Example | Description |
|---|---|---|
| | File extension |
| | File path |
| | Specific repo |
| | Code language |
| | File name |
Common Flags
| Flag | Description |
|---|---|
| Number of results (max 1000) |
| Sort by: stars, forks, updated, best-match |
| asc or desc |
| JSON output with specific fields |
| Open results in browser |
Common Use Cases
"Find popular X repos"
bash
gh search repos "language:X stars:>500" --sort=stars --limit=50"How do people use library Y"
bash
gh search code "import Y" extension:ts --limit=30
gh search code "from Y import" extension:py --limit=30"Find repos like Z but exclude crypto"
bash
gh search repos "topic:Z -topic:cryptocurrency -topic:blockchain -topic:web3""Find recent active projects"
bash
gh search repos "language:go pushed:>2024-06-01 stars:>100" --sort=updatedTips
- Quote the query when it contains special chars:
gh search repos "stars:>500" - Multiple languages = OR: matches either
language:rust language:go - Use for scripting:
--json--json name,url,stargazersCount - Date ranges:
pushed:2024-01-01..2024-06-01 - Numeric ranges:
stars:100..500 - Use for complex queries: When
gh apigives unexpected results, usegh search reposfor exact web paritygh api search/repositories?q=...