| name | gh-cli |
| description | Manage GitHub Issues from the command line using the gh CLI. Use when the user asks about GitHub issues, labels, milestones, or needs to manage project work items via the command line. |
GitHub Issues CLI
Interact with GitHub Issues from the command line using gh.
When to Use
- User asks to create, view, edit, or search GitHub Issues
- User needs to manage labels, milestones, or assignees
- User wants to close, reopen, or comment on issues
- MCP tools (
mcp_github_*) are unavailable or failing
- User needs scripted/batch issue operations
Prerequisites
- Install gh CLI:
brew install gh (macOS) or see install instructions
- Authenticate:
gh auth login
- Verify:
gh auth status
Issue Commands
List Issues
gh issue list
gh issue list --state open --label "bug"
gh issue list --assignee @me
gh issue list --milestone "v1.0"
gh issue list --search "is:open label:epic sort:created-desc"
gh issue list --limit 20
gh issue list --json number,title,state,labels --limit 50
Create Issues
gh issue create
gh issue create --title "Bug: Login fails" --body "Description here" --label "bug" --assignee @me
gh issue create --title "Add feature" --body "Details" --label "enhancement" --milestone "v1.0"
gh issue create --title "Feature request" --body-file ./description.md
gh issue create --title "Review needed" --assignee user1,user2
View Issues
gh issue view 123
gh issue view 123 --comments
gh issue view 123 --json title,body,state,labels,assignees,milestone
gh issue view 123 --web
Edit Issues
gh issue edit 123 --title "Updated title"
gh issue edit 123 --add-label "priority:high,needs-review"
gh issue edit 123 --remove-label "needs-triage"
gh issue edit 123 --milestone "v1.0"
gh issue edit 123 --add-assignee @me,teammate
gh issue edit 123 --remove-assignee old-owner
Close & Reopen Issues
gh issue close 123
gh issue close 123 --comment "Fixed in PR #456"
gh issue close 123 --reason "not planned"
gh issue reopen 123
gh issue reopen 123 --comment "Reopening — needs more work"
Comments
gh issue comment 123 --body "Working on this"
gh issue comment 123 --body-file ./comment.md
gh issue comment 123 --edit-last
Pin & Lock Issues
gh issue pin 123
gh issue unpin 123
gh issue lock 123 --reason "resolved"
gh issue unlock 123
Search
gh search issues "authentication bug" --repo owner/repo
gh search issues "label:bug state:open" --repo owner/repo --limit 20
gh issue list --search "assignee:@me is:open"
Labels
gh label list
gh label create "priority:high" --color FF0000 --description "High priority"
gh label edit "priority:high" --new-name "priority:critical" --color CC0000
gh label delete "old-label" --yes
Milestones
gh api repos/ninjasitm/mymarketingpro-vue/milestones --jq '.[].title'
gh api repos/ninjasitm/mymarketingpro-vue/milestones -f title="v1.0" -f description="First release" -f due_on="2025-06-01T00:00:00Z"
Common Workflows
Triage New Issues
gh issue list --search "is:open no:label no:assignee sort:created-asc"
gh issue edit 123 --add-label "bug,priority:high" --add-assignee @me
Epic Pattern (using labels)
gh issue list --label "epic" --state open
cat > /tmp/epic-body.md <<'EOF'
- Login
- Registration
- Password reset
EOF
gh issue create --title "Epic: User Authentication" --label "epic" --body-file /tmp/epic-body.md
gh issue list --search "is:open label:story \"Authentication\""
Close with PR Reference
gh issue close 123 --comment "Fixed in #456"
Batch Operations
for id in 10 11 12; do gh issue close "$id" --comment "Superseded by #20"; done
for id in 10 11 12; do gh issue edit "$id" --add-label "backlog"; done
Common Flags
| Flag | Description |
|---|
--json | JSON output with field selection |
--jq | Filter JSON output with jq expressions |
--web | Open in browser |
--limit | Max results to return |
--search | Search query with GitHub qualifiers |
--state | Filter by state (open, closed, all) |
--label | Filter by label |
--assignee | Filter by assignee |
--milestone | Filter by milestone |
Output Formatting
| Command | Use Case |
|---|
gh issue list --json number,title | JSON for scripting |
gh issue list --json number,title --jq '.[].title' | Extract specific fields |
gh issue view 123 --json body --jq '.body' | Get issue body only |
Limitations
- Requires
gh auth login before first use
- GitHub Projects (v2) require separate
gh project commands
- Rate limits: 5000 requests/hour for authenticated users
- Sub-issues require GitHub's sub-issues feature (beta)
- Epic patterns rely on label conventions, not native epics