Communitygithub.com

GitHub CLI (gh)

Integração do GitHub CLI (gh) para gerenciar issues, pull requests, branches, commits e revisões de código diretamente do terminal.

O que é GitHub CLI (gh)?

Esta skill permite que o agente de IA (como Claude Code, Cursor, etc.) interaja com repositórios GitHub usando o comando `gh` diretamente do terminal, eliminando a necessidade de alternar para um navegador. Ela cobre fluxos de trabalho essenciais: gerenciamento de issues (criar, listar, visualizar, atualizar, comentar), criação de branches e commits, gerenciamento de pull requests (criar, listar, visualizar, comentar, revisar e mesclar), e administração de workflows do GitHub Actions (listar execuções, visualizar logs, acionar workflows, reexecutar jobs). A skill é útil para desenvolvedores que desejam automatizar tarefas de desenvolvimento e revisão de código sem sair do terminal. Suporta as principais plataformas de agentes de IA que possuem acesso ao terminal com o comando `gh` instalado e autenticado. O funcionamento se baseia na execução de comandos `gh` com flags específicas, conforme documentado no SKILL.md, que inclui exemplos práticos, referência de flags comuns, dicas para descrições multilinha com Markdown e variáveis de ambiente.

Funciona com✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/cdcoonce/Portfolio_Website/tree/HEAD/.claude/skills/github-cli

Perguntar na sua IA favorita

Abre um novo chat com esta habilidade de agente já pré-carregada.

Documentação

Habilidade GitHub CLI (gh)

Use o CLI gh para interagir com repositórios GitHub, issues, pull requests e workflows do GitHub Actions a partir do terminal.

Pré-requisitos

Verifique se o gh está instalado e autenticado:

gh --version
gh auth status

Se não estiver autenticado, execute gh auth login e siga as instruções.

Fluxos de Trabalho Principais

Gerenciamento de Issues

# Listar issues
gh issue list                             # Issues abertas no repositório atual
gh issue list --state all                 # Todas as issues, incluindo fechadas
gh issue list --assignee @me              # Issues atribuídas a você
gh issue list --label "bug"               # Filtrar por label

# Criar issue
gh issue create -t "Título" -b "Descrição"
gh issue create -t "Título" --label "bug,prioridade:alta" --milestone "marco-1"
gh issue create                           # Modo interativo

# Visualizar/atualizar issue
gh issue view 123                         # Visualizar detalhes da issue
gh issue view 123 --web                   # Abrir no navegador
gh issue edit 123 --add-label "em-andamento"
gh issue close 123
gh issue reopen 123

# Adicionar comentários
gh issue comment 123 -b "Estou trabalhando nisso agora"

Fluxo de Trabalho de Branch e Commit

# Criar branch de funcionalidade/correção
git checkout -b feature/minha-funcionalidade
git checkout -b fix/issue-123
git checkout -b draft/wip-experimento

# Preparar e commitar alterações
git add .
git commit -m "feat: adicionar nova funcionalidade"
git commit -m "fix: resolver issue #123"

# Enviar branch para o remoto
git push -u origin feature/minha-funcionalidade

Gerenciamento de Pull Requests

# Criar PR (vários métodos)
gh pr create                              # Modo interativo
gh pr create --fill                       # Preenchimento automático a partir dos commits
gh pr create --draft                      # Criar como rascunho
gh pr create --draft --fill               # Rascunho com preenchimento automático
gh pr create -t "Título" -b "Descrição" -B main
gh pr create --label "revisão-necessária" --assignee @me

# Listar PRs
gh pr list                                # PRs abertos
gh pr list --assignee @me                 # Seus PRs
gh pr list --search "review-requested:@me"  # PRs solicitando sua revisão
gh pr list --draft                        # Apenas PRs em rascunho

# Visualizar detalhes do PR
gh pr view 45                             # Visualizar PR no terminal
gh pr view 45 --web                       # Abrir no navegador

Fluxo de Trabalho de Revisão de Código

# Fazer checkout do PR localmente para teste
gh pr checkout 45                         # Fazer checkout da branch do PR localmente

# Revisar alterações
gh pr diff 45                             # Visualizar diff do PR
gh pr diff                                # Diff do PR da branch atual

# Adicionar comentários de revisão
gh pr comment 45 -b "LGTM, pequena sugestão na linha 42"
gh pr comment -b "Por favor, adicione testes"       # Comentar no PR da branch atual

# Submeter uma revisão formal
gh pr review 45 --approve
gh pr review 45 --request-changes -b "Por favor, corrija o tratamento de erros"
gh pr review 45 --comment -b "Parece bom no geral, algumas sugestões"

