mastering-github-cli

GitHub CLI (gh) command reference for repository search, code discovery, CI/CD monitoring, workflow authoring, and automation. Triggers on "gh" commands, "github cli", searching repos for files/directories (.skilz, .cursor, .codex, Dockerfile), monitoring GitHub Actions workflows, checking PR CI status, downloading artifacts, creating PRs/issues/repos from command line, triggering workflows, forking repos, batch operations, "write a workflow", "github actions", "CI/CD pipeline", "workflow yaml", and "matrix builds". Use for gh search, gh run, gh pr, gh issue, gh repo, gh workflow, gh api, workflow authoring, and automating GitHub operations.

Best use case

mastering-github-cli is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

GitHub CLI (gh) command reference for repository search, code discovery, CI/CD monitoring, workflow authoring, and automation. Triggers on "gh" commands, "github cli", searching repos for files/directories (.skilz, .cursor, .codex, Dockerfile), monitoring GitHub Actions workflows, checking PR CI status, downloading artifacts, creating PRs/issues/repos from command line, triggering workflows, forking repos, batch operations, "write a workflow", "github actions", "CI/CD pipeline", "workflow yaml", and "matrix builds". Use for gh search, gh run, gh pr, gh issue, gh repo, gh workflow, gh api, workflow authoring, and automating GitHub operations.

Teams using mastering-github-cli should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/mastering-github-cli/SKILL.md --create-dirs "https://raw.githubusercontent.com/SpillwaveSolutions/agent_rulez/main/.claude/skills/mastering-github-cli/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/mastering-github-cli/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How mastering-github-cli Compares

Feature / Agentmastering-github-cliStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

GitHub CLI (gh) command reference for repository search, code discovery, CI/CD monitoring, workflow authoring, and automation. Triggers on "gh" commands, "github cli", searching repos for files/directories (.skilz, .cursor, .codex, Dockerfile), monitoring GitHub Actions workflows, checking PR CI status, downloading artifacts, creating PRs/issues/repos from command line, triggering workflows, forking repos, batch operations, "write a workflow", "github actions", "CI/CD pipeline", "workflow yaml", and "matrix builds". Use for gh search, gh run, gh pr, gh issue, gh repo, gh workflow, gh api, workflow authoring, and automating GitHub operations.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Mastering GitHub CLI

Command-line interface for GitHub operations: search, monitoring, resource creation, workflow authoring, and automation.

## Contents

