Github

From the-open-agent/openagent · View interactive version

Github is an AI agent skill from the GitHub repository the-open-agent/openagent. Use when interacting with GitHub repositories, authentication, remotes, pushes, or repository creation through the GitHub CLI and related git workflows.

How to use this skill

Skill file

GitHub

Overview

Prefer gh for all GitHub operations. The default goal is to complete the full GitHub flow with the least possible user effort: detect existing authentication first, reuse it if available, and only ask the user for the smallest missing step.

Never ask the user to manually perform a long GitHub setup if the agent can check, reuse, or finish it directly.

Core Rules

Interactive login driving rules

When using gh auth login through a shell session, do not assume the browser login step has started after the first prompt or after sending one key.

You must continue driving the interactive flow until there is explicit evidence of one of these states:

  1. GitHub CLI has clearly started browser/device authentication
  2. GitHub CLI is explicitly waiting for the user to complete external authentication
  3. GitHub CLI reports that authentication succeeded
  4. GitHub CLI reports a real error and cannot continue

While driving the login flow:

Acceptable evidence that browser or external auth has actually started includes output such as:

If the shell session remains running but only shows that an earlier prompt was answered, continue polling instead of summarizing the state prematurely.

Only ask the user to act when the output clearly shows an external action is now required.

When the user says they completed browser or device authorization, do not start a new gh auth login flow immediately.

Instead:

  1. continue polling the existing shell session if it is still running
  2. wait for explicit success or failure from that same session
  3. only if that session has exited or is unrecoverable, then check gh auth status
  4. only start a brand-new login flow if the previous login session has clearly failed or been closed

If the shell output contains prompts like:

then send enter automatically and continue polling the same session.

Do not stop at that prompt.

Do not ask the user to confirm completion yet.

Do not start a new login flow while this session is still running.

Credential Handling Priority

1. Reuse `gh` authentication first

Check whether gh exists and is already authenticated.

Use this path when possible:

If gh is authenticated, do not ask the user for tokens, passwords, SSH keys, or browser login.

2. If `gh` exists but is not authenticated, log in with `gh` directly

If gh is installed but not authenticated, use gh auth login directly and continue the GitHub flow after login succeeds.

Preferred order:

  1. browser/web login via gh auth login -h github.com -w
  2. standard interactive gh auth login -h github.com
  3. PAT-based login only if the normal gh login path is unavailable or fails

Rules:

When login requires user interaction:

After login succeeds, continue directly with:

3. If `gh` is unavailable, try to install it first

If gh is missing:

Acceptable install attempts include examples like:

Rules:

4. If `gh` is still unavailable, fall back to Git

If gh is missing:

Check for likely reusable auth:

Only if those paths fail should the user be asked for one minimal credential input.

Minimal-Interruption Prompting

When user input is required, ask for only one concrete item at a time.

Good prompts:

Bad prompts:

Safe Credential Rules

Standard Execution Flow

A. Detect environment

Check in this order:

  1. Is this already a Git repo?
  2. Is there already a remote?
  3. Is gh installed?
  4. Is gh authenticated?
  5. If not using gh, does Git already have usable auth?

B. If already connected to GitHub

If the repo already has a valid GitHub remote and push access works:

C. If Git repo exists but no GitHub repo exists yet

Preferred:

Only ask the user for:

D. If not a Git repo yet

Do the setup directly:

Do not ask the user to perform these steps manually.

`gh`-First Behavior

When gh is available and authenticated, prefer commands in this shape:

Use plain Git only for local repository operations or when gh cannot complete the GitHub-side action.

Git / API Fallback Behavior

Only use this fallback when:

Fallback order:

  1. direct GitHub API + local git
  2. plain git with existing SSH or credential-helper auth
  3. HTTPS + PAT only if no better reusable auth exists

Fallback rules:

If PAT is required:

Success Criteria

A successful run means:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.