gh-search

Use when searching GitHub via CLI for issues, PRs, repos, code, or commits - provides correct syntax for exclusions, qualifiers, quoting, and platform-specific handling to avoid command failures

16 stars

Best use case

gh-search is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Use when searching GitHub via CLI for issues, PRs, repos, code, or commits - provides correct syntax for exclusions, qualifiers, quoting, and platform-specific handling to avoid command failures

Teams using gh-search should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/gh-search/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/tools/gh-search/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/gh-search/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How gh-search Compares

Feature / Agentgh-searchStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Use when searching GitHub via CLI for issues, PRs, repos, code, or commits - provides correct syntax for exclusions, qualifiers, quoting, and platform-specific handling to avoid command failures

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# GitHub CLI Search

## Overview

Search GitHub from the command line using `gh search` subcommands. The key principle: **Always use `--` before queries with exclusions** to prevent shell interpretation of `-` prefixes.

## When to Use

Use this skill when:
- Searching GitHub via `gh` CLI for issues, PRs, repos, code, or commits
- User requests searches with exclusions (NOT, minus prefix)
- Constructing complex queries with multiple qualifiers
- Queries contain spaces or special characters

## Subcommands Quick Reference

| Subcommand | Use For | Common Flags |
|------------|---------|--------------|
| `gh search issues` | Issues (add `--include-prs` for PRs too) | `--label`, `--state`, `--author`, `--assignee` |
| `gh search prs` | Pull requests only | `--label`, `--state`, `--author`, `--draft`, `--merged` |
| `gh search repos` | Repositories | `--language`, `--stars`, `--topic`, `--owner` |
| `gh search code` | Code within files | `--repo`, `--language`, `--filename` |
| `gh search commits` | Commit messages | `--repo`, `--author`, `--committer` |

## Critical Syntax Rules

### 1. Exclusions Require `--` Flag

**Unix/Linux/Mac:**
```bash
gh search issues -- "bug -label:duplicate"
```

**PowerShell:**
```powershell
gh --% search issues -- "bug -label:duplicate"
```

**Why:** The `-` prefix gets interpreted as a command flag without `--`. PowerShell needs `--% ` to stop parsing.

### 2. Quoting Rules

**Multi-word queries need quotes:**
```bash
gh search issues "memory leak"
```

**Entire query with spaces should be quoted:**
```bash
gh search issues "bug label:urgent created:>2024-01-01"
```

**Qualifier values with spaces need inner quotes:**
```bash
gh search prs -- 'security label:"bug fix"'
```

### 3. Qualifier Syntax

**Inline qualifiers** (use within search query):
```bash
gh search repos "react stars:>1000 language:typescript"
```

**Flag-based** (use as separate flags):
```bash
gh search repos "react" --language typescript --stars ">1000"
```

**Can mix both:**
```bash
gh search issues "crash" --label bug created:>2024-01-01
```

## Common Qualifiers

### Comparison Operators
- `>`, `>=`, `<`, `<=` - Numeric: `stars:>100`, `comments:>=5`
- `..` - Ranges: `stars:10..50`, `created:2024-01-01..2024-12-31`

### Special Values
- `@me` - Current user: `author:@me`, `assignee:@me`, `owner:@me`
- Dates use ISO8601: `created:>2024-01-01` or `created:2024-01-01..2024-12-31`

### Field-Specific Search
- `in:title` - Search in title only
- `in:body` - Search in body only
- `in:comments` - Search in comments only

### Exclusions
- `-qualifier:value` - Exclude: `-label:bug`, `-language:javascript`
- `NOT` keyword - For words only: `"hello NOT world"`

## Examples

**Find your open issues without bug label:**
```bash
gh search issues -- "is:open author:@me -label:bug"
```

**Find popular Python ML repos updated recently:**
```bash
gh search repos "machine learning" --language python --stars ">1000" --updated ">2024-01-01"
```

**Find PRs with specific label and text:**
```bash
gh search prs -- 'security label:"bug fix" created:>2024-01-01'
```

**Search code in organization repos:**
```bash
gh search code "TODO" --owner myorg --language javascript
```

## Common Mistakes

