github-cli-ops
Skill3 starsChanged 14 days agoApache-2.0View on GitHub
Operate GitHub platform workflows through the official `gh` CLI and `gh api`, while using plain `git` for repository, branch, remote, clone, fetch, pull, push, checkout, tag, status, diff, log, and commit operations that Git already handles. Use for GitHub repo hosting/settings, issue, pull request, Actions, release, label, milestone, discussion, project, secret, variable, webhook, branch protection, search, gist, notification, and REST/GraphQL API workflows. If the user only asks to stage, commit, or organize local Git changes, use git-auto-commit instead.
- Reads credentials
- Deletes or force-pushes
- Commits and pushes
1 other project uses a version of this.
Adopted by
Most recently taken up by
- bm629/agent-skillstheir own version, first seen Aug 21, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- bm629/agent-skills★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository11 other files it gives its agents.
- .codex/AGENTS.mdAGENTS.md
- codebase-designSkill
- develop-uniapp-miniappSkill
- diagnosing-bugsSkill
- domain-modelingSkill
- frontend-designSkill
- git-auto-commitSkill
- harness-engineeringSkill
- release-opsSkill
- tddSkill
- wechat-miniprogram-ci-uploadSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
50 rules. About 0 are common, 27 are distinctive, and 23 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈27
Distinctive · estimate
This author's own choices. Worth a look.
23
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 16
Use git first for local repository state, refs, remotes, clones, fetches, pulls, pushes, checkouts, tags, diffs, logs, commits, merges, and …
- Very specific: line 17
Use gh only for GitHub platform objects and APIs: repos as hosted resources, issues, PR metadata/reviews/merge actions, Actions, releases, …
- Very specific: line 18
Use git-auto-commit for creating or organizing commits.
- Distinctive: line 19
Read before write: inspect current state, then perform the smallest necessary operation.
- Distinctive: line 20
Default to private and least exposure.
- Distinctive: line 22
Verify every write by reading the object back and reporting the final URL/state.
- Distinctive: line 26
Check Git before repository/ref operations:
- Distinctive: line 33
When using SSH remotes, verify GitHub SSH access before cloning or pushing:
- Very specific: line 40
If SSH is unavailable, use the repo's HTTPS URL from gh repo view or ask the user to configure SSH keys.
- Very specific: line 43
Check gh before GitHub platform operations:
- Very specific: line 51
If gh auth status reports no login, stop and tell the user to run:
- Very specific: line 57
Do not ask the user to paste tokens into chat.
- Distinctive: line 59
When operating in a local repository, also check:
- Distinctive: line 68
When a GitHub platform object is involved, also identify the hosted repo:
- Very specific: line 74
When outside a repository or when more than one remote could apply, require or infer an explicit OWNER/REPO and pass it with --repo …
- Very specific: line 78
Never print tokens, secret values, private keys, .env contents, or credential files.
- Very specific: line 79
Do not run git push --force unless the user explicitly asks for force push and the target branch is confirmed.
- Very specific: line 80
Do not change repository visibility, transfer/archive/delete a repository, delete branches/tags/releases, rotate or overwrite secrets, …
- Very specific: line 81
Do not use gh wrapper commands for work that git can do directly.
- Very specific: line 82
When creating commits, use the git-auto-commit skill's staging and commit-message rules.
- Very specific: line 83
Create and push Git tags with git.
- Very specific: line 84
Avoid implicit gh state. Do not use gh repo set-default unless the user explicitly wants to change the default repo.
- Very specific: line 89
After writes, read back the changed object with gh ...
- Very specific: line 194
Use gh api for GitHub website settings that have no first-class gh command.
- Distinctive: line 248
Check git status --short, current branch, and git remote -v.
- Very specific: line 249
If no remote exists and the user asked to create a GitHub repo, create only the hosted repo with gh, private by default:
- Distinctive: line 253
Read back the hosted repo and choose SSH or HTTPS URL:
- Distinctive: line 257
If using SSH, verify access:
- Very specific: line 262
Add the Git remote if origin does not exist:
- Very specific: line 266
If origin exists but points to the wrong repo, update it explicitly:
- Distinctive: line 270
Verify the remote points to the intended GitHub repo, then push with git:
- Very specific: line 274
Verify the hosted repo with gh repo view --json nameWithOwner,url,sshUrl,visibility,defaultBranchRef.
- Distinctive: line 279
Check existing issues to avoid duplicates:
- Distinctive: line 283
Create the body in a temporary Markdown file and run:
- Distinctive: line 287
Read the issue back and return the URL.
- Distinctive: line 291
Read the default branch from GitHub metadata:
- Distinctive: line 296
Check git status --short; do not commit unrelated changes.
- Very specific: line 297
If the task requires a new commit, use git-auto-commit before pushing.
- Distinctive: line 299
Create the PR with an explicit base and head:
- Distinctive: line 319
Before merging, confirm merge method, target branch, CI state, and whether to delete the head branch.
- Distinctive: line 324
Verify PR state after merge.
- Distinctive: line 337
Do not rerun workflows that deploy, release, or mutate external systems without confirming with the user.
- Distinctive: line 348
If the tag does not exist and the user asked to create it, create and push the tag with git:
- Distinctive: line 353
Create GitHub Releases as drafts by default:
- Distinctive: line 357
Do not publish a draft release or mark it latest without explicit user confirmation.
- Very specific: line 358
Verify the release with gh release view TAG.
- Distinctive: line 369
Verify by listing names and metadata only.
- Distinctive: line 377
If making anything public or broadly accessible, stop and ask for explicit confirmation.
- Distinctive: line 378
Run the smallest command needed.
- Very specific: line 379
Read back visibility or access metadata and report the final state.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
GitHub CLI Operations
Use this skill when the user wants the agent to operate GitHub through the official gh CLI. Prefer gh and gh api over browser automation for GitHub platform operations. Use plain git for version-control operations that Git can already perform. Use a browser only when the user needs a visual check, screenshot, login UI, or a GitHub website flow that cannot be completed through the CLI/API.
Established user authorization persists for the current task and stated target/impact; do not ask again solely because a later step says “confirm.” Complete safe preparation first. Read-only requests never authorize mutations, and an unclear target or uncovered production, permission, public-sharing, release, or destructive effect still requires explicit authorization.
Operating Model
- Resolve the target account, repository, branch, and GitHub object before changing anything.
- Use
gitfirst for local repository state, refs, remotes, clones, fetches, pulls, pushes, checkouts, tags, diffs, logs, commits, merges, and rebases. - Use
ghonly for GitHub platform objects and APIs: repos as hosted resources, issues, PR metadata/reviews/merge actions, Actions, releases, settings, secrets, variables, collaborators, teams, notifications, search, and REST/GraphQL calls. - Use
git-auto-commitfor creating or organizing commits; this skill may inspect Git state but should not invent commit-message policy. - Read before write: inspect current state, then perform the smallest necessary operation.
- Default to private and least exposure. Never make a repo, gist, package, Pages site, release asset, secret, or organization resource public unless the user explicitly asks.
- Confirm high-impact operations with the user before execution.
- Verify every write by reading the object back and reporting the final URL/state.
Preconditions
Check Git before repository/ref operations:
command -v git
git --versionWhen using SSH remotes, verify GitHub SSH access before cloning or pushing:
ssh -T git@github.com
git ls-remote git@github.com:OWNER/REPO.git HEADIf SSH is unavailable, use the repo's HTTPS URL from gh repo view or ask the user to configure SSH keys. Do not paste private keys into chat.
For ssh -T git@github.com, treat GitHub's "successfully authenticated" message as a pass even if the command exits non-zero because GitHub does not provide shell access.
Check gh before GitHub platform operations:
command -v gh
gh --version
gh auth statusIf gh auth status reports no login, stop and tell the user to run:
gh auth loginDo not ask the user to paste tokens into chat. Prefer browser/device-code login handled by gh. If an operation fails because of missing scopes, report the exact missing scope or permission and let the user re-authenticate with gh auth refresh.
When operating in a local repository, also check:
git rev-parse --show-toplevel
git status --short
git branch --show-current
git remote -vWhen a GitHub platform object is involved, also identify the hosted repo:
gh repo view --json nameWithOwner,url,sshUrl,visibility,defaultBranchRefWhen outside a repository or when more than one remote could apply, require or infer an explicit OWNER/REPO and pass it with --repo OWNER/REPO or -R OWNER/REPO for gh commands.
Safety Rules
- Never print tokens, secret values, private keys,
.envcontents, or credential files. - Do not run
git push --forceunless the user explicitly asks for force push and the target branch is confirmed. Prefer--force-with-leasewhen a force push is truly required. - Do not change repository visibility, transfer/archive/delete a repository, delete branches/tags/releases, rotate or overwrite secrets, change branch protection/rulesets, merge PRs, publish releases, rerun deployment workflows, or invite collaborators without confirming the target and impact with the user.
- Do not use
ghwrapper commands for work thatgitcan do directly. Prefergit clone,git remote,git fetch,git pull,git push,git checkout/git switch,git branch,git tag,git status,git diff,git log,git commit,git merge, andgit rebase. - When creating commits, use the
git-auto-commitskill's staging and commit-message rules. Do not create ad hoc English commit messages from this skill. - Create and push Git tags with
git; create, edit, draft, publish, and upload GitHub Releases withgh release. - Avoid implicit
ghstate. Do not usegh repo set-defaultunless the user explicitly wants to change the default repo. - For GitHub platform writes, prefer the current repo from
gh repo view; use explicit--repo OWNER/REPOwhen outside a repo or when ambiguity exists. - For output parsing, prefer
--json ... --jq ...over ad hoc text parsing. - For complex REST or GraphQL operations, use
gh apiwith the narrowest endpoint, method, and payload. - For long Markdown bodies, release notes, comments, or reviews, write a temporary file and use
--body-file,--notes-file, or stdin instead of shell-escaped inline text. - After writes, read back the changed object with
gh ... view,gh ... list, orgh apiand verify the expected state.
Common Commands
Git repository and ref operations:
git status --short
git remote -v
git remote add origin git@github.com:OWNER/REPO.git
git remote set-url origin git@github.com:OWNER/REPO.git
git clone git@github.com:OWNER/REPO.git
git fetch origin
git pull --ff-only
git push -u origin HEAD
git tag -a TAG -m "Message"
git push origin TAG
git fetch origin pull/NUMBER/head
git switch --detach FETCH_HEADGitHub repository platform operations:
gh repo view --json nameWithOwner,url,sshUrl,visibility,defaultBranchRef
gh repo create OWNER/REPO --private
gh repo edit OWNER/REPO --description "Description"
gh repo edit OWNER/REPO --visibility private --accept-visibility-change-consequences
gh repo edit OWNER/REPO --add-topic topic1 --add-topic topic2Issues:
gh issue list --state open --limit 20 --json number,title,state,url,labels
gh issue view NUMBER --comments
gh issue create --title "Title" --body-file /tmp/issue.md
gh issue edit NUMBER --add-label bug --add-assignee @me
gh issue comment NUMBER --body-file /tmp/comment.md
gh issue close NUMBER --comment "Closing reason"Pull requests:
gh pr list --state open --limit 20 --json number,title,state,url,headRefName,baseRefName
gh pr view NUMBER --comments --json number,title,state,url,author,headRefName,baseRefName,mergeable,statusCheckRollup
gh pr create --title "Title" --body-file /tmp/pr.md --base BASE_BRANCH --head HEAD_BRANCH
gh pr checks NUMBER
gh pr review NUMBER --comment --body-file /tmp/review.md
gh pr merge NUMBER --squash --delete-branchActions:
gh workflow list
gh run list --limit 10 --json databaseId,displayTitle,status,conclusion,workflowName,headBranch,event,url
gh run view RUN_ID --log-failed
gh run rerun RUN_ID --failed
gh workflow run WORKFLOW.yml --ref BRANCHReleases:
git tag -l TAG
git tag -a TAG -m "Message"
git push origin TAG
gh release list --limit 10
gh release view TAG
gh release create TAG --draft --title "Title" --notes-file /tmp/release-notes.md
gh release upload TAG path/to/asset
gh release edit TAG --draft=falseSecrets and variables:
gh secret list --repo OWNER/REPO
gh secret set NAME --repo OWNER/REPO < /path/to/secret.txt
gh variable list --repo OWNER/REPO
gh variable set NAME --repo OWNER/REPO --body "value"Labels, milestones, and notifications:
gh label list --repo OWNER/REPO
gh label create NAME --repo OWNER/REPO --color C0FFEE --description "Description"
gh api repos/OWNER/REPO/milestones --jq '.[] | {number,title,state,due_on}'
gh api notifications --jq '.[] | {reason,unread,updated_at,repository: .repository.full_name,subject: .subject.title}'Search and API:
gh search repos "query" --limit 10 --json fullName,visibility,url,description
gh search issues "query repo:OWNER/REPO" --limit 20 --json number,title,state,url
gh api repos/OWNER/REPO --jq '{full_name, private, visibility, default_branch}'
gh api graphql -f query='query { viewer { login } }'API Patterns For Website-Like Operations
Use gh api for GitHub website settings that have no first-class gh command. Prefer --method PATCH for edits and read back afterward.
Repository settings:
gh api repos/OWNER/REPO --jq '{full_name, visibility, has_issues, has_projects, has_wiki, delete_branch_on_merge}'
gh api --method PATCH repos/OWNER/REPO -F has_issues=true -F delete_branch_on_merge=trueBranch protection:
gh api repos/OWNER/REPO/branches/BRANCH/protection
gh api --method PUT repos/OWNER/REPO/branches/BRANCH/protection --input /tmp/branch-protection.jsonPayload file for /tmp/branch-protection.json:
{
"required_status_checks": {
"strict": true,
"contexts": []
},
"enforce_admins": true,
"required_pull_request_reviews": {
"required_approving_review_count": 1
},
"restrictions": null
}Collaborators and teams:
gh api repos/OWNER/REPO/collaborators --jq '.[] | {login, permissions}'
gh api --method PUT repos/OWNER/REPO/collaborators/USERNAME -f permission=push
gh api orgs/ORG/teams --jq '.[] | {name, slug}'
gh api --method PUT orgs/ORG/teams/TEAM_SLUG/repos/OWNER/REPO -f permission=pushWebhooks, environments, and discussions:
gh api repos/OWNER/REPO/hooks --jq '.[] | {id, active, events, url: .config.url}'
gh api repos/OWNER/REPO/environments --jq '.environments[] | {name}'
gh api graphql -f query='query($owner:String!, $repo:String!) { repository(owner:$owner, name:$repo) { discussions(first:10) { nodes { number title url } } } }' -f owner=OWNER -f repo=REPOWorkflow Patterns
Push Current Repo To GitHub
- Confirm the working directory with
git rev-parse --show-toplevel. - Check
git status --short, current branch, andgit remote -v. - If no remote exists and the user asked to create a GitHub repo, create only the hosted repo with
gh, private by default:gh repo create OWNER/REPO --private - Read back the hosted repo and choose SSH or HTTPS URL:
gh repo view OWNER/REPO --json nameWithOwner,sshUrl,url,visibility - If using SSH, verify access:
ssh -T git@github.com git ls-remote git@github.com:OWNER/REPO.git HEAD - Add the Git remote if
origindoes not exist:git remote add origin git@github.com:OWNER/REPO.git - If
originexists but points to the wrong repo, update it explicitly:git remote set-url origin git@github.com:OWNER/REPO.git - Verify the remote points to the intended GitHub repo, then push with
git:git push -u origin HEAD - Verify the hosted repo with
gh repo view --json nameWithOwner,url,sshUrl,visibility,defaultBranchRef.
Create An Issue
- Identify the repo with
gh repo viewor explicit--repo OWNER/REPO. - Check existing issues to avoid duplicates:
gh issue list --search "keywords in:title" --state all --json number,title,state,url - Create the body in a temporary Markdown file and run:
gh issue create --title "Title" --body-file /tmp/issue.md - Read the issue back and return the URL.
Create A Pull Request
- Read the default branch from GitHub metadata:
gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name' - Confirm the current branch is not the default branch with
git branch --show-current. - Check
git status --short; do not commit unrelated changes. - If the task requires a new commit, use
git-auto-commitbefore pushing. - Push the branch with
git push -u origin HEAD. - Create the PR with an explicit base and head:
gh pr create --title "Title" --body-file /tmp/pr.md --base BASE_BRANCH --head HEAD_BRANCH - Return the PR URL and check status with
gh pr checks.
Review Or Merge A Pull Request
- Inspect the PR, diff, reviews, and checks:
gh pr view NUMBER --comments --json number,title,state,url,author,headRefName,baseRefName,mergeable,statusCheckRollup,reviewDecision gh pr checks NUMBER - Fetch and inspect PR code with
git, notgh pr checkout, without overwriting a local branch:git fetch origin pull/NUMBER/head git switch --detach FETCH_HEAD git diff BASE_BRANCH...HEAD - For review comments, use
--body-file. - Before merging, confirm merge method, target branch, CI state, and whether to delete the head branch.
- Merge only after user confirmation:
gh pr merge NUMBER --squash --delete-branch - Verify PR state after merge.
Inspect CI Failure
- Get recent runs:
gh run list --limit 10 --json databaseId,displayTitle,status,conclusion,workflowName,headBranch,event,url - Inspect the failing run:
gh run view RUN_ID --log-failed - Summarize the failing job, exact error, likely cause, and next fix.
- Do not rerun workflows that deploy, release, or mutate external systems without confirming with the user.
Create Or Publish A Release
- Confirm the release tag and target commit with
git:git status --short git rev-parse HEAD git tag -l TAG git ls-remote --tags origin TAG - If the tag does not exist and the user asked to create it, create and push the tag with
git:git tag -a TAG -m "Message" git push origin TAG - Create GitHub Releases as drafts by default:
gh release create TAG --draft --title "Title" --notes-file /tmp/release-notes.md - Do not publish a draft release or mark it latest without explicit user confirmation.
- Verify the release with
gh release view TAG.
Manage Secrets Or Variables
- Confirm repo/org/environment scope and application scope (
actions,dependabot,codespaces, oragents). - List existing names only; never display values:
gh secret list --repo OWNER/REPO gh variable list --repo OWNER/REPO - Set values through stdin or a local file. Do not echo secret values into the command line.
- Verify by listing names and metadata only.
Change Visibility Or Public Exposure
- Read current visibility:
gh repo view OWNER/REPO --json nameWithOwner,visibility,url - If making anything public or broadly accessible, stop and ask for explicit confirmation.
- Run the smallest command needed.
- Read back
visibilityor access metadata and report the final state.
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
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.

