| name | github |
| description | This skill should be used when the user mentions GitHub PRs, issues, workflows, releases, or repository management. Triggers on keywords like "github", "gh", "pr", "pull request", "issue", "workflow", "actions", "release", "merge", "review", "ci", "check", or PR/issue number patterns like "#123". |
GitHub CLI Skill
This skill enables natural language interaction with GitHub via the gh CLI
tool (https://cli.github.com/).
Quick Reference
| Intent | Command |
|---|
| View PR | gh pr view NUMBER |
| List PRs | gh pr list |
| My PRs | gh pr list --author @me |
| Create PR | gh pr create -t "Title" -b "Body" |
| PR status | gh pr status |
| Merge PR | gh pr merge NUMBER |
| View issue | gh issue view NUMBER |
| List issues | gh issue list |
| Create issue | gh issue create -t "Title" -b "Body" |
| Workflow runs | gh run list |
| View run | gh run view RUN-ID |
| Repo info | gh repo view |
| Open in browser | gh browse |
Pull Requests
Viewing PRs
gh pr view NUMBER
gh pr view NUMBER --web
gh pr view NUMBER --comments
gh pr diff NUMBER
gh pr checks NUMBER
gh pr diff NUMBER --name-only
gh pr view
gh pr view NUMBER --json number,title,state,mergeable,reviewDecision
Listing PRs
gh pr list
gh pr list --author @me
gh pr list --search "review-requested:@me"
gh pr list --state open
gh pr list --state closed
gh pr list --state merged
gh pr list --state all
gh pr list --label bug
gh pr list --label "needs review"
gh pr list --base main
gh pr list --base develop
gh pr list --head feature/my-branch
gh pr list --draft
gh pr list --search "fix login"
gh pr list --search "author:username"
gh pr list --search "is:open is:draft"
gh pr list --limit 10
gh pr list --json number,title,author,createdAt
gh pr list --web
Creating PRs
gh pr create
gh pr create --title "Add feature X" --body "Description here"
gh pr create --base develop
gh pr create --draft --title "WIP: Feature"
gh pr create --title "Feature" --reviewer user1,user2
gh pr create --title "Feature" --assignee @me,user2
gh pr create --title "Fix" --label bug,urgent
gh pr create --title "Feature" --milestone "v1.0"
gh pr create --title "Feature" --project "Project Name"
gh pr create --title "Fix #123" --body "Closes #123"
gh pr create --fill
gh pr create --fill-first
gh pr create --template bug_report.md
gh pr create --title "Feature" --web
gh pr create --title "Feature" --body-file DESCRIPTION.md
PR Status and Checks
gh pr status
gh pr checks NUMBER
gh pr checks NUMBER --watch
gh pr checks NUMBER --watch --fail-fast
gh pr view NUMBER --json reviewDecision,reviews
gh pr checks NUMBER --required
Reviewing PRs
gh pr review NUMBER
gh pr review NUMBER --approve
gh pr review NUMBER --request-changes --body "Please fix X"
gh pr review NUMBER --comment --body "Looks good overall"
gh pr diff NUMBER
gh pr checkout NUMBER
gh pr checkout NUMBER --branch test-pr-123
gh pr comment NUMBER --body "Comment text"
gh pr comment NUMBER --edit-last --body "Updated comment"
Merging PRs
gh pr merge NUMBER
gh pr merge NUMBER --merge
gh pr merge NUMBER --squash
gh pr merge NUMBER --rebase
gh pr merge NUMBER --delete-branch
gh pr merge NUMBER --auto
gh pr merge NUMBER --disable-auto
gh pr merge NUMBER --squash --subject "feat: add feature" --body "Details"
gh pr merge NUMBER --admin
Editing PRs
gh pr edit NUMBER --title "New title"
gh pr edit NUMBER --body "New description"
gh pr edit NUMBER --add-label bug,urgent
gh pr edit NUMBER --remove-label wip
gh pr edit NUMBER --add-reviewer user1,user2
gh pr edit NUMBER --remove-reviewer user1
gh pr edit NUMBER --add-assignee @me
gh pr edit NUMBER --milestone "v1.0"
gh pr ready NUMBER --undo
gh pr ready NUMBER
gh pr edit NUMBER --base develop
Closing/Reopening PRs
gh pr close NUMBER
gh pr close NUMBER --comment "Closing because..."
gh pr close NUMBER --delete-branch
gh pr reopen NUMBER
Issues
Viewing Issues
gh issue view NUMBER
gh issue view NUMBER --web
gh issue view NUMBER --comments
gh issue view NUMBER --json number,title,state,labels,assignees
Listing Issues
gh issue list
gh issue list --assignee @me
gh issue list --author @me
gh issue list --mention @me
gh issue list --state open
gh issue list --state closed
gh issue list --state all
gh issue list --label bug
gh issue list --label "help wanted"
gh issue list --milestone "v1.0"
gh issue list --search "login error"
gh issue list --search "is:open label:bug"
gh issue list --limit 20
gh issue list --json number,title,labels,createdAt
gh issue list --web
Creating Issues
gh issue create
gh issue create --title "Bug: X not working" --body "Description"
gh issue create --title "Bug" --label bug,urgent
gh issue create --title "Task" --assignee @me,user2
gh issue create --title "Feature" --milestone "v1.0"
gh issue create --title "Feature" --project "Project Name"
gh issue create --template bug_report.md
gh issue create --title "Feature" --body-file ISSUE.md
gh issue create --title "Bug" --web
gh issue create --recover
Editing Issues
gh issue edit NUMBER --title "New title"
gh issue edit NUMBER --body "New description"
gh issue edit NUMBER --add-label bug,urgent
gh issue edit NUMBER --remove-label wip
gh issue edit NUMBER --add-assignee user1
gh issue edit NUMBER --remove-assignee user1
gh issue edit NUMBER --milestone "v1.0"
gh issue edit NUMBER --add-project "Project Name"
Closing/Reopening Issues
gh issue close NUMBER
gh issue close NUMBER --comment "Fixed in #PR"
gh issue close NUMBER --reason completed
gh issue close NUMBER --reason "not planned"
gh issue reopen NUMBER
Issue Comments
gh issue comment NUMBER --body "Comment text"
gh issue comment NUMBER --edit-last --body "Updated"
gh issue comment NUMBER --editor
Linking Issues and PRs
gh pr create --title "Fix #123" --body "Closes #123"
gh pr create --body "Fixes #123, Related to #456"
gh issue develop NUMBER
gh issue develop NUMBER --name feature/fix-issue
gh issue develop NUMBER --checkout
Workflows and Actions
Listing Runs
gh run list
gh run list --workflow build.yml
gh run list --status success
gh run list --status failure
gh run list --status in_progress
gh run list --branch main
gh run list --user @me
gh run list --limit 10
gh run list --json databaseId,status,conclusion,name
gh run list --web
Viewing Runs
gh run view RUN-ID
gh run view RUN-ID --web
gh run view RUN-ID --job JOB-ID
gh run view RUN-ID --log
gh run view RUN-ID --log-failed
gh run view RUN-ID --exit-status
gh run watch RUN-ID
gh run view RUN-ID --json status,conclusion,jobs
Managing Runs
gh run rerun RUN-ID --failed
gh run rerun RUN-ID
gh run rerun RUN-ID --job JOB-ID
gh run rerun RUN-ID --debug
gh run cancel RUN-ID
gh run delete RUN-ID
gh run download RUN-ID
gh run download RUN-ID --name artifact-name
gh run download RUN-ID --dir ./artifacts
Triggering Workflows
gh workflow run workflow.yml
gh workflow run workflow.yml -f param1=value1 -f param2=value2
gh workflow run workflow.yml --ref feature-branch
gh workflow run workflow.yml --json <inputs.json
Listing Workflows
gh workflow list
gh workflow list --state enabled
gh workflow list --state disabled
gh workflow view workflow.yml
gh workflow view workflow.yml --web
gh workflow enable workflow.yml
gh workflow disable workflow.yml
Repository Management
Viewing Repos
gh repo view
gh repo view owner/repo
gh repo view --web
gh repo view --json name,description,stargazerCount,forkCount
gh repo view --readme
Cloning and Forking
gh repo clone owner/repo
gh repo clone owner/repo ./my-dir
gh repo fork owner/repo
gh repo fork owner/repo --clone
gh repo fork owner/repo --fork-name my-fork
Creating Repos
gh repo create
gh repo create my-repo --public
gh repo create my-repo --private
gh repo create my-repo --template owner/template
gh repo create my-repo --clone
gh repo create my-repo --description "My project"
gh repo create my-repo --gitignore Node
gh repo create my-repo --license MIT
gh repo create org/my-repo
Editing Repos
gh repo edit --description "New description"
gh repo edit --homepage "https://example.com"
gh repo edit --visibility private
gh repo edit --visibility public
gh repo edit --enable-issues
gh repo edit --enable-wiki=false
gh repo edit --enable-discussions
gh repo edit --default-branch main
gh repo edit --enable-auto-merge
gh repo edit --delete-branch-on-merge
gh repo archive
gh repo archive owner/repo
gh repo unarchive owner/repo
gh repo delete owner/repo --yes
Repository Secrets
gh secret list
gh secret set SECRET_NAME
gh secret set SECRET_NAME --body "$VALUE"
gh secret set SECRET_NAME <secret.txt
gh secret set SECRET_NAME --env production
gh secret set SECRET_NAME --org my-org
gh secret delete SECRET_NAME
Repository Variables
gh variable list
gh variable set VAR_NAME --body "value"
gh variable set VAR_NAME --env production --body "value"
gh variable delete VAR_NAME
Releases
Listing Releases
gh release list
gh release list --limit 10
gh release list --exclude-drafts
gh release list --exclude-pre-releases
Viewing Releases
gh release view
gh release view v1.0.0
gh release view v1.0.0 --web
gh release view v1.0.0 --json tagName,name,body,assets
Creating Releases
gh release create v1.0.0
gh release create v1.0.0 --title "Version 1.0" --notes "Release notes"
gh release create v1.0.0 --notes-file CHANGELOG.md
gh release create v1.0.0 --generate-notes
gh release create v1.0.0 --draft
gh release create v1.0.0 --prerelease
gh release create v1.0.0 ./dist/*.zip ./dist/*.tar.gz
gh release create v1.0.0 --target main
gh release create v1.0.0 --latest
gh release create v1.0.0 --latest=false
gh release create v1.0.0 --discussion-category "Announcements"
Editing Releases
gh release edit v1.0.0 --title "New Title"
gh release edit v1.0.0 --notes "Updated notes"
gh release edit v1.0.0 --draft=false
gh release edit v1.0.0 --prerelease
gh release edit v1.0.0 --latest
Managing Release Assets
gh release upload v1.0.0 ./dist/*.zip
gh release upload v1.0.0 ./build/app.zip#app-v1.0.0.zip
gh release upload v1.0.0 ./dist/app.zip --clobber
gh release download v1.0.0
gh release download v1.0.0 --pattern "*.zip"
gh release download v1.0.0 --dir ./downloads
gh release delete-asset v1.0.0 app.zip
Deleting Releases
gh release delete v1.0.0
gh release delete v1.0.0 --yes
gh release delete v1.0.0-draft --yes
Gists
gh gist list
gh gist view GIST-ID
gh gist view GIST-ID --web
gh gist create file.txt
gh gist create file.txt --public
gh gist create file.txt --desc "My gist"
gh gist create file1.txt file2.js
echo "content" | gh gist create
gh gist edit GIST-ID
gh gist edit GIST-ID --add newfile.txt
gh gist clone GIST-ID
gh gist delete GIST-ID
Browsing
gh browse
gh browse path/to/file.js
gh browse path/to/file.js:42
gh browse --branch develop
gh browse --commit abc123
gh browse --prs
gh browse --issues
gh browse --actions
gh browse --settings
gh browse --wiki
gh browse --projects
gh browse --no-browser
Code Search and Codespaces
Code Search
gh search code "function" --repo owner/repo
gh search code "pattern" --language javascript
gh search repos "topic:react" --limit 10
gh search issues "bug" --repo owner/repo
gh search prs "fix" --state open
gh search commits "fix bug" --repo owner/repo
Codespaces
gh codespace list
gh codespace create --repo owner/repo
gh codespace create --repo owner/repo --branch feature
gh codespace create --repo owner/repo --machine largePremiumLinux
gh codespace ssh --codespace NAME
gh codespace code --codespace NAME
gh codespace view --codespace NAME --web
gh codespace stop --codespace NAME
gh codespace delete --codespace NAME
gh codespace ports forward 3000:3000 --codespace NAME
Authentication and Configuration
gh auth login
gh auth login --hostname enterprise.github.com
gh auth login --with-token <token.txt
gh auth status
gh auth refresh
gh auth switch
gh auth logout
gh api user --jq .login
gh config set git_protocol ssh
gh config set editor vim
gh config set browser firefox
gh config list
API Access
gh api repos/owner/repo
gh api repos/owner/repo/issues -f title="Bug" -f body="Description"
gh api repos/owner/repo --jq '.stargazers_count'
gh api repos/owner/repo/issues --paginate
gh api graphql -f query='{ viewer { login } }'
gh api repos/owner/repo --include
Natural Language Mapping
When interpreting user requests, map these patterns:
| User says | Interpret as |
|---|
| "my PRs", "my pull requests" | --author @me |
| "PRs for review", "to review" | --search "review-requested:@me" |
| "open PRs" | --state open |
| "merged PRs" | --state merged |
| "closed PRs/issues" | --state closed |
| "draft PRs" | --draft |
| "bugs", "bug issues" | --label bug |
| "my issues" | --assignee @me |
| "issues I created" | --author @me |
| "failing CI", "failed checks" | gh pr checks or --status failure |
| "CI status", "check status" | gh pr checks NUMBER |
| "recent runs", "workflow runs" | gh run list |
| "open it", "show in browser" | --web or gh browse |
| "merge it" | gh pr merge |
| "approve", "LGTM" | gh pr review --approve |
| "request changes" | gh pr review --request-changes |
| "latest release" | gh release view |
| "create release" | gh release create |
| "checkout PR" | gh pr checkout NUMBER |
| "PR diff", "what changed" | gh pr diff NUMBER |
PR/Issue Detection
PR and issue numbers follow patterns: #123, PR #123, issue #123
When a user mentions a number in conversation:
- Offer to view:
gh pr view NUMBER or gh issue view NUMBER
- Or open:
gh browse with the appropriate path
Tips
- Always show the command before running it
- Use
--json for scripting and parsing output
- Use
@me to reference the current user
- Use
--web to open results in browser
- Use
--help on any command for more options
- The
-R owner/repo flag can override the current repo context
- Use
gh api for operations not covered by specific commands
- Enable shell completion:
gh completion -s bash/zsh/fish
Error Handling
Common issues:
- "not found" - verify repo access and PR/issue number
- "not authenticated" - run
gh auth login
- "merge blocked" - check required reviews/checks
- "no upstream" - push branch first:
git push -u origin branch
- "draft PR" - mark ready with
gh pr ready NUMBER