gh
БесплатноБез исполняемых скриптовНе проверенPatterns for invoking the GitHub CLI (gh) from agents. Covers structured output, pagination, repo targeting, search vs list, gh api fallback.
от cli★ 47 389 звёзд на GitHubОб этом скилле
Reference
Interactivity policy
gh already does the right thing in non-TTY contexts: it skips the pager,
strips ANSI color, and errors out fast with a helpful message instead of
prompting (e.g. must provide --title and --body when not running interactively).
You don't need to defensively set GH_PAGER or pass --no-pager (no such
flag exists).
Parsing JSON
Human output from gh is column-formatted. If you want structured data:
- Add
--json field1,field2,...for structured output. - For
gh issue viewandgh pr view, use--json ...,commentsto include comments in structured data; use--commentsonly with the human-readable view. - Run a command with
--jsonand no field list to print the full set of available fields, then pick what you need. - Use
--jq '<expr>'for filtering without piping through a separatejq. - Use
--template '<go-template>'(alongside--json) when you want shaped text output. Note that--template/-Tcollides with a body-template flag on a few commands (e.g.gh pr create -T,gh issue create -T); always check--helpbefore assuming which one you're hitting.
Pagination and silent truncation
List commands cap results.
gh issue list,gh pr list,gh search ...: pass-L N(--limit N). The default is usually 30.gh issue list/gh pr listdo not expose aggregate totals liketotalCountvia--json. If you need a true total, usegh api graphqlto querytotalCount; otherwise, treat-Las the cap for the current call.- For raw API calls use
gh api --paginate <path>. Combine with--jqand (optionally)--slurpto assemble one array.
Repo targeting
gh infers the repo from the cwd's git remotes.
Pass --repo OWNER/REPO (-R) to override the resolved CWD repo.
Search vs list
gh search issues|prs|code|repos|commits|usersuses GitHub's search index and accepts the full search syntax (is:open,author:,label:,repo:owner/name,in:title, ...). Pass each qualifier as its own bare token, not as one quoted string:gh search issues repo:cli/cli is:open author:monalisaworks, butgh search issues "repo:cli/cli is:open"is treated as a single keyword (parsed asrepo:"cli/cli is:open") and fails withInvalid search query. Quote only multi-word free text (gh search issues "broken feature"). Most qualifiers also have a dedicated flag (--repo,--author,--label, ...). Prefer search for anything cross-repo or filtered by author/label.gh issue list --search "..."andgh pr list --search "..."take the query as one quoted string (it is a flag value) and are scoped to one repo.- Bots author as GitHub Apps, so
--author dependabotmatches nothing. Use--app dependabot(onpr/issue listandsearch prs|issues; expands toauthor:app/<slug>) or--author "dependabot[bot]". gh search issuesalso takes--search-type <lexical|semantic|hybrid>(github.com/GHEC only, issues only): usesemanticwhen the user describes a problem in natural language rather than exact terms, andhybridto blend keyword and semantic ranking;lexical(default) is exact matching.
Issue types, sub-issues, and relationships
Newer gh issue subcommands model issue types, sub-issue hierarchy, and
blocked-by/blocking relationships.
gh issue create:--type <name>,--parent <number|url>(creates the new issue as a sub-issue),--blocked-by <number|url,...>,--blocking <number|url,...>.gh issue edit(edits one or more issues in the same repo, e.g.gh issue edit 23 34):--type <name>/--remove-type,--parent <n|url>/--remove-parent,--add-sub-issue <n,n>/--remove-sub-issue <n,n>,--add-blocked-by <n,n>/--remove-blocked-by <n,n>,--add-blocking <n,n>/--remove-blocking <n,n>. Relationship and parent refs are issue numbers or URLs; a URL may point to another repo on the same host, but a different host is rejected.--add-sub-issuecannot be used when editing more than one issue.gh issue list --type <name>filters by issue type.gh issue viewandgh issue listaccept these as--jsonfields (prefer them over scraping the default text output):issueType,parent,subIssues,subIssuesSummary,blockedBy,blocking.subIssues,blockedBy, andblockingare objects shaped{"nodes": [...], "totalCount": N}(not flat arrays), andnodesis capped (subIssuesat 100,blockedBy/blockingat 50), so compare the node count againsttotalCountto detect truncation.- GHES: issue types and sub-issues need 3.17+; blocked-by/blocking relationships need 3.19+.
Attaching images and videos
--attach <path> is available on gh issue create, gh issue edit,
gh issue comment, gh pr create, gh pr edit, gh pr comment,
gh issue artifact create, and gh issue artifact edit.
- Repeat
--attachto upload multiple files: `gh issue comment 12 -
Установить gh в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл gh?
Patterns for invoking the GitHub CLI (gh) from agents. Covers structured output, pagination, repo targeting, search vs list, gh api fallback.
Как установить скилл gh?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл gh запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This 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…
от Anthropic