agentleFS
Anish29801Anish29801/cursor-plugin-github-cli/skills/github-cli/SKILL.md

github-cli

Skill0 starsChanged 3 months agoMITView on GitHub

Install, authenticate, and use GitHub CLI (gh) for repos, pull requests, issues, Actions, and API calls. Use when the user mentions gh, GitHub CLI, GitHub auth, creating PRs, checking CI, or GitHub operations from the terminal.

  • Reads credentials
  • Installs packages
  • Commits and pushes

25 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use terraform, codex-cli and 3 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.
  • ihiteshguptaSkill

    terraform

    Expert in Infrastructure as Code with Terraform. Use for creating, managing, and versioning infrastructure across cloud providers.

    Also in 3 projects that use this

  • garri333Skill

    codex-cli

    OpenAI Codex CLI mastery skill for installation, authentication, terminal commands, code generation from natural language, file editing, project scaffolding, and IDE integrations. Covers GPT-5.2 Instant/Thinking tiers and shell/container execution modes.

    Also in 3 projects that use this

  • PostHogSkill

    karpathy-guidelines

    Behavioral guidelines to reduce common LLM coding mistakes. Use when writing, reviewing, or refactoring code to avoid overcomplication, make surgical changes, surface assumptions, and define verifiable success criteria. Based on https://github.com/multica-ai/andrej-karpathy-skills.

    Also in 3 projects that use this

  • MicrosoftSkill

    caveman

    Ultra-compressed response style that reduces output token count while preserving technical accuracy, with intensity levels and auto-clarity safety rules

    Also in 3 projects that use this

  • BlockSkill

    frontend-design

    Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

    Also in 4 projects that use this

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 19 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

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

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

    Use gh for all GitHub tasks from the terminal.

    line 12
  2. Distinctive:

    Run and let the user answer prompts:

    line 48
  3. Distinctive:

    Run at the start of any GitHub task (or use the helper script):

    line 95
  4. Very specific:

    If not in a git repo, ask the user for owner/repo or pass -R owner/repo on every command.

    line 120
  5. Very specific:

    Check auth: before PR/issue/API work: gh auth status

    line 125
  6. Distinctive:

    Run in parallel when possible:

    line 137
  7. Very specific:

    Use gh api when no dedicated subcommand exists.

    line 217

“Common” is measured: kept by at least 6 in 10 of the 19 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)

Use gh for all GitHub tasks from the terminal. Prefer gh over raw curl to GitHub API when a subcommand exists.

Install

Windows (preferred)

winget install --id GitHub.cli --source winget

Open a new terminal after install, then verify:

gh --version

Other platforms

PlatformCommand
macOSbrew install gh
Debian/UbuntuSee official docs
ManualLatest release

Authentication

gh auth login is interactive — the user must complete prompts in the terminal. Do not run it unattended expecting full automation.

When to authenticate

  1. gh auth status fails or shows "not logged in"
  2. User wants a different account or extra token scopes
  3. First-time setup after install

Login workflow

Run and let the user answer prompts:

gh auth login

Recommended choices for most development work:

PromptSuggested answer
AccountGitHub.com (or Enterprise hostname if applicable)
ProtocolHTTPS
AuthenticateLogin with a web browser (or paste token if headless)
Git credentialsYes — lets git push/pull use gh credentials

For GitHub Enterprise:

gh auth login --hostname <hostname>

Verify auth

gh auth status

Expected: logged-in account, active token, and scopes (repo minimum for private repos and PRs).

Add scopes later

gh auth refresh -s workflow,read:org

Common scopes: repo, read:org, workflow, gist, project.

Environment / CI (no interactive login)

Set GITHUB_TOKEN (or GH_TOKEN) with a PAT or Actions token. gh uses it automatically.

Dynamic context (required)

Never hardcode GitHub usernames, orgs, or repo names. Resolve them at runtime for whoever is authenticated.

Resolve before GitHub work

Run at the start of any GitHub task (or use the helper script):

powershell -File scripts/get-context.ps1

Or manually:

gh auth status
gh api user --jq '{login: .login, name: .name}'
gh repo view --json nameWithOwner,defaultBranchRef -q '.nameWithOwner'   # inside a git repo
git remote get-url origin                                                 # fallback for owner/repo

Dynamic patterns

NeedCommand / pattern
Current user logingh api user -q .login
Current user in filters@me (e.g. author:@me, --assignee @me)
Current repogh repo view -q .nameWithOwner (in repo) or -R owner/repo
User's reposgh search repos "user:$(gh api user -q .login)"
API with ownerrepos/{owner}/{repo} — fill from context, not literals

If not in a git repo, ask the user for owner/repo or pass -R owner/repo on every command.

Agent rules

  1. Resolve context first — auth user and repo via commands above; never assume a fixed account
  2. Check auth before PR/issue/API work: gh auth status
  3. Use gh for GitHub tasks — PRs, issues, checks, releases, repo info
  4. Interactive login — run gh auth login, then tell the user to complete browser/token steps
  5. Never commit or log tokens — warn if .env or credentials would be committed
  6. Use --json + --jq for scriptable output when parsing is needed

Pull requests

Align with the user's PR workflow: gather git state, then use gh.

Inspect branch before PR

Run in parallel when possible:

git status
git diff
git branch -vv
git log --oneline -10
git diff main...HEAD

Create PR

git push -u origin HEAD

gh pr create --title "Title" --body "$( @'
## Summary
- Change 1

## Test plan
- [ ] Step 1
'@ )"

Return the PR URL from command output.

Common PR commands

gh pr list
gh pr view 123
gh pr view --web
gh pr checkout 123
gh pr diff 123
gh pr merge 123 --squash
gh pr checks 123
gh pr review 123 --approve

Issues

gh issue list
gh issue view 42
gh issue create --title "Bug" --body "Description"
gh issue close 42

Repositories

gh repo view
gh repo view owner/repo --web
gh repo clone owner/repo
gh repo fork owner/repo --clone
gh repo create my-repo --public --source=. --remote=origin --push

GitHub Actions

Requires workflow scope for some operations.

gh run list
gh run view 123456789
gh run watch 123456789
gh run rerun 123456789 --failed
gh workflow list
gh workflow run ci.yml

Search and API

gh search repos "topic:nextjs stars:>100"
gh search prs "is:open author:@me"
gh search repos "user:$(gh api user -q .login)"
gh api "repos/$(gh repo view -q .nameWithOwner)/pulls" --jq '.[].title'

Use gh api when no dedicated subcommand exists. See gh api --help.

JSON output

gh pr list --json number,title,url --jq '.[] | "\(.number): \(.title)"'
gh issue list --json number,title,state

Troubleshooting

ProblemFix
gh: command not foundReinstall; open new terminal (Windows PATH update)
HTTP 401 / auth errorsgh auth login or gh auth refresh
Missing scope errorsgh auth refresh -s <scope>
Wrong accountgh auth switch or logout and re-login
Enterprise hostgh auth login --hostname <host> or set GH_HOST
gh auth logout
gh auth login
gh config set editor "code --wait"

Quick reference

TaskCommand
Who am I?gh api user -q .login or gh auth status
Open in browsergh browse
Notificationsgh status
Create PRgh pr create
CI statusgh pr checks or gh run list
Raw APIgh api <endpoint>

Full reference: gh help or cli.github.com/manual

Additional resources

  • For API patterns, JSON fields, merge flags, and env vars, see reference.md

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.