mcpField
G
github-search

github-search

github.com/samhvw8Development1566 installsUpdated 1d ago
Repository

About github-search

github-search is a skill that provides methods and command examples for searching GitHub repositories, code, and collaboration records. It focuses on cascading keyword variants from longer to shorter queries and covers API searches for complex filters.

Key features

  1. 01Search repositories, code, issues, and PRs
  2. 02Cascade keyword variants from long to short
  3. 03Run multiple search queries in parallel
  4. 04Use the GitHub API for complex queries
  5. 05Filter results with search qualifiers

Use cases

  1. 01Find repositories by language and star count
  2. 02Search for code examples using a library
  3. 03Locate open bug reports or feature discussions
  4. 04Narrow repository searches by excluding topics

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/samhvw8/dotfiles --skill github-search

After installing, type/github-searchin Claude Code to confirm it loaded.

Details

From the project README

GitHub Search

Quick Commands

GoalCommand
Search reposgh search repos "<query>" --limit 30
Search codegh search code "<query>" --limit 30
Search issuesgh search issues "<query>" --limit 30
Search PRsgh search prs "<query>" --limit 30

Keyword Strategy: Variants & Long → Short

GitHub matches your query tokens against repo name + description + README (for code search, the file contents). There is no semantic matching — a repo is invisible if its text doesn't contain words close to yours. Two ways a search misses:

  • Wrong word — the author used a synonym you didn't try.
  • Too long — your compound phrase is more specific than any repo's name/description, so nothing matches.

Fix: generate keyword variants, and cascade from longer to shorter.

# ❌ Brittle — one long compound, matches almost nothing
gh search repos "AI powered headless browser automation framework"

# ✅ Variants + length cascade — run in parallel, shorter terms guarantee coverage
gh search repos "headless browser automation" --sort stars --limit 15
gh search repos "headless browser"            --sort stars --limit 15
gh search repos "browser automation"          --sort stars --limit 15
gh search repos "browserless"                 --sort stars --limit 15   # synonym
gh search repos "browser"                      --sort stars --limit 15   # shortest, widest net
RuleWhy
Longer → shorterEach word you drop widens the match set; the shortest core noun catches repos with zero topics and terse descriptions
Generate variantsAuthors and users pick different words (headless vs browserless, agent vs bot) — cover the synonyms
Never long-onlyA single long compound is the most brittle query — if it's all you run, you miss the field
Run in parallelBatch all variants into simultaneous calls; cost is the same, coverage is far higher
Repeat per languageRun the cascade in each target language with native terms (无头浏览器, автоматизация браузера)

Direct API Search (Web-Exact Results)

For complex queries where gh search repos gives different results than web:

# 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:

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?

  • gh search repos is a convenience wrapper with its own query parsing
  • gh api search/repositories hits the raw API, matching web behavior exactly
  • Required when combining: multiple languages + topic exclusions + star filters

Common jq extractions:

Outputjq filter
Names only--jq '.items[].name'
Full names--jq '.items[].full_name'
With stars--jq '.items[] | "\(.full_name) ⭐\(.stargazers_count)"'
URLs--jq '.items[].html_url'
Full JSON(omit --jq)

Patterns

Finding Repositories

When you see: User wants to find projects/repos by criteria Use: gh search repos

# 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 (pick a date a few months back)
gh search repos "language:python pushed:>YYYY-MM-DD"

Output formats:

--json name,url,description,stargazersCount  # JSON output
--web                                         # Open in browser
Finding Code Examples

When you see: User wants to know how to use a library Use: gh search code

# 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:ts

Pro tip: Combine with repo filter for focused results:

gh search code "pattern" repo:owner/repo
Finding Issues/Discussions

When you see: User looking for bug reports, feature requests, or discussions Use: gh search issues or gh search prs

# 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
QualifierExampleDescription
stars:stars:>1000, stars:100..500Star count
forks:forks:>100Fork count
language:language:rustPrimary language
topic:topic:cliRepository topic
-topic:-topic:blockchainExclude topic
pushed:pushed:>2024-01-01Last push date
created:created:>2023-01-01Creation date
license:license:mitLicense type
archived:archived:falseArchive status
is:is:public, is:privateVisibility
Code Search
QualifierExampleDescription
extension:extension:tsFile extension
path:path:src/File path
repo:repo:owner/nameSpecific repo
language:language:javascriptCode language
filename:filename:package.jsonFile name
Common Flags
FlagDescription
--limit NNumber of results (max 1000)
--sort XSort by: stars, forks, updated, best-match
--order Xasc or desc
--json FIELDSJSON output with specific fields
--webOpen results in browser

Common Use Cases

"Find popular X repos"
gh search repos "language:X stars:>500" --sort=stars --limit=50
"How do people use library Y"
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"
gh search repos "topic:Z -topic:cryptocurrency -topic:blockchain -topic:web3"
"Find recent active projects"
gh search repos "language:go pushed:>YYYY-MM-DD stars:>100" --sort=updated

Tips

  1. Quote the query when it contains special chars: gh search repos "stars:>500"
  2. Multiple languages = OR: language:rust language:go matches either
  3. Use --json for scripting: --json name,url,stargazersCount
  4. Date ranges: pushed:2024-01-01..2024-06-01
  5. Numeric ranges: stars:100..500
  6. Use gh api for complex queries: When gh search repos gives unexpected results, use gh api search/repositories?q=... for exact web parity

Comments

Markdown supported