| name | gh-cli |
| description | GitHub CLI (gh) for repos, issues, PRs, actions, releases. Use when working with GitHub or running gh commands. |
gh-cli — GitHub CLI
Core Capability: Interact with GitHub repositories and services from the command line using gh.
Quick Start
brew install gh
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update && sudo apt install gh
gh auth status
gh auth login
gh repo clone owner/repo
THE EXACT PROMPT — Pull Request Workflow
gh pr create --fill
gh pr create --title "Add feature" --body "Description"
gh pr view 45
gh pr view 45 --web
gh pr checkout 45
gh pr review 45 --approve
gh pr review 45 --request-changes --body "Please fix X"
gh pr merge 45 --squash
gh pr merge 45 --merge --delete-branch
THE EXACT PROMPT — Issues
gh issue list
gh issue create --title "Bug: Login fails" --body "Description"
gh issue view 123
gh issue close 123
gh issue comment 123 --body "Working on this"
gh issue edit 123 --add-label "bug,priority:high"
THE EXACT PROMPT — Actions (CI/CD)
gh run list
gh run view 12345
gh run watch 12345
gh run view 12345 --log
gh run rerun 12345 --failed
gh workflow run deploy.yml -f environment=production
THE EXACT PROMPT — Releases
gh release create v1.0.0 --title "Version 1.0" --generate-notes
gh release upload v1.0.0 ./dist/app.zip
gh release download v1.0.0
Essential Commands
| Category | Command | Description |
|---|
| Repo | gh repo clone owner/repo | Clone repository |
| Repo | gh repo create my-repo --public | Create new repo |
| PR | gh pr create --fill | Create PR from branch |
| PR | gh pr checkout 45 | Checkout PR locally |
| PR | gh pr merge 45 --squash | Merge with squash |
| Issue | gh issue create --title "X" | Create issue |
| Issue | gh issue list | List issues |
| Actions | gh run list | List workflow runs |
| Actions | gh run watch | Watch current run |
| Release | gh release create v1.0 | Create release |
Quick PR Workflow
git checkout -b feature/my-feature
git add . && git commit -m "Add feature"
git push -u origin feature/my-feature
gh pr create --fill
gh pr checkout 45
gh pr review --approve
gh pr merge --squash --delete-branch
AGENTS.md Blurb
Copy this to your project's AGENTS.md:
### GitHub CLI (gh)
The `gh` CLI is configured and authenticated.
Common tasks:
- Create PR: `gh pr create --fill`
- List open PRs: `gh pr list`
- Check CI status: `gh pr checks`
- Create issue: `gh issue create --title "..." --body "..."`
Repo: `https://github.com/<OWNER>/<REPO>`
When to Use
- Creating PRs without leaving the terminal
- Automating issue creation in scripts
- Checking CI status:
gh pr checks
- Viewing PR comments:
gh pr view 123 --comments
- Watching actions run:
gh run watch
References