| name | github |
| description | GitHub CLI (gh) commands for repositories, issues, pull requests, and actions. Use when user mentions PRs, issues, CI/CD, workflows, or GitHub operations. |
| metadata | {"author":"ahmadabdalla","version":"1.0"} |
GitHub CLI Reference
Use gh (GitHub CLI) for all GitHub operations. This skill provides correct command syntax to avoid trial-and-error.
Authentication
gh auth status
gh auth login
gh auth refresh -s read:project
Repositories
gh repo clone owner/repo
gh repo create
gh repo create my-repo --public --description "My project"
gh repo view --web
gh repo view owner/repo
gh repo list
gh repo list my-org --limit 50
Issues
gh issue list
gh issue list --state closed --label "bug" --assignee @me
gh issue create
gh issue create --title "Bug: Login fails" --body "Steps to reproduce..."
gh issue create --title "Feature request" --body "$(cat <<'EOF'
## Description
Add dark mode support
## Acceptance Criteria
- [ ] Toggle in settings
- [ ] Persists across sessions
EOF
)"
gh issue view 123
gh issue view 123 --web
gh issue close 123
gh issue reopen 123
gh issue comment 123 --body "Fixed in PR #456"
gh issue edit 123 --add-assignee @me
gh issue edit 123 --add-label "priority:high"
Pull Requests
Listing and Viewing
gh pr list
gh pr list --state merged --author @me --base main
gh pr view 123
gh pr view 123 --web
gh pr diff 123
gh pr checks 123
Creating PRs
gh pr create
gh pr create --title "Add feature X" --body "Description here"
gh pr create --title "Add user authentication" --body "$(cat <<'EOF'
## Summary
- Implement JWT-based authentication
- Add login/logout endpoints
## Test Plan
- [ ] Unit tests pass
- [ ] Manual testing completed
Co-Authored-By: Claude <noreply@anthropic.com>
EOF
)"
gh pr create --draft --title "WIP: New feature"
gh pr create --base develop --title "Feature for develop"
gh pr create --web
Reviewing and Merging
gh pr checkout 123
gh pr review 123 --approve
gh pr review 123 --request-changes --body "Please fix the typo on line 42"
gh pr review 123 --comment --body "Looks good, minor suggestion..."
gh pr merge 123
gh pr merge 123 --squash
gh pr merge 123 --rebase
gh pr merge 123 --squash --delete-branch
gh pr close 123
Actions (CI/CD)
Workflow Runs
gh run list
gh run list --workflow build.yml
gh run list --status failure
gh run view 12345678
gh run view 12345678 --log
gh run view 12345678 --log-failed
gh run watch 12345678
gh run rerun 12345678 --failed
Workflows
gh workflow list
gh workflow view build.yml
gh workflow run build.yml
gh workflow run deploy.yml -f environment=staging -f version=1.2.3
gh workflow disable build.yml
gh workflow enable build.yml
Common Workflows
Quick PR Creation Flow
git status
git add . && git commit -m "Add feature X"
git push -u origin HEAD && gh pr create --fill
Review and Merge Flow
gh pr checkout 123
npm test
gh pr checks 123
gh pr review 123 --approve && gh pr merge 123 --squash --delete-branch
CI Debugging Flow
gh run list --status failure --limit 5
gh run view <run-id> --log-failed
gh run rerun <run-id> --failed
API Access (Advanced)
gh api repos/owner/repo
gh api repos/owner/repo/issues --method POST -f title="Bug" -f body="Details"
gh api graphql -f query='{ viewer { login } }'
gh api repos/owner/repo/issues --paginate
Tips
- Use
--help on any command for full options: gh pr create --help
- Use
--json flag for machine-readable output: gh pr list --json number,title
- Set default repo:
gh repo set-default owner/repo
- Environment variable
GH_TOKEN can provide auth token