GitHub Search
Overview
GitHub is the largest index of working software, but naive keyword queries surface
SEO'd awesome-lists and abandoned forks. This skill encodes the official search
syntax from the GitHub docs plus a discovery playbook, so an agent can go from
"is there a framework that does X?" to a verified shortlist in a few queries.
Three search surfaces, pick by task:
| Surface |
Use for |
How |
Web search UI (github.com/search) |
Repo discovery, topic browsing |
WebFetch/WebSearch on github.com/search?q=...&type=repositories |
REST API (api.github.com/search/*) |
Scripted/sorted/paginated discovery |
curl (token optional but raises limits) |
gh CLI |
Same as REST, ergonomic |
gh search repos, gh search code |
Remote-session caveat: in Claude Code on the web, GitHub MCP tools
(mcp__github__search_*) are often scoped to the session's repos only — do
not use them to search public GitHub there. Use WebSearch/WebFetch or
unauthenticated curl to api.github.com instead.
Source docs (re-fetch these if syntax seems off):
Repository search qualifiers
Combine free keywords with qualifiers; whitespace = AND.
| Goal |
Qualifier |
Example |
| Match in name/description/readme |
in:name, in:description, in:readme, in:topics |
"design doc" in:name,description |
| By topic label |
topic:TOPIC |
topic:ml-system-design |
| Popularity floor |
stars:>n, stars:n..n |
stars:>500 |
| Recently maintained |
pushed:>YYYY-MM-DD |
pushed:>2025-06-01 |
| Created window |
created:<YYYY-MM-DD |
created:>2024-01-01 |
| Language / license |
language:LANG, license:KEY |
language:python license:mit |
| Owner scope |
user:U, org:O, repo:O/R |
org:stanford-cs329s |
| Forks / archived / template |
fork:true, archived:false, template:true |
archived:false |
| Size (KB) |
size:>n |
size:>1000 |
Sorting: on the REST API / gh, use the separate sort (stars, forks,
updated) and order params — do not put sort: inside the query string.
Code search syntax (github.com/search?type=code)
- Exact match: quote it —
"sparse index"; escape inner quotes \".
- Boolean:
AND, OR, NOT (adjacent terms default to AND) —
"fatal error" NOT path:__testing__; parentheses for grouping.
- Regex: slashes —
/sparse.*index/, /^App\/src\//. No look-around.
Case-insensitive by default; force case with /(?-i)True/.
- Qualifiers:
repo:owner/name, org:, user:, language:,
path: (globs: path:/src/**/*.js), symbol:FunctionName (definitions),
content: (contents only, not filenames), is:archived|fork|generated.
- Code search on the API requires authentication and at least one plain
search term.
REST API essentials
# Repositories (works unauthenticated at low volume)
curl -s "https://api.github.com/search/repositories?q=topic:ml-system-design+stars:>100&sort=stars&order=desc&per_page=10" \
| jq -r '.items[] | "\(.stargazers_count)\t\(.full_name)\t\(.description)"'
# Topics
curl -s "https://api.github.com/search/topics?q=ml-system-design" | jq '.items[].name'
# Authenticated (higher limits + code search)
curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
"https://api.github.com/search/code?q=%22design_doc_checklist%22+language:markdown"
Endpoints: /search/repositories, /search/code, /search/topics,
/search/issues, /search/commits, /search/users — all take q, sort,
order, per_page (max 100), page.
Limits (from the docs — respect them):
- Authenticated: 30 req/min; code search: 9 req/min; unauthenticated: 10 req/min total.
- Query: max 256 chars, max five
AND/OR/NOT operators; URL-encode q (> → %3E, quotes → %22, space → +).
- Max 1,000 results per query — narrow with qualifiers rather than paginating past it.
- Timeouts return
"incomplete_results": true — treat as partial, re-run narrower.
Playbook: "find a repo/framework that does X"
- Name the concept 3 ways. The canonical term, the practitioner term, the
topic-slug guess (e.g. "ML system design doc" / "design doc template" /
ml-system-design).
- Topic first:
topic:<slug> — topics are human-curated, low-noise. Check
the topic page (github.com/topics/<slug>) for sibling topics.
- Then readme/description:
"exact phrase" in:name,description,readme stars:>50 archived:false.
Quoted phrases beat keyword soup.
- Then code search for distinctive strings a matching project would contain
(a config key, a template heading, an import) — finds repos whose README
doesn't use your vocabulary.
- Harvest awesome-lists from steps 2–3 hits:
awesome <concept> in:name —
mine them for candidates, but never cite a list as the answer itself.
- Cross-check with general web search (blog posts, "top N repos" articles)
— catches repos GitHub search ranks poorly.
- Verify every candidate before recommending: fetch the repo page/README;
record purpose, license, stars, last push (
pushed: or the page header),
and whether it actually does X vs. documents X. Classify: does-the-thing /
template-for-the-thing / knowledge-about-the-thing / adjacent.
- Record the query matrix (angle → query → best hit) in your research notes
so the search is reproducible.
Pitfalls
sort:stars inside the query string silently does nothing on the API — use the sort param.
- Repo search only sees the default branch README/description; code search only indexes default branches too.
in:readme matches forks' inherited READMEs — add fork:false (default) or check the fork badge.
- Stars measure marketing as much as quality — always pair
stars: with pushed: recency.
- Unauthenticated code-search API calls fail — fall back to the web UI via WebFetch.
1---2name: github-search3description: Search GitHub effectively — repositories, code, and topics — using the official GitHub docs' search syntax. Use when hunting for a repo/framework/library that does X, locating code patterns across public GitHub, or building a discovery query matrix for research. Covers repository search qualifiers, the code-search syntax (boolean/regex/path/symbol), the REST search API with rate limits, and a repeatable find-a-framework playbook. Grounded in docs.github.com (fetched 2026-07); re-fetch the linked docs pages if a qualifier seems to misbehave.4---56# GitHub Search78## Overview910GitHub is the largest index of working software, but naive keyword queries surface11SEO'd awesome-lists and abandoned forks. This skill encodes the official search12syntax from the GitHub docs plus a discovery playbook, so an agent can go from13"is there a framework that does X?" to a verified shortlist in a few queries.1415Three search surfaces, pick by task:1617| Surface | Use for | How |18|---|---|---|19| Web search UI (`github.com/search`) | Repo discovery, topic browsing | WebFetch/WebSearch on `github.com/search?q=...&type=repositories` |20| REST API (`api.github.com/search/*`) | Scripted/sorted/paginated discovery | `curl` (token optional but raises limits) |21| `gh` CLI | Same as REST, ergonomic | `gh search repos`, `gh search code` |2223> **Remote-session caveat:** in Claude Code on the web, GitHub MCP tools24> (`mcp__github__search_*`) are often **scoped to the session's repos only** — do25> not use them to search public GitHub there. Use WebSearch/WebFetch or26> unauthenticated `curl` to `api.github.com` instead.2728Source docs (re-fetch these if syntax seems off):29- Repos: <https://docs.github.com/en/search-github/searching-on-github/searching-for-repositories>30- Code: <https://docs.github.com/en/search-github/github-code-search/understanding-github-code-search-syntax>31- REST: <https://docs.github.com/en/rest/search/search>32- Topics: <https://docs.github.com/en/search-github/searching-on-github/searching-topics>3334---3536## Repository search qualifiers3738Combine free keywords with qualifiers; whitespace = AND.3940| Goal | Qualifier | Example |41|---|---|---|42| Match in name/description/readme | `in:name`, `in:description`, `in:readme`, `in:topics` | `"design doc" in:name,description` |43| By topic label | `topic:TOPIC` | `topic:ml-system-design` |44| Popularity floor | `stars:>n`, `stars:n..n` | `stars:>500` |45| Recently maintained | `pushed:>YYYY-MM-DD` | `pushed:>2025-06-01` |46| Created window | `created:<YYYY-MM-DD` | `created:>2024-01-01` |47| Language / license | `language:LANG`, `license:KEY` | `language:python license:mit` |48| Owner scope | `user:U`, `org:O`, `repo:O/R` | `org:stanford-cs329s` |49| Forks / archived / template | `fork:true`, `archived:false`, `template:true` | `archived:false` |50| Size (KB) | `size:>n` | `size:>1000` |5152Sorting: on the REST API / `gh`, use the separate `sort` (`stars`, `forks`,53`updated`) and `order` params — do **not** put `sort:` inside the query string.5455## Code search syntax (github.com/search?type=code)5657- **Exact match:** quote it — `"sparse index"`; escape inner quotes `\"`.58- **Boolean:** `AND`, `OR`, `NOT` (adjacent terms default to AND) —59 `"fatal error" NOT path:__testing__`; parentheses for grouping.60- **Regex:** slashes — `/sparse.*index/`, `/^App\/src\//`. No look-around.61 Case-insensitive by default; force case with `/(?-i)True/`.62- **Qualifiers:** `repo:owner/name`, `org:`, `user:`, `language:`,63 `path:` (globs: `path:/src/**/*.js`), `symbol:FunctionName` (definitions),64 `content:` (contents only, not filenames), `is:archived|fork|generated`.65- Code search on the **API** requires authentication and at least one plain66 search term.6768## REST API essentials6970```bash71# Repositories (works unauthenticated at low volume)72curl -s "https://api.github.com/search/repositories?q=topic:ml-system-design+stars:>100&sort=stars&order=desc&per_page=10" \73 | jq -r '.items[] | "\(.stargazers_count)\t\(.full_name)\t\(.description)"'7475# Topics76curl -s "https://api.github.com/search/topics?q=ml-system-design" | jq '.items[].name'7778# Authenticated (higher limits + code search)79curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \80 "https://api.github.com/search/code?q=%22design_doc_checklist%22+language:markdown"81```8283Endpoints: `/search/repositories`, `/search/code`, `/search/topics`,84`/search/issues`, `/search/commits`, `/search/users` — all take `q`, `sort`,85`order`, `per_page` (max 100), `page`.8687**Limits (from the docs — respect them):**88- Authenticated: 30 req/min; **code search: 9 req/min**; unauthenticated: 10 req/min total.89- Query: max 256 chars, max five `AND/OR/NOT` operators; URL-encode `q` (`>` → `%3E`, quotes → `%22`, space → `+`).90- Max **1,000 results** per query — narrow with qualifiers rather than paginating past it.91- Timeouts return `"incomplete_results": true` — treat as partial, re-run narrower.9293---9495## Playbook: "find a repo/framework that does X"96971. **Name the concept 3 ways.** The canonical term, the practitioner term, the98 topic-slug guess (e.g. "ML system design doc" / "design doc template" /99 `ml-system-design`).1002. **Topic first:** `topic:<slug>` — topics are human-curated, low-noise. Check101 the topic page (`github.com/topics/<slug>`) for sibling topics.1023. **Then readme/description:** `"exact phrase" in:name,description,readme stars:>50 archived:false`.103 Quoted phrases beat keyword soup.1044. **Then code search for distinctive strings** a matching project would contain105 (a config key, a template heading, an import) — finds repos whose README106 doesn't use your vocabulary.1075. **Harvest awesome-lists** from steps 2–3 hits: `awesome <concept> in:name` —108 mine them for candidates, but never cite a list as the answer itself.1096. **Cross-check with general web search** (blog posts, "top N repos" articles)110 — catches repos GitHub search ranks poorly.1117. **Verify every candidate** before recommending: fetch the repo page/README;112 record purpose, license, stars, last push (`pushed:` or the page header),113 and whether it *actually does X* vs. documents X. Classify: does-the-thing /114 template-for-the-thing / knowledge-about-the-thing / adjacent.1158. **Record the query matrix** (angle → query → best hit) in your research notes116 so the search is reproducible.117118## Pitfalls119120- `sort:stars` inside the query string silently does nothing on the API — use the `sort` param.121- Repo search only sees the *default branch* README/description; code search only indexes default branches too.122- `in:readme` matches forks' inherited READMEs — add `fork:false` (default) or check the fork badge.123- Stars measure marketing as much as quality — always pair `stars:` with `pushed:` recency.124- Unauthenticated code-search API calls fail — fall back to the web UI via WebFetch.