GitHub CLI

SkillAI & models

Safety-first GitHub CLI skill wrapping `gh` (v2.86+). Use when performing GitHub operations — PRs, issues, releases, repos, Actions, API calls. Enforces risk classification with mandatory confirmation for destructive/forbidden operations.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the GitHub CLI skill

What this skill tells your AI

The instructions your AI receives, as published by georgekhananaev/claude-skills-vault in .claude/skills/github-cli/SKILL.md and read by ahel’s review.

Safety-first wrapper for GitHub CLI (gh). Every command is classified by risk level before execution.

When to Use

  • User asks to create, list, merge, or close PRs
  • User asks to manage issues, releases, or repos
  • User asks to check CI/CD status or workflow runs
  • User asks to call the GitHub API via gh api
  • User asks to manage GitHub Actions secrets or variables

Prerequisites

  1. Install: brew install gh or see https://cli.github.com
  2. Auth: gh auth login
  3. Verify: gh --version (requires v2.86+)
  4. Scopes: gh auth status — confirm repo, read:org scopes minimum

Safety Model

Every gh command falls into one of four risk tiers:

TierAction RequiredExamples
SafeExecute immediatelygh pr list, gh issue view, gh repo view
WriteInform user, then executegh pr create, gh issue create, gh release create
DestructiveAskUserQuestion BEFORE executinggh pr merge, gh pr close, gh release delete
ForbiddenMulti-step validation, NEVER auto-confirmgh repo delete, gh repo transfer, visibility changes

See references/safety-rules.md for the full classification and confirmation templates.

Decision Flow

Command received
  → Classify risk tier (see Quick Reference)
  → Safe?        Execute immediately
  → Write?       Inform user what will happen → execute
  → Destructive? AskUserQuestion with options → wait for answer → execute or cancel
  → Forbidden?   Warn → require typed confirmation → final confirm → execute or cancel

Quick Reference

Safe (read-only, execute immediately)

CommandDescription
gh pr listList pull requests
gh pr viewView PR details
gh pr checksView CI status
gh pr diffView PR diff
gh issue listList issues
gh issue viewView issue details
gh repo viewView repo info
gh repo listList repos
gh repo cloneClone a repo
gh release listList releases
gh release viewView release details
gh run listList workflow runs
gh agent-task list / viewList/inspect Copilot coding-agent tasks (v2.80+)
gh run viewView run details
gh run view --logView run logs
gh workflow listList workflows
gh workflow viewView workflow details
gh run downloadDownload workflow artifacts
gh api (GET)Read-only API calls
gh auth statusCheck auth
gh browseOpen repo in browser
gh statusCheck your GitHub dashboard
gh gist listList your gists
gh gist viewView gist details
gh label listList labels
gh search reposSearch repos
gh search issuesSearch issues
gh search prsSearch PRs
gh search codeSearch code

Write (inform, then execute)

CommandDescription
gh pr createCreate PR
gh agent-task createKick off a Copilot coding-agent session (opens PRs on your repo — inform user; v2.80+)
gh skill installInstall an agent skill (gh skill is public preview, Apr 2026)
gh pr editEdit PR metadata
gh pr commentComment on PR
gh pr reviewSubmit review
gh pr readyMark PR as ready
gh pr checkoutCheck out a PR branch locally
gh issue createCreate issue
gh issue editEdit issue
gh issue commentComment on issue
gh issue reopenReopen a closed issue
gh issue pinPin an issue
gh issue unpinUnpin an issue
gh label createCreate label
gh label editEdit label
gh release createCreate release
gh repo createCreate new repo
gh repo editEdit repo settings (non-visibility)
gh repo forkFork a repo
gh repo renameRename a repository
gh gist createCreate a new gist
gh gist editEdit an existing gist
gh run rerunRe-run workflow
gh workflow enableEnable workflow
gh workflow disableDisable workflow
gh workflow runManually trigger a workflow
gh secret setSet secret
gh variable setSet variable
gh api -X POST/PUT/PATCHWrite API calls

Destructive (AskUserQuestion required)

CommandDescription
gh pr mergeMerge PR (irreversible in most workflows)
gh pr closeClose PR
gh issue closeClose issue
gh issue deleteDelete issue (permanent)
gh issue transferTransfer issue to another repo
gh release deleteDelete release
gh label deleteDelete label
gh repo archiveArchive repo
gh secret deleteDelete secret
gh variable deleteDelete variable
gh auth logoutLog out of GitHub CLI
gh run cancelCancel running workflow
gh api -X DELETEDelete API calls

Forbidden (multi-step validation)

CommandDescription
gh repo deleteDelete repository (PERMANENT)
gh repo transferTransfer repo ownership
gh repo edit --visibilityChange repo visibility
Bulk destructive loopsAny loop running delete/close/merge

Workflow Patterns

Pull Requests

# List open PRs
gh pr list

# Create PR (Write — inform user first)
gh pr create --title "feat: add auth" --body "$(cat <<'EOF'
## Summary
- Add JWT authentication middleware

