GitHub's gh CLI is usually the fastest and safest way for an agent to work with GitHub. This skill exists to make those gh interactions more reliable: fewer manual steps, fewer malformed PR bodies, fewer guessed JSON fields, and fewer dead-end retries after permission errors.
npx skills add zeke/faster-gh-cli-skill-
Always establish auth, repo, and branch context before reading or changing GitHub state.
-
Use
--repo owner/namewhenever the target repo is not unambiguous from the current working directory. -
Use
--jsonand--jqfor structured reads, plus a safe way to discover valid JSON fields when the agent is unsure. -
Known JSON field gotchas from real sessions:
defaultBranchshould bedefaultBranchRef,stargazersCountshould bestargazerCount,topicsis not agh repo viewfield, and some search results do not expose fields likemergedAt. -
Safe Markdown bodies for PRs, issues, comments, and gists using single-quoted heredocs so shell backticks in Markdown do not execute as commands.
-
PR workflows: inspect branch state before
gh pr create, use--head user:branchfor forks, avoid retrying branch errors blindly, and use supported diff/check commands. -
Actions workflows: use
gh pr checks,gh run list,gh run view --log-failed, and avoid unattendedgh run watchunless waiting is explicitly part of the task. -
gh apitype handling: use--field enabled:=truefor booleans,--raw-fieldfor strings, and--inputfor complex JSON. Avoid sending string booleans to APIs that require real booleans. -
Secret handling: list secret names safely and set secret values from environment variables, never hardcode them in commands or files.
-
Gist gotchas:
gh gist create --privateis not a valid flag; omit--publicfor a secret gist.
This skill was built by mining OpenCode's local session history: a SQLite database of tool calls and responses across many months of real GitHub CLI work.
The analysis covered:
- 1,228 bash tool invocations beginning with
gh - The most common successful commands, including
gh pr create,gh pr view,gh run view,gh issue view,gh issue create,gh repo view,gh pr list,gh pr checks, andgh api - Failure clusters for invalid JSON fields, invalid flags, shell quoting bugs, GraphQL permission errors, HTTP 422 request-shape errors, network failures, clone timeouts, and unattended auth refresh flows
- Real command bodies that succeeded, especially the heredoc pattern for multiline PR, issue, and comment text
- Current
ghbehavior on this machine withgh version 2.92.0 - The Agent Skills specification and authoring guidance from agentskills.io
The raw session logs are not included. The skill contains only distilled command patterns and aggregate findings.
MIT