github-cli

GitHub CLI workflows for repositories, issues, pull requests, actions, releases, projects, and API calls. Use when creating PRs, reviewing code, triaging issues, triggering workflows, publishing releases, managing projects, verifying attestations, or querying the GitHub API. Use for gh cli, github automation, code review, release management.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "github-cli" with this command: npx skills add oakoss/agent-skills/oakoss-agent-skills-github-cli

GitHub CLI Skill

Provides patterns for the gh CLI to interact with GitHub repositories, services, and APIs directly from the terminal. Covers authentication, repository management, issues, pull requests, actions, releases, projects, search, and the REST/GraphQL API. Git workflow patterns (branching, commits, CI/CD) are handled by a separate skill.

Quick Reference

AreaKey Commands
Authgh auth status, gh auth login, gh auth token
Reposgh repo clone, gh repo create, gh repo fork, gh repo sync
Browsegh browse, gh browse --settings, gh browse file.ts:42
Issuesgh issue list, gh issue create, gh issue edit, gh issue close
Pull Requestsgh pr create, gh pr review, gh pr merge, gh pr checkout
Actionsgh run list, gh run view, gh workflow run, gh cache list
Releasesgh release create, gh release list, gh release verify
Projectsgh project list, gh project create, gh project item-add
Searchgh search repos, gh search issues, gh search code
APIgh api repos/{owner}/{repo}, gh api graphql
Securitygh attestation verify, gh ruleset list, gh secret set
Statusgh status, gh pr checks, gh pr status
Codespacesgh codespace create, gh codespace ssh, gh codespace code

Common Workflows

WorkflowCommands
Quick PRgit push -u origin feat then gh pr create --fill
Draft PRgh pr create --draft --fill then gh pr ready when done
Review and mergegh pr checkout 45 then gh pr review --approve then gh pr merge --squash --delete-branch
Auto-merge PRgh pr merge --auto --squash (waits for required checks to pass)
Check CIgh pr checks then gh run watch
Rerun failed CIgh run rerun <run-id> --failed
Create releasegh release create v1.0.0 --generate-notes
Search codegh search code "handleAuth" --repo owner/repo
Add issue to projectgh project item-add 1 --owner @me --url <issue-url>
Verify artifactgh attestation verify artifact.tar.gz --owner owner
Trigger workflowgh workflow run deploy.yml -f environment=production
Revert merged PRgh pr revert 45
Sync forkgh repo sync to update fork from upstream

Output Formatting

Most gh list and view commands support structured output for scripting and automation.

FlagPurpose
--jsonOutput specified fields as JSON
--jqFilter JSON with jq expressions
-tFormat JSON with Go templates
--webOpen the resource in a browser
--commentsInclude comments (issues and PRs)

Scoping: Repo, Env, Org

Secrets and variables can be scoped to different levels.

ScopeFlag Example
Repositorygh secret set KEY (default)
Environmentgh secret set KEY --env production
Organizationgh secret set KEY --org name --visibility

Project commands always require --owner @me or --owner org-name.

Authentication Prerequisites

The gh CLI requires authentication before most commands work. Run gh auth status to verify the current session. Missing scopes cause silent failures -- use gh auth refresh -s scope to add scopes without re-authenticating. For CI environments, set the GITHUB_TOKEN or GH_TOKEN environment variable instead of interactive login.

Common Mistakes

MistakeCorrect Pattern
Running gh pr create without pushing the branch firstPush with git push -u origin branch before creating a PR
Using gh pr merge without checking CI statusRun gh pr checks first or use gh pr merge --auto to wait for checks
Forgetting --fill when creating PRs from well-written commitsUse gh pr create --fill to auto-populate title and body from commits
Using REST API when GraphQL is more efficient for nested dataUse gh api graphql for queries needing related objects in one call
Not authenticating with correct scopesRun gh auth status to verify scopes, gh auth refresh -s scope to add
Using gh project commands without specifying --ownerAlways pass --owner @me or --owner org-name for project commands
Manually downloading CI artifactsUse gh run download <run-id> to download artifacts programmatically
Not using --json for scriptingAdd --json field1,field2 and --jq for machine-readable output
Merging without --delete-branchUse gh pr merge --squash --delete-branch to clean up after merge
Running gh api POST without -f fieldsUse -f key=value for string fields, -F for typed fields

Delegation

  • Search across repositories for code patterns or issues: Use Explore agent with gh search code and gh search issues
  • Automate multi-step release workflows: Use Task agent to coordinate branch creation, PR merge, and release publishing
  • Plan repository structure and access controls: Use Plan agent to design team permissions, branch protection, and workflow architecture

References

  • Repos & Auth -- Authentication, repository management, configuration, extensions, aliases
  • Issues -- Issue CRUD, labels, assignments, pinning, transferring, development branches
  • Pull Requests -- PR creation, review, merge, checkout, checks, diff, auto-merge
  • Actions -- Workflow runs, manual triggers, secrets, variables, caches, artifact downloads
  • Releases & Search -- Releases, attestation verification, search, gists, SSH/GPG keys
  • Projects & API -- Projects v2 management, REST API, GraphQL API, rulesets, status

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

tanstack-cli

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

typescript-patterns

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

tanstack-devtools

No summary provided by upstream source.

Repository SourceNeeds Review