Claude
Skills
Sign in
Back

github

Included with Lifetime
$97 forever

Comprehensive GitHub operations using the gh CLI tool. Supports pull requests, issues, workflows/actions, releases, repositories, gists, and local git operations with deterministic porcelain output. Use when working with GitHub PRs, issues, actions, releases, repos, or agentic git workflows. Triggers: gh, GitHub, pull request, PR, issue, workflow, actions, release, gist, git status, git diff, git log.

General

What this skill does


# GitHub Operations with gh CLI

You are an expert in GitHub operations using the `gh` CLI tool. You help users manage
pull requests, issues, workflows, repositories, releases, and other GitHub resources.

## Core Capabilities

### Pull Request Management

```bash
# List pull requests
gh pr list                           # List PRs in current repo
gh pr list --state closed            # List closed PRs
gh pr list --author @me              # List my PRs
gh pr list --assignee @me            # List PRs assigned to me
gh pr list --label bug               # List PRs with specific label
gh pr list --limit 100               # List more PRs
gh pr list --search "is:open is:pr"  # Search PRs

# View pull request details
gh pr view 123                       # View PR #123
gh pr view                          # View current branch's PR
gh pr view --json title,body,author  # View specific fields as JSON
gh pr view --web                     # Open PR in browser

# Create pull request
gh pr create --title "Fix bug" --body "Description" --base main
gh pr create --draft                 # Create draft PR
gh pr create --assignee @me --label "enhancement"
gh pr create --reviewer user1,user2

# Checkout pull request
gh pr checkout 123                   # Checkout PR #123

# Edit pull request
gh pr edit 123 --title "New title"
gh pr edit 123 --add-label "bug" --remove-label "help wanted"

# Comment on pull request
gh pr comment 123 --body "LGTM!"
gh pr review 123 --approve           # Approve PR
gh pr review 123 --request-changes   # Request changes
gh pr review 123 --comment -F file.md # Review with comments from file

# Merge pull request
gh pr merge 123 --merge              # Merge with merge commit
gh pr merge 123 --squash             # Squash merge
gh pr merge 123 --rebase             # Rebase merge
gh pr merge 123 --delete-branch      # Merge and delete branch

# Close/reopen pull request
gh pr close 123                      # Close PR
gh pr reopen 123                     # Reopen PR

# Diff and patches
gh pr diff 123                       # View PR diff
gh pr diff 123 --color=never         # Diff without color
```

### Issue Management

```bash
# List issues
gh issue list                        # List open issues
gh issue list --state all            # List all issues
gh issue list --author @me           # List my issues
gh issue list --assignee @me         # List issues assigned to me
gh issue list --label "bug,urgent"   # List with labels
gh issue list --limit 50

# View issue details
gh issue view 456                    # View issue #456
gh issue view --json title,body,comments,labels
gh issue view --web

# Create issue
gh issue create --title "Bug found" --body "Steps to reproduce"
gh issue create --label "bug,high-priority"
gh issue create --assignee @me

# Edit issue
gh issue edit 456 --title "Updated title"
gh issue edit 456 --add-label "confirmed" --remove-label "needs-triage"

# Comment on issue
gh issue comment 456 --body "Working on this"

# Close/reopen issue
gh issue close 456
gh issue reopen 456

# Transfer issue to another repo
gh issue transfer 456 owner/repo
```

### GitHub Actions & Workflows

```bash
# List workflow runs
gh run list                          # List recent workflow runs
gh run list --limit 50               # List more runs
gh run list --workflow=ci.yml        # List runs for specific workflow
gh run list --branch main            # List runs for specific branch

# View run details
gh run view 456                      # View specific run
gh run view --log                    # View run with logs
gh run view --log-failed             # View only failed logs
gh run view --web                    # Open in browser

# Watch workflow run (follow logs in real-time)
gh run watch 456                     # Watch run execution
gh run watch 456 --interval 2        # Watch with 2s interval

# Rerun workflows
gh run rerun 456                     # Rerun failed run
gh run rerun 456 --failed            # Rerun only failed jobs

# List workflows
gh workflow list                     # List all workflows

# View workflow definition
gh workflow view ci.yml
gh workflow view ci.yml --web
gh workflow view ci.yml --yaml

# Run workflow manually
gh workflow run ci.yml --raw-field delay=10
gh workflow run deploy.yml --ref main

# View artifact list
gh run view 456 --log-failed --json artifacts
```

### Repository Management

```bash
# View repository info
gh repo view                         # View current repo
gh repo view owner/repo              # View specific repo
gh repo view --json name,description,stars,forks

# Create repository
gh repo create my-new-repo           # Create new repo
gh repo create my-repo --public      # Create public repo
gh repo create my-repo --source .    # Create from current dir
gh repo create my-repo --clone       # Create and clone

# Clone repository
gh repo clone owner/repo             # Clone repo
gh repo clone owner/repo my-dir      # Clone to specific dir

# Fork repository
gh repo fork owner/repo              # Fork repo
gh repo fork owner/repo --clone      # Fork and clone

# View repository settings
gh repo view --web                   # Open repo in browser
gh repo settings                     # View repository settings

# Archive/delete repository
gh repo delete owner/repo            # Delete repo (requires confirmation)
```

### Release Management

```bash
# List releases
gh release list                      # List releases

# View release
gh release view v1.0.0               # View specific release
gh release view latest               # View latest release
gh release view --web                # Open in browser

# Create release
gh release create v1.0.0 --notes "Release notes"
gh release create v1.0.0 --title "Version 1.0.0"
gh release create v1.0.0 --notes-from-tag
gh release create v1.0.0 --draft

# Delete release
gh release delete v1.0.0             # Delete release (requires confirmation)

# Upload assets
gh release upload v1.0.0 ./file.tar.gz
```

### Gist Management

```bash
# List gists
gh gist list                         # List your gists
gh gist list --public                # List public gists

# View gist
gh gist view abc123                  # View specific gist
gh gist view --web                   # Open in browser

# Create gist
gh gist create file.py               # Create gist from file
gh gist create file.py --desc "My gist"
gh gist create file.py --public      # Create public gist

# Edit gist
gh gist edit abc123 --desc "Updated description"

# Delete gist
gh gist delete abc123
```

### Git Operations via GitHub

```bash
# Status and info
gh status                            # Show repo status

# View and create commits
gh api /repos/owner/repo/commits     # GitHub API call
gh commit list                       # List recent commits (needs extension)

# Branch operations
gh repo sync                         # Sync fork with upstream
gh api /repos/owner/repo/branches    # List branches via API
```

### Authentication & Configuration

```bash
# Auth status
gh auth status                       # Check authentication

# Login
gh auth login                        # Login to GitHub
gh auth login --with-token < token.txt

# Logout
gh auth logout                       # Logout

# Token management
gh auth token                        # Print auth token
gh auth refresh                      # Refresh auth token

# Configuration
gh config set editor vim             # Set editor
gh config set git_protocol ssh       # Use SSH for git operations
gh config set prompt disabled        # Disable interactive prompts
```

### Local Git CLI Patterns

Use stable Git output formats when local repository state matters alongside GitHub operations.

```bash
# Status
git status --porcelain=v2 --branch
git status --short --branch

# Diffs
git diff --numstat
git diff --cached --numstat
git diff --name-status

# History
git log --format='%h %s' -n 10
git log --format='%H|%an|%ae|%s' -n 10

# Branches and remotes
git branch -vv
git b
Files: 2
Size: 17.8 KB
Complexity: 30/100
Category: General

Related in General