← ClaudeAtlas

gh-cli-patternslisted

Canonical reference for all gh CLI command shapes used by skills in this plugin. Defines the placeholder convention, allowed --json fields, GraphQL fallback rules, -f/-F/--raw-field flag semantics, the PR-readiness gate, code-scanning alert query, review-thread fetch/count/resolve mutations, and heredoc bodies. Prevents Unknown JSON field errors and divergent query shapes.
JacobPEvans/claude-code-plugins · ★ 3 · AI & Automation · score 69
Install: claude install-skill JacobPEvans/claude-code-plugins
# gh CLI Canonical Patterns — github-workflows ## Placeholder Convention Two visually distinct notations — never mix them up: | Notation | Meaning | Example | |---|---|---| | `$varName` | GraphQL variable name — **keep as literal text** in the query body | `$prNumber` | | `<UPPER_NAME>` | Shell template — **replace before running** | `<PR_NUMBER>` | Standard replacements: ```text <OWNER> → $(gh repo view --json owner --jq '.owner.login') <REPO> → $(gh repo view --json name --jq '.name') <PR_NUMBER> → $(gh pr view --json number --jq '.number') (integer) <THREAD_ID> → PRRT_* node ID from the fetch-threads query (string) <DATABASE_ID> → numeric comment ID from the fetch-threads query ``` ## `gh pr view --json` — REST-Only `reviewThreads` is **not** a valid `--json` field — it is GraphQL-only. Any `gh pr view --json reviewThreads` call fails with `Unknown JSON field: "reviewThreads"`. Other GraphQL-only fields: inline thread structure, resolution status, full `mergeStateStatus` enum. **Rule**: if the field isn't returned by `gh pr view --json` (no value), use `gh api graphql`. ## REST vs GraphQL | Operation | Use | |---|---| | Fetch unresolved threads | GraphQL — see Canonical Review-Thread Queries | | Verify thread resolution count | GraphQL — see Canonical Review-Thread Queries | | Resolve a thread | GraphQL — `resolveReviewThread` mutation | | Reply to a thread | GraphQL (`addPullRequestReviewThreadReply`) or REST (simpler for markdown/special ch