github-cli
GitHub CLI (gh) reference for issues, PRs, and API calls
от eltmon★ 36 звёзд на GitHub
Установить github-cli в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
GitHub CLI (gh) Reference
Use gh CLI for all GitHub operations. Anthropic recommends gh CLI over GitHub MCP servers for Claude Code since you already have shell access.
Common Pitfalls
Invalid JSON fields cause errors
--json only accepts specific fields per command. Using invalid fields (e.g., stateReason) causes the command to fail and may cancel sibling tool calls.
Always use fields from the valid lists below. When in doubt, run gh <command> --json with no field names to see the valid list.
Non-interactive mode
gh commands that prompt for input will hang in automated contexts. Always provide all required flags explicitly:
gh pr createneeds--titleand--bodygh issue createneeds--titlegh pr mergeneeds a merge strategy flag (--merge,--squash, or--rebase)
Issue Commands
gh issue list
gh issue list --state open --limit 50
gh issue list --label "bug" --assignee "@me"
gh issue list --search "error sort:created-asc"
gh issue list --json number,title,state,labels
Flags: -s/--state {open|closed|all}, -l/--label, -a/--assignee, -A/--author, -m/--milestone, -S/--search, -L/--limit, --json, -R/--repo
Valid --json fields:
assignees, author, body, closed, closedAt, comments, createdAt, id, labels, milestone, number, projectCards, projectItems, reactionGroups, state, title, updatedAt, url
gh issue view
gh issue view 123
gh issue view 123 --json number,title,state,body
gh issue view 123 --comments
Valid --json fields: Same as gh issue list.
NOT valid: stateReason, closedBy, reactions, timeline
gh issue create
gh issue create --title "Bug: X" --body "Description"
gh issue create --title "Feature" --label "enhancement" --assignee "@me"
Flags: -t/--title, -b/--body, -F/--body-file, -l/--label, -a/--assignee, -m/--milestone, -p/--project
gh issue close
gh issue close 123
gh issue close 123 --reason "completed"
gh issue close 123 --comment "Fixed in PR #456"
Flags: -r/--reason {completed|not planned}, -c/--comment
gh issue edit
gh issue edit 123 --title "New title"
gh issue edit 123 --add-label "bug" --remove-label "triage"
gh issue edit 123 --add-assignee "@me"
Pull Request Commands
gh pr list
gh pr list --state open
gh pr list --json number,title,state,headRefName
gh pr list --head feature/pan-123
Flags: -s/--state {open|closed|merged|all}, -B/--base, -H/--head, -l/--label, -a/--assignee, -A/--author, -S/--search, -L/--limit, --json
Valid --json fields:
additions, assignees, author, autoMergeRequest, baseRefName, body, changedFiles, closed, closedAt, comments, commits, createdAt, deletions, files, headRefName, headRefOid, headRepository, headRepositoryOwner, id, isCrossRepository, isDraft, labels, latestReviews, maintainerCanModify, mergeCommit, mergeStateStatus, mergeable, mergedAt, mergedBy, milestone, number, potentialMergeCommit, projectCards, projectItems, reactionGroups, reviewDecision, reviewRequests, reviews, state, statusCheckRollup, title, updatedAt, url
gh pr view
gh pr view 456
gh pr view 456 --json number,title,state,mergeStateStatus,reviews
Valid --json fields: Same as gh pr list.
gh pr create
gh pr create --title "feat: Add X" --body "## Summary\n- Added X\n\n## Test plan\n- [ ] Test Y"
gh pr create --title "fix: Bug" --body "Fixes #123" --label "bug"
gh pr create --fill # auto-fill from commit messages
Flags: -t/--title, -b/--body, -F/--body-file, -B/--base, -H/--head, -l/--label, -r/--reviewer, -a/--assignee, -m/--milestone, -d/--draft, -f/--fill
Use HEREDOC for multi-line body:
gh pr create --title "feat: X" --body "$(cat <<'EOF'
## Summary
- Change 1
## Test plan
- [ ] Verify X
EOF
)"
gh pr merge
gh pr merge 456 --squash --delete-branch
gh pr merge 456 --merge
gh pr merge 456 --rebase
Flags: -m/--merge, -s/--squash, -r/--rebase, -d/--delete-branch, --auto, -b/--body, -t/--subject
Must specify one of: --merge, --squash, or --rebase
gh pr close
gh pr close 456
gh pr close 456 --delete-branch
gh pr checkout
gh pr checkout 456
API Commands
gh api
For operations not covered by gh issue or gh pr, use the REST API directly:
# Get PR comments
gh api repos/{owner}/{repo}/pulls/123/comments
# Get PR review comments
gh api repos/{owner}/{repo}/pulls/123/reviews
# Get issue timeline events
gh api repos/{owner}/{repo}/issues/123/timeline
# Add a comment
gh api repos/{owner}/{repo}/issues/123/comments -f body="Comment text"
# Get repo info
gh api repos/{owner}/{repo}
{owner} and {repo} are auto-f
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
- 01
Bash - 02
Read
FAQ
Что делает скилл github-cli?
GitHub CLI (gh) reference for issues, PRs, and API calls
Как установить скилл github-cli?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл github-cli запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…