Claude-skill-registry gh-search-repos
Use when searching for repositories across GitHub - provides syntax for filtering by stars, forks, language, topics, license, archived status, and all repository attributes
git clone https://github.com/majiayu000/claude-skill-registry
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/gh-search-repos" ~/.claude/skills/majiayu000-claude-skill-registry-gh-search-repos && rm -rf "$T"
skills/data/gh-search-repos/SKILL.mdGitHub CLI: Search Repositories
Overview
Search for repositories across GitHub using
gh search repos. Filter by stars, forks, language, topics, license, and more.
When to Use This Skill
Use this skill when searching for repositories across GitHub:
- Finding repositories by popularity (stars/forks)
- Searching by programming language or topics
- Finding repos with good first issues
- Filtering by license or archived status
- Searching in specific organizations or by owner
- Need to exclude certain results (requires
flag)--
Syntax
gh search repos [<query>] [flags]
Key Flags Reference
Repository Attributes
| Flag | Purpose | Example |
|---|---|---|
| Programming language | |
| Repository topics | |
| License type | |
| Archived state | |
| Repository owner | |
| Visibility: public, private, internal | |
Popularity Metrics
| Flag | Purpose | Example |
|---|---|---|
| Star count | |
| Fork count | |
| Follower count | |
| Size in KB | |
Issue Counts
| Flag | Purpose | Example |
|---|---|---|
| "Good first issue" label count | |
| "Help wanted" label count | |
Date Filters
| Flag | Purpose | Example |
|---|---|---|
| Creation date | |
| Last update date | |
Search Scope
| Flag | Purpose | Example |
|---|---|---|
| Search in: name, description, readme | |
| Include/exclude forks | |
Output & Sorting
| Flag | Purpose | Example |
|---|---|---|
| Max results (default: 30) | |
| Sort by: stars, forks, updated, etc. | |
| Sort direction: asc or desc | |
| JSON output | |
| Open in browser | |
JSON Output Fields
createdAt, defaultBranch, description, forksCount, fullName, hasDownloads, hasIssues, hasPages, hasProjects, hasWiki, homepage, id, isArchived, isDisabled, isFork, isPrivate, language, license, name, openIssuesCount, owner, pushedAt, size, stargazersCount, updatedAt, url, visibility, watchersCount
Exclusion Syntax (Critical!)
When using inline query exclusions (negations with
-), you MUST use the -- separator:
✅ Correct:
gh search repos -- "search-terms -qualifier:value"
❌ Wrong: gh search repos "search-terms" --flag=-value
❌ Wrong: gh search repos "search-terms" --flag=!value
❌ Wrong: gh search repos --language=-Go
Examples:
(exclude language)gh search repos -- "cli -language:go"
(exclude archived)gh search repos -- "starter -archived:true"
(exclude topic)gh search repos -- "web -topic:deprecated"
(exclude license)gh search repos -- "library -license:gpl-3.0"
Why the
separator is required:
The --
-- tells the shell to stop parsing flags and treat everything after it as arguments. Without it, -qualifier:value inside quotes may be misinterpreted.
Critical Syntax Rules
When to Use Flag Syntax vs Query Syntax
Decision Tree:
Does your search include: - Any exclusions (NOT, minus, without, except)? → Use Query Syntax with `--` - Complex boolean logic (OR, AND)? → Use Query Syntax with `--` Otherwise: - Simple positive filters only? → Use Flag Syntax
Flag Syntax (for positive filters):
gh search repos "cli" --language go --stars ">100"
Query Syntax with
(required for exclusions):--
gh search repos -- "cli -language:javascript -archived:true"
⚠️ NEVER mix both syntaxes in a single command!
1. Exclusions and Negations
CRITICAL: When excluding results, you MUST use query syntax with the
-- separator.
Exclusion Syntax Rules:
- Use the
separator before your query-- - Use
format (dash prefix for negation)-qualifier:value - Quote the entire query string
Examples:
Single exclusion:
# Exclude specific language gh search repos -- "web framework -language:javascript" # Exclude archived repos gh search repos -- "cli tool -archived:true"
Multiple exclusions:
# Exclude multiple languages gh search repos -- "game engine -language:javascript -language:python" # Exclude archived and small repos gh search repos -- "starter -archived:true -stars:<10"
Combine with positive filters using flags:
# Wrong - mixing syntaxes: gh search repos "cli" --language go -archived:true # ❌ # Correct - use query syntax for everything when excluding: gh search repos -- "cli language:go -archived:true" # ✅
PowerShell exclusions:
# Use --% to prevent PowerShell parsing gh --% search repos -- "cli -language:javascript"
Common Exclusion Patterns:
| User Request | Command |
|---|---|
| "Find repos but not archived" | |
| "Repos excluding specific language" | |
| "Repos not in specific topic" | |
| "Repos excluding multiple languages" | |
| "Repos not forks" | (or use ) |
| "Repos excluding low stars" | |
| "Repos not with specific license" | |
2. Special Values
- Multiple topics:
--topic unix,terminal - Boolean flags:
or--archived false--archived true - Fork inclusion:
--include-forks false|true|only
3. Quoting Rules
Multi-word search:
gh search repos "machine learning"
Comparison operators need quotes:
gh search repos "python" --stars ">1000"
Ranges use quotes:
gh search repos "cli" --stars "100..500"
Common Use Cases
Find popular Python repos:
gh search repos "data science" --language python --stars ">5000"
Find repos with good first issues:
gh search repos --language javascript --good-first-issues ">=10"
Find recently updated repos:
gh search repos "react" --updated ">2024-01-01" --stars ">100"
Find repos by topic:
gh search repos --topic machine-learning --language python
Find repos by license:
gh search repos "web framework" --license mit,apache-2.0
Exclude archived repos:
gh search repos "cli tool" --archived false
Find repos by organization:
gh search repos --owner microsoft --visibility public
Exclude forks:
gh search repos "starter" --include-forks false
Find only forks:
gh search repos "template" --include-forks only
Find repos in star range:
gh search repos "game engine" --stars "100..1000"
Exclude specific language:
gh search repos -- "cli -language:go"
Search in name only:
gh search repos "awesome" --match name
Common Mistakes
| Mistake | Problem | Fix |
|---|---|---|
or | Flag syntax doesn't support negation | Use query: or |
| interpreted as flag | Use : |
| keyword doesn't work | Use : |
Mixing syntaxes: | Can't mix flags with query qualifiers | Use query for all: |
| Not quoting comparisons | Shell interprets | Quote: |
| Invalid value | Use boolean: or |
| Not quoting multi-word search | Searches separately | Quote: |
Using with owner | Invalid syntax | Drop : |
PowerShell without | Breaks with exclusions | Add: |
Installation Check
If
gh command not found:
# Check if gh is installed which gh # Install: https://cli.github.com/manual/installation
If not authenticated:
# Authenticate with GitHub gh auth login
Comparison Operators
- Greater than>
- Greater than or equal>=
- Less than<
- Less than or equal<=
- Range:..
or100..10002024-01-01..2024-12-31
Common Licenses
- MIT Licensemit
- Apache License 2.0apache-2.0
- GNU GPL v3gpl-3.0
- BSD 2-Clausebsd-2-clause
- BSD 3-Clausebsd-3-clause
- Mozilla Public License 2.0mpl-2.0
- ISC Licenseisc
Match Field Options
- Search repository names onlyname
- Search descriptions onlydescription
- Search README files onlyreadme
Example:
gh search repos "documentation" --match readme
Related
- GitHub search syntax: https://docs.github.com/search-github/searching-on-github/searching-for-repositories
- For searching other resources:
,gh-search-code
,gh-search-commits
,gh-search-issuesgh-search-prs