Claude-skill-registry gh-search-issues
Use when searching GitHub issues ACROSS REPOSITORIES or organizations - provides syntax for filtering by labels, state, assignees, authors, comments, reactions, dates. For current repo issues, use gh issue list instead.
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-issues" ~/.claude/skills/majiayu000-claude-skill-registry-gh-search-issues && rm -rf "$T"
skills/data/gh-search-issues/SKILL.mdGitHub CLI: Search Issues
Overview
Search for issues across GitHub repositories using
gh search issues. Add --include-prs flag to also search pull requests.
⚠️ CRITICAL: Search vs List Commands
- GitHub-wide search (THIS SKILL):gh search issues
- Searches across multiple repositories or organizations
- Searches in specific repos outside your current directory
- Uses GitHub's search query syntax with qualifiers
- Examples: "Find issues in the microsoft organization", "Search for bugs in kubernetes repos"
- Current repository only (NOT THIS SKILL):gh issue list
- Lists issues in your current working directory's repo
- Uses simple flag-based filtering
- Examples: "Show my issues in this repo", "List open bugs here"
When user says "my issues" or "issues here" → Use
(NOT this skill)
When user specifies repo/org or cross-repo search → Use gh issue list
(THIS skill)gh search issues
When to Use This Skill
Use this skill when the user explicitly indicates:
- Searching across multiple repositories or organizations
- Searching in a specific repo (e.g., "in kubernetes/kubernetes")
- Cross-GitHub searches (e.g., "all my open issues across GitHub")
- Complex queries needing search qualifiers (e.g., "comments>50 across microsoft repos")
DO NOT use this skill when:
- User asks about "issues in this repo" or "my issues here"
- No repo/org is specified and context is clearly current repository
- Use
for current repo operations insteadgh issue list
Syntax
gh search issues [<query>] [flags]
Key Flags Reference
User Filters
| Flag | Purpose | Example |
|---|---|---|
| Created by user | |
| Assigned to user | |
| Mentions specific user | |
| Commented by user | |
| Mentions team | |
Issue Attributes
| Flag | Purpose | Example |
|---|---|---|
| Has specific labels | |
| Issue state: open or closed | |
| In specific milestone | |
| Locked conversation | |
| Has no labels | |
Repository Filters
| Flag | Purpose | Example |
|---|---|---|
| Repository owner | |
| Specific repository | |
| Repository language | |
| Repo visibility | |
| In archived repos | |
Engagement Metrics
| Flag | Purpose | Example |
|---|---|---|
| Number of comments | |
| Reaction count | |
| Comments + reactions | |
Date Filters
| Flag | Purpose | Example |
|---|---|---|
| Creation date | |
| Last update date | |
| Close date | |
Search Scope
| Flag | Purpose | Example |
|---|---|---|
| Search in: title, body, comments | |
| Include pull requests | |
Output & Sorting
| Flag | Purpose | Example |
|---|---|---|
| Max results (default: 30) | |
| Sort by: comments, created, reactions, etc. | |
| Sort direction: asc or desc | |
| JSON output | |
| Open in browser | |
JSON Output Fields
assignees, author, authorAssociation, body, closedAt, commentsCount, createdAt, id, isLocked, isPullRequest, labels, number, repository, state, title, updatedAt, url
Exclusion Syntax (Critical!)
When using inline query exclusions (negations with
-), you MUST use the -- separator:
✅ Correct:
gh search issues -- "search-terms -qualifier:value"
❌ Wrong: gh search issues "search-terms" --flag=-value
❌ Wrong: gh search issues "search-terms" --flag=!value
❌ Wrong: gh search issues --label!=bug
Examples:
(exclude label)gh search issues -- "bug -label:wontfix"
(exclude assignee)gh search issues -- "crash -assignee:olduser"
(exclude author)gh search issues -- "error -author:bot"
(exclude milestone)gh search issues -- "performance -milestone:v1.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 issues "bug" --label urgent --state open
Query Syntax with
(required for exclusions):--
gh search issues -- "bug -label:duplicate -label:wontfix"
⚠️ 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 label gh search issues -- "bug -label:duplicate" # Exclude specific assignee gh search issues -- "crash -assignee:olduser"
Multiple exclusions:
# Exclude multiple labels gh search issues -- "bug -label:duplicate -label:wontfix" # Exclude author and label gh search issues -- "performance -author:bot -label:invalid"
Combine with positive filters using flags:
# Wrong - mixing syntaxes: gh search issues "bug" --state open -label:duplicate # ❌ # Correct - use query syntax for everything when excluding: gh search issues -- "bug state:open -label:duplicate" # ✅
PowerShell exclusions:
# Use --% to prevent PowerShell parsing gh --% search issues -- "bug -label:duplicate"
Common Exclusion Patterns:
| User Request | Command |
|---|---|
| "Find bugs but not duplicates" | |
| "Issues not assigned to anyone" | (use instead) |
| "Open issues excluding specific label" | |
| "Issues excluding multiple labels" | |
| "Issues not in milestone" | |
| "Issues not by bot authors" | |
2. Special Values
- Current authenticated user@megh search issues --assignee @me --state open
3. Quoting Rules
Multi-word search:
gh search issues "memory leak"
Labels with spaces:
gh search issues -- 'crash label:"bug fix"'
Comparison operators need quotes:
gh search issues "performance" --comments ">10"
Common Use Cases
Find your open issues across all of GitHub:
gh search issues --author @me --state open
Find unassigned bugs in a specific org:
gh search issues --label bug --no-assignee --state open --owner kubernetes
Find highly discussed issues in a specific repo:
gh search issues --comments ">50" --state open --repo microsoft/vscode
Find stale issues across multiple repos:
gh search issues --state open --updated "<2023-01-01" --owner myorg
Search issues AND PRs in an organization:
gh search issues "authentication" --include-prs --state open --owner github
Exclude specific labels in cross-repo search:
gh search issues -- "crash -label:duplicate -label:wontfix" --repo cli/cli
Find issues in milestone across repos:
gh search issues --milestone v2.0 --state open --owner golang
Find issues by title only in specific language repos:
gh search issues "error in:title" --state open --language rust
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: |
| Invalid prefix | Use or drop : |
| Not quoting comparisons | Shell interprets | Quote: |
outside quotes | Shell parsing error | Quote query: |
Forgetting | Misses pull requests | Add: |
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:..
or10..502024-01-01..2024-12-31
Field Qualifiers
Use
in: to search specific fields:
- Search in title onlyin:title
- Search in body onlyin:body
- Search in comments onlyin:comments
Example:
gh search issues "crash in:title" --state open
Related
- GitHub search syntax: https://docs.github.com/search-github/searching-on-github/searching-issues-and-pull-requests
- For searching other resources:
,gh-search-code
,gh-search-commits
,gh-search-prsgh-search-repos