gh-cli
Use when interacting with GitHub - searching for repos/orgs/packages, exploring codebases, finding projects to use, querying branches/PRs/issues/releases/workflows, automating GitHub operations, or when users mention GitHub organizations or repositories
When & Why to Use This Skill
The GitHub CLI (gh) skill empowers Claude to interact directly with GitHub's ecosystem, streamlining development workflows and repository management. It enables seamless automation of pull requests, issues, and repository operations, while providing deep integration with GitHub Actions for CI/CD monitoring and codebase exploration.
Use Cases
- Streamlining Pull Request Workflows: Quickly create, list, view, and merge pull requests to accelerate the code review and delivery process.
- Efficient Issue Management: Create, track, and organize project issues and labels directly through natural language to maintain project momentum.
- CI/CD Monitoring and Automation: List and view GitHub Actions workflow runs, trigger manual dispatches, and monitor deployment statuses in real-time.
- Codebase Exploration and Search: Search for repositories, explore specific code segments, and query branches or releases to gather technical context.
- Repository Administration: Manage repository secrets, environment variables, and Gists, or perform authenticated API requests for custom GitHub operations.
| name | gh-cli |
|---|---|
| description | Use when interacting with GitHub - searching for repos/orgs/packages, exploring codebases, finding projects to use, querying branches/PRs/issues/releases/workflows, automating GitHub operations, or when users mention GitHub organizations or repositories |
CRITICAL: You MUST use the Task tool with
subagent_type: "general"to execute GitHub CLI commands. NEVER runghcommands directly in your bash session.
Example Task invocation:
Task(subagent_type="general", prompt="Use gh CLI to list branches: gh branch list --json name,updatedAt")
This preserves conversation context and isolates CLI output.
GitHub CLI (gh)
Command-line interface for GitHub. Use --json <fields> with --jq for scriptable output.
Quick Reference
| Task | Command |
|---|---|
| List my PRs | gh pr list --author @me |
| View PR | gh pr view <number> |
| Create PR | gh pr create --fill |
| Checkout PR | gh pr checkout <number> |
| List issues | gh issue list |
| View issue | gh issue view <number> |
| Create issue | gh issue create --title "..." --body "..." |
| Repo info | gh repo view |
| Clone repo | gh repo clone <owner/repo> |
| List releases | gh release list |
| Workflow runs | gh run list |
| View run | gh run view <run-id> |
| Search repos | gh search repos <query> |
| Search code | gh search code <query> |
| API request | gh api <endpoint> |
| My status | gh status |
| Auth status | gh auth status |
Core Commands
| Command | Description |
|---|---|
gh repo |
Manage repositories (create, clone, fork, view, delete, edit) |
gh pr |
Manage pull requests (create, list, view, checkout, merge, close) |
gh issue |
Manage issues (create, list, view, edit, close, comment) |
gh release |
Manage releases (create, list, view, download, delete) |
gh gist |
Manage gists (create, list, view, edit, delete) |
gh project |
Work with GitHub Projects |
GitHub Actions
| Command | Description |
|---|---|
gh run list |
List recent workflow runs |
gh run view |
View a workflow run |
gh run watch |
Watch a run until completion |
gh run rerun |
Rerun a workflow |
gh workflow list |
List workflows |
gh workflow run |
Trigger a workflow |
gh cache list |
List Actions caches |
Additional Commands
| Command | Description |
|---|---|
gh search |
Search repos, issues, PRs, commits, code |
gh api |
Make authenticated API requests |
gh auth |
Manage authentication (login, logout, status) |
gh config |
Manage configuration |
gh secret |
Manage repository/org secrets |
gh variable |
Manage Actions variables |
gh label |
Manage issue labels |
gh ruleset |
View repository rulesets |
For detailed flags and examples, see pr-commands.md, issue-commands.md, repo-commands.md, actions-commands.md, and other-commands.md in this skill directory.
Output Flags
| Flag | Description |
|---|---|
--json <fields> |
Output JSON with specified fields |
-q, --jq <expr> |
Filter JSON output with jq expression |
-t, --template |
Format output with Go template |
-w, --web |
Open in browser |
Global Flags
| Flag | Description |
|---|---|
-R, --repo OWNER/REPO |
Select repository |
--help |
Help for any command |