# Mesclar
gh pr merge 45                            # Mesclagem interativa
gh pr merge 45 --squash                   # Mesclagem squash
gh pr merge 45 --rebase                   # Mesclagem rebase
gh pr merge 45 --merge                    # Commit de mesclagem padrão
gh pr merge 45 --auto                     # Mesclagem automática quando as verificações passarem

Atualizar PR Existente

gh pr edit 45 --title "Novo título"
gh pr edit 45 --body "Descrição atualizada"
gh pr edit 45 --base develop
gh pr edit 45 --add-label "pronto-para-revisão"
gh pr ready 45                            # Marcar como pronto (remover rascunho)

Gerenciamento de Workflows do GitHub Actions

# Listar execuções de workflow
gh run list                               # Execuções de workflow recentes
gh run list --workflow=ci.yml             # Workflow específico
gh run list --status=failure              # Apenas execuções com falha

# Visualizar detalhes da execução do workflow
gh run view                               # Seletor de execução interativo
gh run view 12345                         # Execução específica
gh run view 12345 --web                   # Abrir no navegador

# Acionar workflow
gh workflow run ci.yml                    # Executar na branch padrão
gh workflow run ci.yml --ref feature/x    # Executar em branch específica
gh workflow run ci.yml -f key=value       # Com parâmetros de entrada

# Reexecutar tarefas com falha
gh run rerun 12345                        # Reexecutar todas as tarefas
gh run rerun 12345 --failed               # Reexecutar apenas tarefas com falha

# Visualizar logs de tarefa
gh run view 12345 --log                   # Saída completa do log
gh run view 12345 --log-failed            # Apenas logs de tarefas com falha

# Assistir a uma execução em andamento
gh run watch                              # Assistir à execução atual
gh run watch 12345                        # Assistir a uma execução específica

Referência de Flags Comuns

FlagDescrição
-R, --repo OWNER/REPORepositório alvo diferente
-B, --baseBranch base para PR
-H, --headBranch head para PR
-t, --titleTítulo para issue/PR
-b, --bodyCorpo/descrição para issue/PR
-l, --labelLabels (separadas por vírgula)
-a, --assigneeNome de usuário do responsável
-m, --milestoneNome do marco
--draftCriar como PR em rascunho
--fillPreencher automaticamente das mensagens de commit
--webAbrir no navegador
-y, --yesPular prompts de confirmação

Variáveis de Ambiente

export GH_TOKEN="ghp_xxxx"               # Token de acesso pessoal
export GH_HOST="github.example.com"      # Instância do GitHub Enterprise
export GH_REPO="owner/repo"              # Repositório padrão

Dicas e Armadilhas

Descrições Multilinha com Markdown

Ao criar issues ou PRs com descrições longas contendo markdown (blocos de código, crases), evite heredocs que podem falhar devido à interpretação do shell. Em vez disso:

# Passo 1: Escrever a descrição em um arquivo temporário (fora do bash)
# Passo 2: Criar a partir do arquivo temporário
gh issue create -t "Título" -b "$(cat descricao_temporaria.txt)"
# Passo 3: Limpar
rm descricao_temporaria.txt

Isso evita problemas com:

  • Crases em blocos de código conflitando com substituição de comando
  • Caracteres especiais sendo interpretados pelo shell
  • Conflitos de delimitador de heredoc

Usando Descrição de Arquivos Existentes

Para criar uma issue ou PR a partir de um arquivo de plano markdown:

# Use a flag body-file para descrições limpas baseadas em arquivo
gh issue create -t "Título" --body-file docs/planos/meu-plano.md
gh pr create -t "Título" --body-file docs/planos/meu-plano.md

Referência Detalhada

Para opções de comando abrangentes e exemplos, consulte references/commands.md.

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

cdcoonce/Portfolio_Website

Git commit workflow with enforced conventional commit style. Use when Claude needs to stage and commit changes, craft commit messages, or the user asks to commit, make a commit, or save their work. Ensures consistent commit message format, proper scoping, and atomic commits across the project.

cdcoonce/Portfolio_Website

AI-powered code quality analysis for Python, Markdown, and Mermaid diagrams. Use this skill when: (1) reviewing code for quality issues, (2) checking Python files for PEP8 violations, unused code, missing type hints, docstring problems, complexity issues, or potential runtime errors, (3) validating Markdown documentation for broken links, heading structure, or formatting issues, (4) validating Mermaid diagram syntax, (5) the user asks for a "code review" or "quality check", (6) analyzing code snippets pasted in conversation, or (7) suggesting and applying fixes for code quality issues.

cdcoonce/Portfolio_Website

Deploy the portfolio chat agent Lambda function to AWS. Use when the user asks to deploy, redeploy, push to Lambda, update the chat agent, or after updating context files or lambda_function.py. Rebuilds the knowledge base, packages dependencies, and deploys to AWS Lambda.