| Mistake | Problem | Fix |
|---------|---------|-----|
| `gh search issues -label:bug` | `-label` interpreted as flag | Add `--`: `gh search issues -- "-label:bug"` |
| `gh search repos machine learning` | Searches "machine" OR "learning" | Quote it: `"machine learning"` |
| `in:title` outside quotes | Shell interprets `:` oddly | Include in query: `"crash in:title"` |
| Mixing `@` with value | Invalid syntax | Use `@me` or username, not both: `author:@me` ✓, `author:@username` ✗ (drop @) |
| PowerShell without `--%` | Parsing breaks with exclusions | Add `gh --%` before command |

## Output Options

All subcommands support:
- `--limit <n>` - Max results (default: 30, max: 1000)
- `--json <fields>` - JSON output for scripting
- `--web` - Open results in browser
- `--sort <field>` - Sort by: comments, created, reactions, updated, stars, etc.
- `--order asc|desc` - Sort direction (default: desc)

## Real-World Impact

Correct syntax prevents:
- Command failures from misinterpreted flags
- Missing results from incorrect exclusions
- Errors from unquoted spaces
- Platform-specific parsing issues

Related Skills

github-search

16
from diegosouzapw/awesome-omni-skill

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.

ethereum-proposal-researcher

16
from diegosouzapw/awesome-omni-skill

Deep research and analysis of Ethereum proposals from ethresear.ch, evaluating technical impacts, improvement opportunities, and technical debt implications for existing projects.

dev-swarm-stage-market-research

16
from diegosouzapw/awesome-omni-skill

Conduct comprehensive market research and competitive analysis to validate the problem, understand the market landscape, and identify opportunities. Use when starting stage 01 (market-research) or when user asks about competitors or market analysis.

composio-search-automation

16
from diegosouzapw/awesome-omni-skill

Automate Composio Search tasks via Rube MCP (Composio). Always search tools first for current schemas.

amazon-category-research

16
from diegosouzapw/awesome-omni-skill

Research profitable Amazon KDP categories for book publishing. This skill should be used when planning a book launch, analyzing competition, or optimizing category selection for discoverability. Guides the 3-category decision with BSR analysis and ghost category avoidance.

ai-research

16
from diegosouzapw/awesome-omni-skill

Automates AI briefing preparation and technology research. Use for regular updates on AI trends, tools, and models relevant to the job search.

tag-based-search

16
from diegosouzapw/awesome-omni-skill

Code tagging system using @FEAT, @COMP, @TYPE tags for easy discovery and navigation. Use when adding documentation tags or searching for related code across the codebase.

amazon-product-search-recommender

16
from diegosouzapw/awesome-omni-skill

When the user wants to search for specific products on Amazon within budget constraints and generate structured recommendations. This skill navigates to Amazon.com, performs targeted searches using specific criteria (price range, material, color), browses search results, extracts product details (title, price, store/brand, URL), and compiles recommendations into a structured JSON format. Triggers include requests for product recommendations, shopping assistance, budget-constrained searches, or when users need to find specific items on Amazon with detailed specifications.

advanced-text-search-matching

16
from diegosouzapw/awesome-omni-skill

Production-grade text search algorithms for finding and matching text in large documents with millisecond performance. Includes Boyer-Moore search, n-gram similarity, fuzzy matching, and intelligent indexing. Use when building search features for large documents, finding quotes with imperfect matches, implementing fuzzy search, or need character-level precision.

rey-web-search

16
from diegosouzapw/awesome-omni-skill

Quick web search for information. Returns top results with summaries. Use when user says "search", "look up", "find info about".

jekyll-research-theme

16
from diegosouzapw/awesome-omni-skill

Create production-grade, accessible Jekyll themes for researchers conducting "research in public." Generates complete lab notebook-style themes with Tufte-inspired sidenotes, KaTeX math rendering, and WCAG 2.1 AA compliance. Use when building Jekyll themes for scientific journals, experiment logs, field notes, or research documentation sites. Supports collections for organizing experiments and field notes, responsive sidenote rendering (sidebar on desktop, inline on mobile), and full-width layout options.

hig-components-search

16
from diegosouzapw/awesome-omni-skill

Apple HIG guidance for navigation-related components including search fields, page controls, and path controls.