agentleFS
zkmakezkmake/skills/skills/github/gh-cli/SKILL.md

gh-cli

Skill2 starsChanged 57 days agoMITView on GitHub

Deep operational knowledge of the GitHub CLI (`gh` command) sourced from the official manual at cli.github.com/manual. Use this skill WHENEVER a task involves GitHub via the terminal: opening/merging/reviewing pull requests, filing or editing issues, creating releases, triggering or watching GitHub Actions workflow runs, downloading run artifacts, managing labels/secrets/ variables/projects, forking/cloning/creating repos, or hitting the GitHub REST/GraphQL API with `gh api`. Trigger even when the user doesn't say "gh" explicitly but clearly wants a GitHub operation done from the command line (e.g. "open a PR for this branch", "merge #42 and delete the branch", "what CI checks are failing", "make a release from this tag", "set a repo secret", "rerun the failed jobs"). Covers correct non-interactive flags for scripting, `--json`/`--jq`/`--template` output, and the `gh api` escape hatch for anything the porcelain commands don't expose.

  • Commits and pushes

22 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use glab-cli, git-commit and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • DataKnifeAISkill

    glab-cli

    Uses the GitLab CLI (`glab`) for merge requests, issues, CI/CD, releases, and GitLab API access from the terminal. Apply when the remote is GitLab (GitLab.com or self-managed) or when the user mentions MRs, pipelines, or GitLab projects.

    Also in 3 projects that use this

  • GitHubSkill

    git-commit

    Execute git commit with conventional commit message analysis, intelligent staging, and message generation. Use when user asks to commit changes, create a git commit, or mentions "/commit". Supports: (1) Auto-detecting type and scope from changes, (2) Generating conventional commit messages from diff, (3) Interactive commit with optional type/scope/description overrides, (4) Intelligent file staging for logical grouping

    Also in 4 projects that use this

  • MicrosoftSkill

    skill-creator

    Guide for creating effective GitHub Copilot skills (.github/skills/) in this repository. Use when creating a new skill, updating an existing skill, or when asked about skill structure, format, or best practices for the vscode-documentdb project.

    Also in 9 projects that use this

  • VercelSkill

    frontend-design

    Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML/CSS layouts, or when styling/beautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics.

    Also in 6 projects that use this

  • OpenAISkill

    writing-plans

    Use when you have a spec or requirements for a multi-step task, before touching code

    Also in 3 projects that use this

  • AnthropicSkill

    pptx

    Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions \"deck,\" \"slides,\" \"presentation,\" or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 0 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 15 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Targeting a different repo: every command accepts -R OWNER/REPO (or --repo).

    line 51
  2. Very specific:

    If you already know the exact flags for a routine command (gh pr create --fill, gh pr checks), just run it.

    line 70
  3. Very specific:

    Body text with special characters: prefer --body-file / -F - over inline --body to avoid the shell mangling backticks, $, quotes, newlines.

    line 125

“Common” is measured: kept by at least 6 in 10 of the 15 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

GitHub CLI (gh)

This skill makes you fluent with gh: pick the right subcommand, drive it non-interactively, and reach for gh api when a porcelain command can't do the job. Detailed per-command flag references live in references/ — load the one that matches the task instead of guessing flag names.

Operating principles

Run non-interactively by default. Most gh subcommands drop into an interactive prompt when required fields are missing. In an agent session that prompt hangs. So always supply the flags that make a command complete on its own: --title/--body for create commands, a merge strategy (--squash etc.) for gh pr merge, --yes for destructive commands. If a body is long or multi-line, write it to a temp file and pass --body-file <file> (or -F - to read stdin) rather than fighting shell quoting.

Prefer gh over raw git for anything server-side. Creating PRs, reading checks, merging, releases, issues — these are GitHub operations, not git operations. Reserve git for local history work (commit, rebase, branch).

Scripting → --json + --jq. Whenever you need to read a value out of gh to use it programmatically, request JSON and filter it. Don't parse the human-formatted table output. To discover which fields exist, run the command with --json and no field list — it prints the available field names. Example: gh pr view 42 --json state,mergeable --jq '.state'.

gh api is the escape hatch. The porcelain commands cover the common 90%. For everything else (arbitrary REST endpoints, GraphQL, settings the CLI doesn't surface), use gh api. {owner}/{repo}/{branch} placeholders auto-fill from the current repo. See references/core.md.

Targeting a different repo: every command accepts -R OWNER/REPO (or --repo). Without it, gh infers the repo from the current directory's git remote, or from $GH_REPO. When the user names a repo that isn't the cwd, pass -R.

Check auth first if anything 401s. gh auth status shows the active account and token scopes. Missing scope is the usual cause of permission errors — fix with gh auth refresh -s <scope> (e.g. project, delete_repo, write:org).

Command map — which reference to load

TaskCommandsReference
Auth, gh api (REST/GraphQL), config, aliases, extensions, env vars, exit codesgh auth, gh api, gh config, gh alias, gh extensionreferences/core.md
Pull requests: create, review, merge, checkout, diff, checks, editgh pr *references/pr.md
Issues, labels, Projects v2, searchgh issue, gh label, gh project, gh searchreferences/issues.md
GitHub Actions: runs, workflows, cache, secrets, variablesgh run, gh workflow, gh cache, gh secret, gh variablereferences/actions.md
Repos, releases, gists, browse, status, codespaces, rulesets, attestationgh repo, gh release, gh gist, gh browse, gh status, gh codespacereferences/repo-release.md

If you already know the exact flags for a routine command (gh pr create --fill, gh pr checks), just run it. Load the reference when you're unsure of a flag name, need a less-common subcommand, or want the scripting/JSON details.

High-frequency workflows

These are the patterns that come up constantly. Each links to deeper coverage.

Open a PR for the current branch (fills title/body from commits, no prompt):

gh pr create --fill
# add reviewers/labels/draft as needed:
gh pr create --fill --reviewer octocat --label enhancement --draft

See why CI is red, then read the failing log:

gh pr checks                       # status of all checks on current branch's PR
gh run view --log-failed           # failing step logs for the latest run
gh run watch <run-id> --exit-status # block until done; nonzero exit on failure

Approve and merge, cleaning up the branch:

gh pr merge <number> --squash --delete-branch

File an issue non-interactively:

gh issue create --title "Login fails on Safari" --body-file repro.md --label bug

Cut a release with auto-generated notes and assets:

gh release create v1.2.3 --generate-notes ./dist/*.tar.gz

Trigger a workflow_dispatch with inputs:

gh workflow run deploy.yml --ref main -f environment=production

Read a value out of the API for scripting:

gh api repos/{owner}/{repo} --jq '.default_branch'

Gotchas worth remembering

  • Confirm before destructive/outward-facing actions. Merging, closing, deleting, force-syncing, and changing repo visibility are hard to undo and visible to others. Unless the user already authorized it, confirm first — and never add --yes/--admin/--force on your own initiative.
  • @me works as the current user in --assignee, --author, and search filters — handy for "my PRs", "issues assigned to me".
  • Body text with special characters: prefer --body-file / -F - over inline --body to avoid the shell mangling backticks, $, quotes, newlines.
  • Job IDs for gh run rerun --job are databaseId, not the number in the web URL. Get them via gh run view <id> --json jobs.
  • gh pr checks exit code 8 means checks are still pending (not failed) — useful in scripts that distinguish "running" from "broken".
  • Auto-merge vs immediate merge: gh pr merge --auto queues the merge for when checks pass; without --auto it merges now (and errors if not mergeable).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.