- [Quick Start](#quick-start)
- [Command Reference](#command-reference)
- [Workflow Authoring](#workflow-authoring)
- [Scripts](#scripts)
- [Validation Checklist](#validation-checklist)
- [When Not to Use](#when-not-to-use)

---

## Quick Start

### Find repos with specific files/directories

```bash
gh search code "path:.skilz" --json repository --jq '.[].repository.fullName'
gh search code --filename SKILL.md
gh search code --filename Dockerfile --language python
```

### Monitor CI/CD

```bash
gh run list --workflow=CI --status=failure --limit 10
gh run watch 12345 --exit-status      # Block until complete
gh run view 12345 --log-failed        # Failed logs only
gh pr checks 123 --watch              # PR CI status
```

### Create resources

```bash
gh pr create --title "Feature" --body "Description" --reviewer @user
gh issue create --title "Bug" --label bug,urgent --assignee @me
gh repo fork owner/repo --clone
```

### Trigger and monitor workflow

```bash
gh workflow run deploy.yml -f environment=staging
sleep 5
RUN_ID=$(gh run list --workflow=deploy.yml --limit 1 --json databaseId --jq '.[0].databaseId')
gh run watch "$RUN_ID" --exit-status
```

---

## Command Reference

| Task | Command | Reference |
|------|---------|-----------|
| Find repos with file | `gh search code --filename FILE` | [search.md](references/search.md) |
| Find repos with directory | `gh search code "path:DIR"` | [search.md](references/search.md) |
| List failed runs | `gh run list --status=failure` | [monitoring.md](references/monitoring.md) |
| Watch run | `gh run watch ID --exit-status` | [monitoring.md](references/monitoring.md) |
| Download artifacts | `gh run download ID -n NAME` | [monitoring.md](references/monitoring.md) |
| Create PR | `gh pr create --fill` | [resources.md](references/resources.md) |
| Check PR CI | `gh pr checks --watch` | [monitoring.md](references/monitoring.md) |
| Trigger workflow | `gh workflow run NAME.yml` | [automation.md](references/automation.md) |
| Fork repo | `gh repo fork REPO --clone` | [resources.md](references/resources.md) |
| REST/GraphQL API | `gh api repos/{owner}/{repo}` | [api.md](references/api.md) |

### JSON Output

```bash
gh pr list --json                              # Discover fields
gh pr list --json number,title,author,labels   # Select fields
gh run list --json status --jq '.[] | select(.status=="completed")'
```

### Environment & Auth

| Variable | Purpose |
|----------|---------|
| `GH_TOKEN` | Authentication token |
| `GH_REPO` | Default owner/repo |
| `GH_HOST` | GitHub Enterprise host |
| `GH_PROMPT_DISABLED=1` | Disable prompts (CI) |

### Rate Limits

| Endpoint | Limit | Notes |
|----------|-------|-------|
| REST API | 5,000/hour | Per authenticated user |
| Search API | 30/minute | All search endpoints |
| Code Search | 10/minute | More restrictive |
| Search results | 1,000 max | Use date partitioning for more |

---

## Workflow Authoring

GitHub Actions workflow YAML patterns for CI/CD pipelines.

### Basic Structure

```yaml
name: CI Pipeline
on:
  push:
    branches: [main]
  pull_request:
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: make build
      - run: make test
```

### Caching Patterns

```yaml
# Python/Poetry
- uses: actions/setup-python@v5
  with:
    python-version: '3.11'
- uses: actions/cache@v4
  with:
    path: .venv
    key: venv-${{ runner.os }}-${{ hashFiles('poetry.lock') }}

# Node.js
- uses: actions/setup-node@v4
  with:
    node-version: '20'
    cache: 'npm'
```

### Matrix Builds

```yaml
strategy:
  matrix:
    os: [ubuntu-latest, windows-latest]
    node: [18, 20]
  fail-fast: false
```

### OIDC Authentication (AWS/GCP)

```yaml
permissions:
  id-token: write
  contents: read

steps:
  - uses: aws-actions/configure-aws-credentials@v4
    with:
      role-to-assume: arn:aws:iam::123456789012:role/GitHubActionsRole
      aws-region: us-east-1
```

**Full reference:** [references/workflow-authoring.md](references/workflow-authoring.md)

### Advanced Patterns

For enterprise CI/CD pipelines:

- **Ephemeral PR Environments** - Auto-create/destroy per PR
- **Release Please** - Automated semantic versioning
- **PR Cleanup** - Resource cleanup on close
- **Testing Patterns** - pytest, Gradle, Jest with coverage
- **Deployment Status Checks** - Wait for stack readiness
- **Separate Build/Deploy Roles** - Fine-grained OIDC permissions
- **Multi-Stack Ordering** - Foundation → Schemas → Application

**Additional References:**
- **Workflow Summaries** - Rich markdown output with $GITHUB_STEP_SUMMARY
- **Container Security** - Multi-stage builds, Trivy scanning, image tagging
- **Security Scanning** - CodeQL, Dependabot, IaC scanning (Checkov, tfsec)
- **Troubleshooting** - Debug mode, flaky tests, common issues
- **Performance** - Limits, runner specs, optimization tips

---

## Scripts

Pre-built automation scripts with error handling and rate limit awareness.

| Script | Purpose | Usage |
|--------|---------|-------|
| `find-repos-with-path.sh` | Find repos containing specific paths | `./scripts/find-repos-with-path.sh .skilz [owner]` |
| `wait-for-run.sh` | Block until workflow completes | `./scripts/wait-for-run.sh RUN_ID [timeout]` |
| `batch-search.sh` | Search >1000 results via date partitioning | `./scripts/batch-search.sh "query" START END` |

### Exit Codes

| Script | 0 | 1 | 2 | 3 |
|--------|---|---|---|---|
| `wait-for-run.sh` | success | failure | cancelled | timeout |
| `find-repos-with-path.sh` | success | error | - | - |
| `batch-search.sh` | success | error | - | - |

---

## Validation Checklist

Before completing a GitHub CLI task, verify:

```
- [ ] gh authenticated (`gh auth status`)
- [ ] Command syntax matches documentation
- [ ] Exit codes checked and handled appropriately
- [ ] Rate limits considered (code search: 10/min, repo search: 30/min)
- [ ] JSON output parsed correctly (if using --json)
- [ ] Artifacts downloaded to correct directory (if applicable)
- [ ] PR/Issue created with proper labels and assignees (if applicable)
- [ ] Workflow triggered and monitored to completion (if applicable)
```

---

## When Not to Use

This skill covers `gh` CLI and GitHub Actions workflow authoring. Do **not** use for:

- **Git commands**: `git push`, `git commit`, `git pull` (use git directly)
- **GitHub web UI**: Questions about github.com interface navigation
- **GitHub Desktop**: Different application entirely
- **Direct curl/HTTP**: API calls without `gh` wrapper
- **GitHub mobile app**: Mobile-specific features

Related Skills

mastering-hooks

40
from SpillwaveSolutions/agent_rulez

Master RuleZ, the high-performance AI policy engine for development workflows. Use when asked to "install rulez", "create hooks", "debug hooks", "hook not firing", "configure context injection", "validate hooks.yaml", "PreToolUse", "PostToolUse", "block dangerous commands", "multi-platform hooks", "Gemini CLI hooks", "Copilot hooks", "OpenCode hooks", "dual-fire events", or "cross-platform rules". Covers installation, rule creation, multi-platform adapters, troubleshooting, and optimization.

mastering-typescript

40
from SpillwaveSolutions/agent_rulez

Master enterprise-grade TypeScript development with type-safe patterns, modern tooling, and framework integration. This skill provides comprehensive guidance for TypeScript 5.9+, covering type system fundamentals (generics, mapped types, conditional types, satisfies operator), enterprise patterns (error handling, validation with Zod), React integration for type-safe frontends, NestJS for scalable APIs, and LangChain.js for AI applications. Use when building type-safe applications, migrating JavaScript codebases, configuring modern toolchains (Vite 7, pnpm, ESLint, Vitest), implementing advanced type patterns, or comparing TypeScript with Java/Python approaches.

mastering-python-skill

40
from SpillwaveSolutions/agent_rulez

Modern Python coaching covering language foundations through advanced production patterns. Use when asked to "write Python code", "explain Python concepts", "set up a Python project", "configure Poetry or PDM", "write pytest tests", "create a FastAPI endpoint", "run uvicorn server", "configure alembic migrations", "set up logging", "process data with pandas", or "debug Python errors". Triggers on "Python best practices", "type hints", "async Python", "packaging", "virtual environments", "Pydantic validation", "dependency injection", "SQLAlchemy models".

mastering-git-cli

40
from SpillwaveSolutions/agent_rulez

Git CLI operations, workflows, and automation for modern development (2025). Use when working with repositories, commits, branches, merging, rebasing, worktrees, submodules, or multi-repo architectures. Includes parallel agent workflow patterns, merge strategies, conflict resolution, and large repo optimization. Triggers on git commands, version control, merge conflicts, worktree setup, submodule management, repository troubleshooting, branch strategy, rebase operations, cherry-pick decisions, and CI/CD git integration.

sdd

40
from SpillwaveSolutions/agent_rulez

This skill should be used when users want guidance on Spec-Driven Development methodology using GitHub's Spec-Kit. Guide users through executable specification workflows for both new projects (greenfield) and existing codebases (brownfield). After any SDD command generates artifacts, automatically provide structured 10-point summaries with feature status tracking, enabling natural language feature management and keeping users engaged throughout the process.

Workflow & ProductivityClaude

using-claude-code-cli

40
from SpillwaveSolutions/agent_rulez

Invoke Claude Code CLI from Python orchestrators and shell scripts. Use when asked to "spawn claude as subprocess", "automate claude cli", "run claude headless", "configure --allowedTools", "set up claude hooks", or "parallel claude invocation". Covers permissions, directory access (--add-dir), hooks, sandbox mode, and async patterns.

release-rulez

40
from SpillwaveSolutions/agent_rulez

RuleZ release workflow automation. Use when asked to "release RuleZ", "create a release", "prepare release", "tag version", "hotfix release", or "publish RuleZ". Covers version management from Cargo.toml, changelog generation from conventional commits, PR creation, tagging, hotfix workflows, and GitHub Actions release monitoring.

vercel-react-best-practices

40
from SpillwaveSolutions/agent_rulez

React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.

project-memory

40
from SpillwaveSolutions/agent_rulez

Set up and maintain a structured project memory system in docs/project_notes/ that tracks bugs with solutions, architectural decisions, key project facts, and work history. Use this skill when asked to "set up project memory", "track our decisions", "log a bug fix", "update project memory", or "initialize memory system". Configures both CLAUDE.md and AGENTS.md to maintain memory awareness across different AI coding tools.

pr-reviewer

40
from SpillwaveSolutions/agent_rulez

Comprehensive GitHub Pull Request code review skill. Use when asked to "review this PR", "code review", "review pull request", "check this PR", or when a GitHub PR URL is provided. Fetches PR metadata, diff, comments, commits, and related issues using gh CLI. Creates organized review workspace, analyzes code against industry-standard criteria, and optionally adds inline comments to the PR.

plantuml

40
from SpillwaveSolutions/agent_rulez

Generate PlantUML diagrams from text descriptions and convert them to PNG/SVG images. Use when asked to "create a diagram", "generate PlantUML", "convert puml to image", "extract diagrams from markdown", or "prepare markdown for Confluence". Supports all PlantUML diagram types including UML (sequence, class, activity, state, component, deployment, use case, object, timing) and non-UML (ER diagrams, Gantt charts, JSON/YAML visualization, mindmaps, WBS, network diagrams, wireframes, and more).

documentation-specialist

40
from SpillwaveSolutions/agent_rulez

This skill should be used when creating professional software documentation (SRS, PRD, OpenAPI, user manuals, tutorials, runbooks) from templates (greenfield) or reverse-engineering documentation from existing code like Spring Boot or FastAPI (brownfield). Also handles documentation audits/reviews, format conversion (Markdown, DOCX, PDF), and diagram generation (C4, Mermaid, PlantUML, ER, sequence). Use when asked to "create documentation", "document my code", "write SRS", "generate PRD", or "documentation specialist".