## Test plan
- [ ] Unit tests pass
- [ ] Manual login flow verified
EOF
)"

# View PR with checks
gh pr view 42
gh pr checks 42

# Merge PR (Destructive — AskUserQuestion first)
gh pr merge 42 --squash --delete-branch

Issues

# List issues with filters
gh issue list --label bug --assignee @me
gh issue list --state closed --limit 10

# Create issue (Write)
gh issue create --title "Bug: login fails" --body "Steps to reproduce..." --label bug

# View issue
gh issue view 123

# Close issue (Destructive — confirm first)
gh issue close 123 --reason completed

Releases

# List releases
gh release list

# Create release (Write — inform user)
gh release create v1.2.0 --generate-notes --title "v1.2.0"

# Create release with assets
gh release create v1.2.0 ./dist/*.tar.gz --title "v1.2.0" --notes "Release notes here"

# Delete release (Destructive — confirm first)
gh release delete v1.2.0

CI/CD & Actions

# List recent runs
gh run list --limit 10

# View specific run
gh run view 12345

# View logs for failed run
gh run view 12345 --log-failed

# Re-run failed jobs (Write)
gh run rerun 12345 --failed

# Cancel running workflow (Destructive — confirm)
gh run cancel 12345

# Manage secrets (Write for set, Destructive for delete)
gh secret set API_KEY --body "sk-..."
gh secret list

Repository

# View repo info
gh repo view

# Create repo (Write)
gh repo create my-app --public --clone

# Clone
gh repo clone owner/repo

# Fork (Write)
gh repo fork owner/repo --clone

# Archive (Destructive — confirm first)
gh repo archive owner/repo

API

# GET (Safe)
gh api repos/owner/repo/pulls
gh api repos/owner/repo/issues/123/comments

# POST (Write)
gh api repos/owner/repo/issues -f title="Bug" -f body="Description"

# DELETE (Destructive — confirm first)
gh api repos/owner/repo/issues/123/labels/bug -X DELETE

Self-Healing

gh evolves monthly. On any error: read it → gh help <command> → if still unclear, WebFetch https://cli.github.com/manual/gh_<command> (underscores join subcommands, e.g. gh_pr_merge) → adjust → re-run. Release notes: https://github.com/cli/cli/releases.

AskUserQuestion Integration

For Destructive operations, use AskUserQuestion with tailored options:

PR Merge Example

Question: "How should PR #42 'feat: add auth' be merged?"
Options:
  - "Squash and merge" — Combine all commits into one
  - "Create merge commit" — Preserve commit history
  - "Rebase and merge" — Rebase onto base branch
  - "Cancel" — Do not merge

PR/Issue Close Example

Question: "Close PR #42 'feat: add auth'?"
Options:
  - "Close only" — Close without deleting branch
  - "Close and delete branch" — Close PR and remove source branch
  - "Cancel" — Keep open

Delete Example

Question: "Delete release v1.2.0?"
Options:
  - "Delete release only" — Keep the git tag
  - "Delete release and tag" — Remove both release and git tag
  - "Cancel" — Keep release

For Forbidden operations, follow the triple-confirmation protocol in references/safety-rules.md.

Error Handling

ErrorCauseFix
gh: command not foundNot installedbrew install gh
authentication requiredNot logged ingh auth login
HTTP 403Insufficient scopesgh auth refresh -s scope
HTTP 404Repo not found or no accessCheck repo name and permissions
HTTP 422Validation failedCheck required fields, branch exists
HTTP 409Merge conflictResolve conflicts first
HTTP 429Rate limitedWait, or use --limit to reduce calls
GraphQL: ...API query errorCheck field names and types

CLI Flags Reference

FlagDescription
--json fieldsOutput specific JSON fields
--jq exprFilter JSON with jq expressions
--template tmplFormat output with Go templates
-R owner/repoTarget a different repo
--limit NLimit results
--state open|closed|allFilter by state
--label nameFilter by label
--assignee userFilter by assignee
--author userFilter by author
--webOpen in browser

Shell Safety

  • No interactive mode: Never use -i or --interactive flags
  • No pagers: Always pipe to cat if output may trigger a pager: gh pr list | cat
  • Timeouts: Set reasonable timeouts for commands that could hang
  • Quote arguments: Always quote multi-word arguments and heredoc bodies
  • Never pass --yes to forbidden operations — always require explicit confirmation

Integration

Pairs with:

  • code-quality — Review code before PR creation
  • brainstorm — Design features before opening issues
  • codex-cli — Second-opinion audit before merging PRs
  • gemini-cli — Alternative AI review for PR changes

Signals

GitHub stars
28
Forks
10
Last commit
Aug 2026

ahel review

  • S4info
    community integration — published by georgekhananaev, not github

Automated review, not a security audit. Ruleset v1.

Advanced
Catalog kind
skill
Gateway key
github-cli
Source
github.com/georgekhananaev/claude-skills-vault