Claude
Skills
Sign in
Back

gt:github

Included with Lifetime
$97 forever

Read or search GitHub (issues, PRs, review threads, comments, code, notifications) and analyze GitHub Actions (workflow runs, billing, costs, failures, rerun/cancel). Use on any GitHub URL or repo lookup. Not for implementing code fixes or PR feedback — use gt:github-pr.

Cloud & DevOpsscripts

What this skill does


# GitHub Tool Usage Guide

Search, fetch, and analyze GitHub issues, PRs, and comments with caching.

## Quick Reference

| Task | Command |
|------|---------|
| List unread notifications | `tools github notifications` |
| Notifications for a repo | `tools github notifications -r owner/repo` |
| Open unread mentions | `tools github notifications --reason mention --open` |
| Mark notifications read | `tools github notifications --mark-read` |
| Activity feed (last 7d) | `tools github activity --since 7d` |
| Activity for specific user | `tools github activity -u username` |
| Search with min stars | `tools github search "query" --min-stars 1000` |
| Search repositories | `tools github search "query" --type repo --sort stars` |
| Get issue with comments | `tools github issue <url>` |
| Get last 5 comments | `tools github issue <url> --last 5` |
| Comments since specific one | `tools github comments <url>#issuecomment-123 --since 123` |
| Filter issue by body reactions | `tools github issue <url> --min-reactions 10` |
| Filter comments by reactions | `tools github issue <url> --min-comment-reactions 5` |
| Filter by positive reactions | `tools github issue <url> --min-reactions-positive 3` |
| Exclude bots | `tools github issue <url> --no-bots` |
| Search with min reactions | `tools github search "bug" --repo owner/repo --min-reactions 10` |
| Search issues | `tools github search "error" --repo owner/repo --state open` |
| Get PR with review comments | `tools github pr <url> --review-comments` |
| Check auth status | `tools github status` |
| Get file content | `tools github get <file-url>` |
| Get specific lines | `tools github get <file-url> --lines 10-50` |
| Get file to clipboard | `tools github get <file-url> -c` |
| List workflow runs | `gh run list --repo owner/repo --created YYYY-MM-DD --limit 200` |
| CI cost breakdown | `bun <skill-dir>/scripts/actions-cost.ts --repo owner/repo --date YYYY-MM-DD` |
| Cross-repo cost scan | `bun <skill-dir>/scripts/actions-cost.ts --org <org> --date YYYY-MM-DD --cross-repo` |
| Cost per branch | `bun <skill-dir>/scripts/actions-cost.ts --repo owner/repo --branch <branch> --from YYYY-MM-DD --to YYYY-MM-DD` |
| Re-run failed jobs | `gh run rerun <run-id> --failed` |
| Cancel a run | `gh run cancel <run-id>` |
| Cache usage | `gh api /repos/{owner}/{repo}/actions/cache/usage` |

## URL Parsing

The tool automatically parses these URL formats:
- `https://github.com/owner/repo/issues/123`
- `https://github.com/owner/repo/pull/456`
- `https://github.com/owner/repo/issues/123#issuecomment-789`
- `owner/repo#123` (shorthand)
- `#123` or `123` (when in a git repo)

When user provides a URL with `#issuecomment-XXX`, use `--since XXX` to fetch from that point.

## Get File Content

Fetch raw file content from any GitHub file URL.

### Supported URL Formats
- `https://github.com/owner/repo/blob/branch/path/to/file`
- `https://github.com/owner/repo/blob/tag/path/to/file`
- `https://github.com/owner/repo/blob/commit/path/to/file`
- `https://github.com/owner/repo/blame/ref/path/to/file`
- `https://raw.githubusercontent.com/owner/repo/ref/path/to/file`
- `https://raw.githubusercontent.com/owner/repo/refs/heads/branch/path`
- `https://raw.githubusercontent.com/owner/repo/refs/tags/tag/path`
- All above with `#L10` or `#L10-L20` line references

