---
name: gh-cli-flujos-autenticados
description: Guia de buenas practicas para usar el CLI oficial de GitHub (gh) en lugar de curl o peticiones HTTP sin autenticar al trabajar con repositorios, pull requests, issues y la API de GitHub.
license: CC-BY-SA-4.0
metadata:
  id: 401d3ef4
  slug: gh-cli-flujos-autenticados
  titulo: "gh CLI: Flujos Autenticados con GitHub"
  servicio: Web
  categoria_recurso: Web-Desarrollo
  tipo: referencia
  nivel: basico
  idioma: es
  idioma_original: en
  acceso: gratis
  precio_eur: 0
  plataformas: [GitHub, CLI, macOS, Linux, Windows]
  dependencias: [gh]
  licencia: { spdx: CC-BY-SA-4.0, redistribuible: true, uso_comercial: true }
  fuente:
    repo: trailofbits/skills
    url: https://github.com/trailofbits/skills/tree/main/plugins/gh-cli/skills/gh-cli
    commit: c070b9b
    autor: trailofbits
    nombre_original: gh-cli
    duplicados_en: []
  seguridad: { veredicto: seguro, riesgo: bajo, escaneado: "2026-06-14", motor: "grep-estatico+auditor-llm" }
  ficha:
    que_hace: "Enforza el uso del CLI gh autenticado en lugar de curl/wget sin autenticar para operaciones con la API de GitHub."
    como_lo_hace: "Proporciona patrones de comandos gh (repo view, pr view, gh api) y criterios claros de cuando aplicarlos frente a alternativas no autenticadas."
  content_hash: "401d3ef41bf8edc8f5fa222a88ba5e808433ea7449d89aa041c3606b8c8f3627"
  version: 1.0.0
---

# gh-cli

## When to Use

- Working with GitHub repositories, pull requests, issues, releases, or raw file URLs.
- You need authenticated access to private repositories or higher API rate limits.
- You are about to use `curl`, `wget`, or unauthenticated web fetches against GitHub.

## When NOT to Use

- The target is not GitHub.
- Plain local git operations already solve the task.

## Guidance

Prefer the authenticated `gh` CLI over raw HTTP fetches for GitHub content. In particular:

- Prefer `gh repo view`, `gh pr view`, `gh pr list`, `gh issue view`, and `gh api` over unauthenticated `curl` or `wget`.
- Prefer cloning a repository and reading files locally over fetching `raw.githubusercontent.com` blobs directly.
- Avoid using GitHub API `/contents/` endpoints as a substitute for cloning and reading repository files.

Examples:

```sh
gh repo view owner/repo
gh pr view 123 --repo owner/repo
gh api repos/owner/repo/pulls
```

For the hook implementation, see:
- `plugins/gh-cli/README.md`
- `plugins/gh-cli/hooks/`
