Skip to content
Development
Command

/context-load-gh-cli

Load comprehensive GitHub CLI context with dynamic repository analysis and workflow optimization

From plugin
claude-cmd
313180 skills180 commands

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/context-load-gh-cli

Context preview

What this command does when you run it.

Load comprehensive GitHub CLI context with dynamic repository analysis and workflow optimization

Command definition

context-load-gh-cli.md
allowed-tools: Read, Write, Bash(gh:*), Bash(git:*), Bash(jq:*), Bash(gdate:*)
name: "Context Load Gh Cli"
description: "Load comprehensive GitHub CLI context with dynamic repository analysis and workflow optimization"
author: "wcygan"
tags: ["context","web"]
version: "1.0.0"
created_at: "2025-07-14T00:00:00Z"
updated_at: "2025-07-14T00:00:00Z"

Context

  • Session ID: !`gdate +%s%N`
  • Current directory: !`pwd`
  • Git repository: !`git rev-parse --is-inside-work-tree 2>/dev/null && echo "Yes" || echo "No"`
  • Repository info: !`gh repo view --json owner,name,url 2>/dev/null | jq -r '.owner.login + "/" + .name + " (" + .url + ")' 2>/dev/null || echo "Not in GitHub repository"`
  • GitHub CLI status: !`gh auth status 2>/dev/null | head -1 || echo "Not authenticated"`
  • Current branch: !`git branch --show-current 2>/dev/null || echo "No git repository"`
  • Open PRs: !`gh pr list --json number,title --limit 3 2>/dev/null | jq -r '.[] | "#" + (.number | tostring) + ": " + .title' 2>/dev/null || echo "No open PRs or no access"`
  • Open issues: !`gh issue list --json number,title --limit 3 2>/dev/null | jq -r '.[] | "#" + (.number | tostring) + ": " + .title' 2>/dev/null || echo "No open issues or no access"`
  • Recent commits: !`git log --oneline -5 2>/dev/null || echo "No git history"`
  • Git status: !`git status --porcelain 2>/dev/null || echo "No git repository"`
  • Recent activity: !`gh api user/events --limit 3 2>/dev/null | jq -r '.[0:2][] | .type + ": " + .repo.name + " (" + (.created_at | split("T")[0]) + ")' 2>/dev/null || echo "No recent activity or no access"`

Your Task

STEP 1: Initialize GitHub CLI context analysis session

  • CREATE session state file: `/tmp/gh-cli-context-$SESSION_ID.json`
  • SET initial state:
  {
    "sessionId": "$SESSION_ID",
    "timestamp": "$(date -Iseconds)",
    "repositoryContext": {
      "isGitRepo": "auto-detect",
      "repoInfo": "auto-detect",
      "currentBranch": "auto-detect",
      "hasOpenPRs": "auto-detect",
      "hasOpenIssues": "auto-detect"
    },
    "githubCliStatus": {
      "isInstalled": "auto-detect",
      "isAuthenticated": "auto-detect",
      "authenticatedUser": "auto-detect"
    },
    "loadedSections": [],
    "contextualExamples": {},
    "workflowPatterns": []
  }
  • ANALYZE current GitHub and repository context from Context section

STEP 2: GitHub CLI environment validation and setup

TRY:

  • VERIFY GitHub CLI installation and authentication status
  • DETECT current repository context and permissions
  • IDENTIFY available GitHub operations based on authentication level
  • ASSESS repository-specific workflow patterns

CATCH (github_cli_not_available):

  • LOG GitHub CLI installation status to session state
  • PROVIDE installation guidance for missing CLI
  • INCLUDE authentication setup instructions
  • SAVE fallback web-based GitHub operation guidance

STEP 3: Dynamic context-aware GitHub CLI guidance loading

IF isAuthenticated AND isGitRepo:

  • LOAD repository-specific GitHub CLI patterns
  • GENERATE contextual examples for current repository
  • INCLUDE workflow optimizations for detected repository patterns
  • ADD current PR/issue context for immediate operations

ELSE IF isAuthenticated AND NOT isGitRepo:

  • LOAD general GitHub CLI operations guidance
  • FOCUS on repository discovery and organization management
  • INCLUDE authentication and organization-level operations
  • PROVIDE repository creation and cloning patterns

ELSE IF NOT isAuthenticated:

  • LOAD basic GitHub CLI authentication guidance
  • PROVIDE setup and configuration instructions
  • INCLUDE authentication troubleshooting and alternatives
  • ADD web-based GitHub operation fallbacks

STEP 4: Comprehensive GitHub CLI knowledge synthesis

FOR EACH workflow_category IN ["pull-requests", "issues", "reviews", "api-operations", "authentication"]:

  • LOAD category-specific command patterns and best practices
  • GENERATE contextual examples based on current repository state
  • INCLUDE advanced operations and troubleshooting guidance
  • ADD workflow optimization recommendations
  • SAVE category knowledge to session state

STEP 5: Repository-specific workflow analysis and recommendations

IF repository detected AND has_open_issues_or_prs:

Think deeply about optimal GitHub workflow patterns for this repository based on current activity, open PRs, and issue patterns.

  • ANALYZE current PR and issue patterns for workflow optimization
  • IDENTIFY common operations that could be automated or streamlined
  • GENERATE repository-specific GitHub CLI command templates
  • PROVIDE workflow efficiency recommendations

STEP 6: Extended thinking integration for complex scenarios

IF complex_repository_patterns_detected:

  • Enable extended thinking for complex GitHub workflow optimization
  • Consider multi-repository coordination scenarios
  • Analyze enterprise GitHub patterns and governance requirements
  • Provide advanced automation and integration strategies

STEP 7: Session state management and artifact creation

  • UPDATE session state with loaded knowledge and contextual examples
  • SAVE repository-specific GitHub CLI templates: `/tmp/gh-cli-context-$SESSION_ID/repo-templates.md`
  • CREATE workflow optimization guide: `/tmp/gh-cli-context-$SESSION_ID/workflow-optimization.md`
  • GENERATE session summary with key recommendations and next steps

FINALLY:

  • CLEAN UP temporary processing files
  • ARCHIVE session artifacts for future reference
  • REPORT comprehensive GitHub CLI context loading completion

GitHub CLI (`gh`) Comprehensive Knowledge Base

Core GitHub CLI Operations Framework

Overview

This guide provides comprehensive instructions for leveraging the GitHub CLI (`gh`) to manage pull requests, issues, comments, and reviews.

Pull Request Management

Creating Pull Requests

# Interactive creation (recommended for agents)
gh pr create

# With explicit parameters
gh pr create --title "PR title" --body "PR description"

# Using HEREDOC for multi-line body (
Read more
Ships withclaude-cmd

A lightweight (~46kB) and comprehensive CLI tool for managing Claude commands, configurations, and workflows.

Get the whole plugin