Skill v1.0.2
currentAutomated scan100/100+4 new, ~9 modified
version: "1.0.2" disable-model-invocation: false name: cli-gh user-invocable: false description: 'Use for GitHub CLI automation: repo info/browsing, workflow triggers, GitHub search, codespaces, PR status, or issues.'
GitHub CLI (gh)
Overview
Expert guidance for GitHub CLI (gh) operations and workflows. Use this skill for command-line GitHub operations including pull request management, issue tracking, repository operations, workflow automation, and codespace management.
Key capabilities:
- Create and manage pull requests from the terminal
- Track and organize issues efficiently
- Search across all of GitHub (repos, issues, PRs)
- Manage labels and project organization
- Trigger and monitor GitHub Actions workflows
- Work with codespaces
- Automate repository operations and releases
- Browse repositories, PRs, and files in the browser
Safety Rules
CRITICAL: This skill forbids destructive gh CLI operations except the controlled label-deletion workflow below.
This skill focuses on safe, read-only, or reversible GitHub operations. Treat destructive operations as prohibited unless this file explicitly defines an exception.
Controlled destructive exception:
gh label delete may be used only when every condition is met:
- The user explicitly asks to delete one or more repository labels.
- Before running any deletion command, present a deletion plan listing the target repository, exact label names, exact command(s), and the consequence that the labels will be removed from the repository and from existing issues and pull requests.
- The user explicitly approves that deletion plan in a subsequent message. The original deletion request, broad cleanup approval, prior consent, or silence is not approval.
- Run only the approved
gh label delete <name> --repo OWNER/REPO --yescommands. If the repository, labels, or commands change, stop and present a revised plan for approval.
The following commands are PROHIBITED and must NEVER be used:
Permanently destructive commands:
gh repo delete- Repository deletiongh repo archive- Repository archivalgh release delete- Release deletiongh release delete-asset- Asset deletiongh run delete- Workflow run deletiongh cache delete- Cache deletiongh secret delete- Secret deletiongh variable delete- Variable deletiongh ssh-key delete- SSH key deletion (can lock out users)gh gpg-key delete- GPG key deletiongh codespace delete- Codespace deletiongh extension remove- Extension removalgh gist delete- Gist deletion- Bulk deletion operations using
xargswith any destructive commands - Shell commands:
rm -rf(except for temporary file cleanup)
Allowed operations:
- Creating resources (PRs, issues, releases, labels, repos)
- Viewing and listing (status, logs, information, searches)
- Updating and editing existing resources
- Closing PRs/issues (reversible - can be reopened)
- Reverting pull requests (creates a new revert PR)
- Canceling workflow runs (stops execution without deleting data)
- Merging pull requests (after proper review)
- Deleting repository labels only through the controlled destructive exception above
- Read-only git operations (
git status,git log,git diff)
Installation & Setup
# Login to GitHubgh auth login# Login and copy OAuth code to clipboard automaticallygh auth login --clipboard# Check authentication statusgh auth status# Check auth status with JSON outputgh auth status --json# Configure git to use gh as credential helpergh auth setup-git
Pull Requests
Creating PRs
# Create PR interactivelygh pr create# Create PR with title and bodygh pr create --title "Add feature" --body "Description"# Create PR to specific branchgh pr create --base main --head feature-branch# Create draft PRgh pr create --draft# Create PR from current branchgh pr create --fill # Uses commit messages# Create PR with Copilot Code Reviewgh pr create --reviewer @copilot
Viewing PRs
# List PRsgh pr list# List my PRsgh pr list --author @me# View PR detailsgh pr view 123# View PR in browsergh pr view 123 --web# View PR diffgh pr diff 123# View PR diff excluding specific filesgh pr diff 123 --exclude "*.lock"# Check PR statusgh pr status
Managing PRs
# Checkout PR locallygh pr checkout 123# Review PRgh pr review 123 --approvegh pr review 123 --comment --body "Looks good!"gh pr review 123 --request-changes --body "Please fix X"# Request Copilot Code Reviewgh pr edit 123 --add-reviewer @copilot# Merge PRgh pr merge 123gh pr merge 123 --squashgh pr merge 123 --rebasegh pr merge 123 --merge# Close PRgh pr close 123# Reopen PRgh pr reopen 123# Ready draft PRgh pr ready 123# Update PR branch with base branchgh pr update-branch 123# Revert a merged PR (creates a new revert PR)gh pr revert 123
PR Checks
# View PR checksgh pr checks 123# Watch PR checksgh pr checks 123 --watch
Issues
Creating Issues
# Create issue interactivelygh issue create# Create issue with title and bodygh issue create --title "Bug report" --body "Description"# Use a Markdown issue template as interactive/editor starting body textgh issue create --template "Bug Report"# Create issue with labelsgh issue create --title "Bug" --label bug,critical# Assign issuegh issue create --title "Task" --assignee @me# Set the issue type (GitHub.com and GHES 3.17+)gh issue create --type Bug
--template cannot be combined with --body or --body-file; use it with prompts, --editor, or --web. For YAML issue forms, fetch and render the form fields yourself for non-interactive automation, or finish in the browser.
Viewing Issues
# List issuesgh issue list# List my issuesgh issue list --assignee @me# List by labelgh issue list --label bug# Filter by issue typegh issue list --type Bug# Advanced issue searchgh issue list --search "is:open label:bug sort:created-desc"# View issue detailsgh issue view 456# View in browsergh issue view 456 --web
Managing Issues
# Close issuegh issue close 456# Close as duplicate, linking to the original issuegh issue close 123 --duplicate-of 456# Reopen issuegh issue reopen 456# Edit issuegh issue edit 456 --title "New title"gh issue edit 456 --add-label buggh issue edit 456 --add-assignee @user# Comment on issuegh issue comment 456 --body "Update"# Create branch to work on issuegh issue develop 456 --checkout
Discussions
When the user asks to list, view, create, edit, or comment on GitHub Discussions, see references/discussions.md. The gh discussion command set is in preview and subject to change.
Repository Operations
Repository Info
# View repositorygh repo view# View in browsergh repo view --web# Clone repositorygh repo clone owner/repo# Clone without adding upstream remotegh repo clone owner/repo --no-upstream# Fork repositorygh repo fork owner/repo# List repositoriesgh repo list owner
Repository Management
# Create repositorygh repo create my-repo --publicgh repo create my-repo --private# Sync forkgh repo sync owner/repo# Set default repositorygh repo set-default# Configure the squash-merge commit message defaultgh repo edit --squash-merge-commit-message COMMIT_MESSAGES
Workflows & Actions
When the user asks to trigger, monitor, cancel, rerun, or download artifacts from GitHub Actions workflows and runs, see references/workflows-actions.md.
Search
When the user asks to search GitHub repositories, issues, or pull requests, see references/search.md.
Labels
When the user asks to list, create, edit, delete, or clone repository labels, see references/labels.md.
Codespaces
When the user asks to list, create, connect to, or manage files within GitHub Codespaces, see references/codespaces.md.
Browse
Open repositories, files, and resources in the browser.
# Open current repo in browsergh browse# Open specific filegh browse src/main.go# Open file at specific linegh browse src/main.go:42# Open blame view for a filegh browse --blame src/main.go# Open Actions tabgh browse --actions# Open specific branchgh browse --branch feature
Releases
When the user asks to create, list, view, or download GitHub releases, see references/releases.md.
Gists
When the user asks to create, list, view, or edit GitHub gists, see references/gists.md.
Configuration
# Set default editorgh config set editor vim# Set default git protocolgh config set git_protocol ssh# View configurationgh config list# Set browsergh config set browser firefox
Advanced Features
When the user needs aliases, direct API access, extensions, secrets/variables, SSH/GPG keys, organization or project management, repository rulesets, attestations, Copilot Agent Tasks, gh skill management, reading repo file/directory contents without cloning, or issue types/sub-issues/blocking relationships, see references/advanced-features.md.
Automation & Scripting
When the user wants ready-made gh CLI automation patterns — code review workflows, issue triage, daily/weekly reports, bulk operations, CI monitoring, or team collaboration scripts, see references/automation-workflows.md.
Troubleshooting
When gh fails with auth/permission/rate-limit errors, or hits command errors, installation/config issues, or network problems, see references/troubleshooting.md.
Additional Resources
Example Scripts
Practical automation scripts (see examples/ directory):
auto-pr-create.sh- Automated PR creation workflowissue-triage.sh- Bulk issue labeling and assignmentworkflow-monitor.sh- Watch and notify on workflow completionrelease-automation.sh- Complete release workflow automation
External Documentation
- Official Manual: https://cli.github.com/manual
- GitHub Community: https://github.com/cli/cli/discussions
- API Documentation: https://docs.github.com/en/rest
- Extension Marketplace: https://github.com/topics/gh-extension
JSON Output
When the user wants to use --json flags or needs the correct gh CLI JSON field names, see references/json-output.md.
Tips
- Leverage interactive prompts by omitting parameters - most commands support interactive mode
- Use
gh repo create --templateto scaffold from template repositories - Enable auto-merge with
gh pr merge --autofor PRs that pass checks