cdcoonce/Portfolio_Website

Generate multiple radically different interface designs for a module using parallel sub-agents. Use when user wants to design an API, explore interface options, compare module shapes, or mentions "design it twice".

cdcoonce/Portfolio_Website

Orchestrate the full GitHub-issues-driven development lifecycle. 7-phase pipeline from brainstorm through PR with state tracking and cross-conversation resume. Use when user says "dev cycle", "development workflow", "full development pipeline", or invokes /dev-cycle.

cdcoonce/Portfolio_Website

Production Python coding standards with automatic version detection (3.10-3.13). Use when writing, reviewing, or refactoring Python to ensure adherence to modern type syntax, LBYL exception handling, pathlib operations, ABC-based interfaces, and production-tested patterns. Not Dagster-specific - applies to any Python project.

cdcoonce/Portfolio_Website

Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute. Use when user wants to prevent destructive git operations, add git safety hooks, or block git push/reset in Claude Code.

cdcoonce/Portfolio_Website

Interview the user relentlessly about a plan or design until reaching shared understanding, resolving each branch of the decision tree. Use when user wants to stress-test a plan, get grilled on their design, or mentions "grill me".

cdcoonce/Portfolio_Website

Explore a codebase to find opportunities for architectural improvement, focusing on making the codebase more testable by deepening shallow modules. Use when user wants to improve architecture, find refactoring opportunities, consolidate tightly-coupled modules, or make a codebase more AI-navigable.

cdcoonce/Portfolio_Website

CEO/founder-mode plan review. Rethink the problem, find the 10-star product, challenge premises, expand scope when it creates a better product. Three modes: SCOPE EXPANSION (dream big), HOLD SCOPE (maximum rigor), SCOPE REDUCTION (strip to essentials). Use when the user asks for a plan review, CEO review, mega review, or wants a plan challenged/stress-tested before implementation.

cdcoonce/Portfolio_Website

Break a PRD into independently-grabbable GitHub issues using tracer-bullet vertical slices. Use when user wants to convert a PRD to issues, create implementation tickets, or break down a PRD into work items.

cdcoonce/Portfolio_Website

Turn a PRD into a multi-phase implementation plan using tracer-bullet vertical slices, saved as a local Markdown file in docs/plans/. Use when user wants to break down a PRD, create an implementation plan, plan phases from a PRD, or mentions "tracer bullets".

cdcoonce/Portfolio_Website

Generate or update the `.claude/docs/project.md` file that gives Claude project-specific context. Use this skill when the user asks to create, update, regenerate, or refresh project context, or says things like "update project.md", "generate project context", "this repo needs a project.md", or "Claude doesn't know about this project". Also trigger when onboarding Claude to a new repository for the first time.

cdcoonce/Portfolio_Website

Generate comprehensive, high-quality README.md files for code repositories. Use this skill whenever the user asks to create, write, generate, update, or improve a README for any project or repository. Also trigger when the user says things like "document this project", "write docs for this repo", "this repo needs a README", "help me onboard developers to this codebase", or asks for project documentation in markdown. Even if the user just says "README" or "readme" in the context of a codebase, use this skill.

cdcoonce/Portfolio_Website

Create a detailed refactor plan with tiny commits via user interview, then file it as a GitHub issue. Use when user wants to plan a refactor, create a refactoring RFC, or break a refactor into safe incremental steps.

cdcoonce/Portfolio_Website

Set up pre-commit hooks for the current repo. Use when user wants to add pre-commit hooks, configure commit-time linting, formatting, type checking, or testing. Triggers on "pre-commit", "git hooks", "linting hooks", or /setup-pre-commit.

cdcoonce/Portfolio_Website

Test-driven development with red-green-refactor loop. Use when user wants to build features or fix bugs using TDD, mentions "red-green-refactor", wants integration tests, or asks for test-first development.

cdcoonce/Portfolio_Website

Triage a bug or issue by exploring the codebase to find root cause, then create a GitHub issue with a TDD-based fix plan. Use when user reports a bug, wants to file an issue, mentions "triage", or wants to investigate and plan a fix for a problem.

cdcoonce/Portfolio_Website

Rewrites the prose sections of wiki pages in-place. Reads source files to understand current context, then updates only the content inside <!-- claude:prose --> ... <!-- claude:prose:end --> markers. Never touches <!-- generated:start --> ... <!-- generated:end --> blocks. Supports targeting a single page with /update-wiki {PageName}.

cdcoonce/Portfolio_Website

Create a PRD through user interview, codebase exploration, and module design, then submit as a GitHub issue. Use when user wants to write a PRD, create a product requirements document, or plan a new feature.

Habilidades Relacionadas