Skip to content
Back to skills

1178 Name Skill 26dc1649

ASecurity

Guides usage of the GitHub CLI (gh) for interacting with GitHub repositories, PRs, issues, and API. Use when working with GitHub resources instead of WebFetch or curl.

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 11, 2026
documentationbashgitapi

Works with

  • cli
  • api

Security analysis

A92/100
  • mediumUses curl or wget to download content

Pro shows the line behind each finding and how to fix it

Scanned October 11, 2026

npx -y skills add tools-only/X-Skills --skill 1178-name-skill_26dc1649 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 1178 Name Skill 26dc1649?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 1178 Name Skill 26dc1649
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-1178-name-skill-26dc1649/badge)](https://www.skillsdirectory.com/skills/tools-only-1178-name-skill-26dc1649)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
---
name: using-gh-cli
description: "Guides usage of the GitHub CLI (gh) for interacting with GitHub repositories, PRs, issues, and API. Use when working with GitHub resources instead of WebFetch or curl."
allowed-tools:
  - Bash
  - Read
---

# Using the GitHub CLI (`gh`)

## When to Use

- Viewing or creating pull requests, issues, releases, or gists
- Fetching file contents, repo metadata, or any GitHub API data
- Interacting with GitHub Actions (runs, workflows)
- Any task involving GitHub that you might otherwise use `curl`, `wget`, or `WebFetch` for

## When NOT to Use

- Non-GitHub URLs (use `WebFetch` or `curl` for those)
- Public web content that happens to be hosted on GitHub Pages (`*.github.io`) — those are regular websites
- Local git operations (`git commit`, `git push`) — use `git` directly

## Key Principle

**Always use `gh` instead of `curl`, `wget`, or `WebFetch` for GitHub URLs.** The `gh` CLI uses the user's authenticated token automatically, so it:

- Works with private repositories
- Avoids GitHub API rate limits (unauthenticated: 60 req/hr; authenticated: 5,000 req/hr)
- Handles pagination correctly
- Provides structured output and filtering

## Quick Start

```bash
# View a repo
gh repo view owner/repo

# List and view PRs
gh pr list --repo owner/repo
gh pr view 123 --repo owner/repo

# List and view issues
gh issue list --repo owner/repo
gh issue view 456 --repo owner/repo

# Call any REST API endpoint
gh api repos/owner/repo/contents/README.md

# Call with pagination and jq filtering
gh api repos/owner/repo/pulls --paginate --jq '.[].title'
```

## Common Patterns

| Instead of | Use |
|------------|-----|
| `WebFetch` on `github.com/owner/repo` | `gh repo view owner/repo` |
| `WebFetch` on `api.github.com/...` | `gh api <endpoint>` |
| `WebFetch` on `raw.githubusercontent.com/...` | `gh api repos/owner/repo/contents/path` |
| `curl https://api.github.com/...` | `gh api <endpoint>` |
| `curl` with `-H "Authorization: token ..."` | `gh api <endpoint>` (auth is automatic) |
| `wget` to download a release asset | `gh release download --repo owner/repo` |

## Decoding File Contents

`gh api repos/.../contents/...` returns base64-encoded content. Decode it:

```bash
gh api repos/owner/repo/contents/path/to/file --jq '.content' | base64 -d
```

Or for binary files / large files, use the raw media type:

```bash
gh api repos/owner/repo/contents/path/to/file -H "Accept: application/vnd.github.raw+json"
```

## References

- [Pull Requests](references/pull-requests.md) — list, view, create, merge, review PRs
- [Issues](references/issues.md) — list, view, create, close, comment on issues
- [Repos and Files](references/repos-and-files.md) — view repos, browse files, clone
- [API](references/api.md) — raw REST/GraphQL access, pagination, jq filtering
- [Releases](references/releases.md) — list, create, download releases
- [Actions](references/actions.md) — view runs, trigger workflows, check logs

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.