### Examples
```bash
# Get file from blob URL
tools github get https://github.com/facebook/react/blob/main/package.json

# Get specific lines from a file
tools github get https://github.com/owner/repo/blob/main/src/index.ts --lines 10-50

# Get file from blame URL
tools github get https://github.com/owner/repo/blame/v1.0.0/README.md

# Get file from raw URL
tools github get https://raw.githubusercontent.com/owner/repo/main/data.json

# Override the ref to get a different version
tools github get https://github.com/owner/repo/blob/main/file.ts --ref v2.0.0

# Copy to clipboard instead of stdout
tools github get https://github.com/owner/repo/blob/main/file.ts -c

# URL with line references (quotes needed for shell)
tools github get "https://github.com/owner/repo/blob/main/file.ts#L10-L20"

# Faster fetch via raw URL (skips API, less metadata)
tools github get https://github.com/owner/repo/blob/main/file.ts --raw
```

## Common Use Cases

### Get Issue/PR Details
```bash
# Fetch issue with first 30 comments
tools github issue https://github.com/anthropics/claude-code/issues/123

# Fetch PR with all comments
tools github pr https://github.com/owner/repo/pull/456 --all
```

### Filter Comments
```bash
# Last 10 comments only
tools github issue <url> --last 10

# Exclude bot comments
tools github issue <url> --no-bots

# Only comments with 5+ total reactions
tools github issue <url> --min-comment-reactions 5

# Only comments with positive reactions
tools github issue <url> --min-comment-reactions-positive 3

# Issue must have 10+ body reactions (skips if below threshold)
tools github issue <url> --min-reactions 10

# Comments by specific author
tools github issue <url> --author username

# Comments after a date
tools github issue <url> --after 2025-01-15
```

### Get Updates Since Comment X
```bash
# When user shares URL with comment anchor
tools github comments "https://github.com/owner/repo/issues/123#issuecomment-789" --since 789

# Or just specify the ID
tools github issue <url> --since 789
```

### Search Issues/PRs
```bash
# Search open issues
tools github search "memory leak" --repo anthropics/claude-code --state open

# Search PRs only
tools github search "refactor" --type pr --repo owner/repo

# Sort by reactions
tools github search "bug" --sort reactions --limit 50

# Search with minimum reaction count on issue/PR
tools github search "feature request" --repo owner/repo --min-reactions 5

# Search with minimum comment reactions (uses GraphQL, slower)
tools github search "bug" --repo owner/repo --min-comment-reactions 3

# Use only advanced or legacy search backend
tools github search "error" --repo owner/repo --advanced
tools github search "error" --repo owner/repo --legacy
```

### Search Repositories
```bash
# Search for repos matching a topic/query
tools github search "react state management" --type repo

# Filter by language
tools github search "http client" --type repo --language typescript

# Sort by stars
tools github search "machine learning" --type repo --sort stars -L 20

# Minimum star count (shorthand for stars:>=N)
tools github search "cli" --type repo --min-stars 1000

# Combine qualifiers in query (GitHub native syntax)
tools github search "topic:react stars:>5000" --type repo
```

### Search Code (Files)
```bash
# Search for code containing text
tools github code "useState" --repo facebook/react

# Filter by path
tools github code "async function" --repo expo/expo --path "packages/**/*.ts"

# Filter by language
tools github code "interface Props" --repo vercel/next.js --language typescript
```

### Search Syntax Tips

**For Issues/PRs** (`tools github search`):
- Searches both issues and PRs by default
- Use `--type issue` or `--type pr` to filter
- Use `--type repo` to search GitHub repositories instead (uses `/search/repositories`)
- Use `--repo owner/repo` to limit to a repository
- Use `--state open|closed` to filter by state
- Use `--sort reactions|comments|created|updated` to sort results (issues/PRs)
- Use `--sort stars|forks|updated|help-wanted-issues` to sort repos

**For Code** (`tools github code`):
- **Recommended: specify `--repo`** for best results (API limitation)
- Use `--path "src/**/*.ts"` for path patterns
- Use `--language typescript` for language filtering
- Only searches default branch
- Files must be < 384 KB

**Query Examples:**
| Goal | Command |
|------|---------|
| Find open bugs in repo | `tools github search "bug" --repo owner/repo --type issue --state open` |
| Find PRs mentioning feature | `tools github search "dark mode" --repo owner/repo --type pr` |
| Find top TypeScript repos | `tools github search "http client" --type repo --langu

Related in Cloud & DevOps