Skip to content

Package the official gh skill as a Claude Code plugin and emit install hints #14615

Open

Agent suggestions

Public preview

Description

@williammartin

Describe the feature or problem you’d like to solve

GitHub CLI provides an official Agent Skill for teaching coding agents how to use gh, but Claude Code users must currently discover and install it themselves.

Claude Code supports plugin hints, through which a CLI can recommend an official plugin by writing a structured <claude-code-hint /> line to stderr. Claude Code strips the line from command output and, when the session is eligible, offers the user a one-time installation prompt.

To use this mechanism, the existing gh skill needs to be packaged as a Claude Code plugin, published through an eligible official marketplace, and recommended when Claude Code invokes gh.

Anthropic's official marketplace already contains github@claude-plugins-official, which packages the official GitHub MCP server. That plugin provides GitHub API tools; it does not package the cli/cli-maintained Agent Skill or teach Claude Code to use the installed gh command. The proposed gh plugin is distinct from the existing GitHub MCP plugin: it packages the maintained skill for using the local gh executable and does not modify or replace the MCP integration.

Proposed solution

Package the existing official gh skill as a Claude Code plugin and publish it through an eligible official marketplace under an agreed permanent identifier.

Plugin source and maintenance

Keep cli/cli as the source of truth rather than maintaining a second copy of the skill in the marketplace repository. Anthropic's official marketplace supports manifestless skill bundles sourced from another repository, so the entry could use a reviewed, pinned cli/cli commit:

{
  "name": "gh",
  "source": {
    "source": "git-subdir",
    "url": "https://github.com/cli/cli.git",
    "path": "skills",
    "ref": "trunk",
    "sha": "<reviewed-commit-sha>"
  },
  "strict": false,
  "skills": ["./gh-skill"]
}

Under this model:

  • cli/cli owns the skill source, tests, and compatibility.
  • The official marketplace pins a reviewed cli/cli commit rather than copying the skill.
  • Updating the plugin advances that pin through a marketplace pull request, potentially using automation.
  • Anthropic retains review and publication control for the official catalog.
  • A skill change is not considered published to plugin users until the marketplace entry points to a reviewed commit containing it.
  • Existing installations receive published changes through the official marketplace's default auto-update behavior.

Plugin hint emission

When CLAUDE_CODE_CHILD_SESSION is non-empty, every gh process invocation should write exactly one valid hint on its own stderr line:

<claude-code-hint v="1" type="plugin" value="<registered-plugin>@<official-marketplace>" />

Use CLAUDE_CODE_CHILD_SESSION rather than CLAUDECODE so commands manually entered in a Claude Code IDE-integrated terminal do not produce a raw hint. This establishes Claude Code 2.1.172 as the minimum version for automatic discovery.

Child-process terminal state and outer-session eligibility are separate concerns. gh should not inspect whether its standard streams are attached to a TTY or attempt to infer whether Claude Code can show a prompt. Claude Code decides whether to display the recommendation from the eligibility of the outer session.

The emitter should:

  • Run for every invocation, including help commands, successful commands, and commands that fail.
  • Ignore whether stdin, stdout, or stderr is attached to a TTY; child-process terminal state is not a protocol signal.
  • Emit exactly once per gh process.
  • Preserve the command's existing stdout, stderr, and exit status.
  • Remain stateless: gh should not inspect whether the plugin is installed or remember whether the user rejected it.
  • Emit nothing when CLAUDE_CODE_CHILD_SESSION is unset or empty.

Claude Code remains responsible for stripping the tag, checking marketplace and policy eligibility, installing the plugin, and suppressing repeat prompts. gh continues emitting after the user rejects or installs the plugin; Claude Code silently ignores subsequent hints.

Acceptance criteria: install the official plugin

Feature: Install the official gh plugin

  Scenario: Install the plugin from its recommendation
    Given the official `gh` plugin is listed in an eligible official marketplace
    And the plugin is not installed at user scope
    And Claude Code displays the official `gh` plugin recommendation
    When the user chooses "Yes, install"
    Then Claude Code installs the registered official `gh` plugin at user scope

  Scenario: Use the maintained skill in a subsequent session
    Given the official `gh` plugin is installed at user scope
    When the user starts a subsequent Claude Code session
    Then the maintained `gh` skill is available in that session

Acceptance criteria: emit and process the recommendation

Feature: Discover the official gh plugin from gh

  Scenario: Emit the plugin hint for a successful command
    Given `CLAUDE_CODE_CHILD_SESSION` is non-empty
    And the official `gh` plugin has a registered identifier in an eligible official marketplace
    When Claude Code invokes `gh version`
    Then `gh` writes exactly one valid `claude-code-hint` line containing the registered plugin identifier to stderr
    And the hint occupies its own line
    And the standard version output is written to stdout
    And the command exits successfully

  Scenario: Emit the plugin hint for a help command
    Given `CLAUDE_CODE_CHILD_SESSION` is non-empty
    When Claude Code invokes `gh help`
    Then `gh` writes exactly one valid `claude-code-hint` line to stderr
    And the standard help output is written to stdout
    And the command exits successfully

  Scenario: Emit the plugin hint for a failing command
    Given `CLAUDE_CODE_CHILD_SESSION` is non-empty
    When Claude Code invokes `gh this-command-does-not-exist`
    Then `gh` writes exactly one valid `claude-code-hint` line to stderr
    And the standard unknown-command error is written to stderr
    And the command exits unsuccessfully

  Scenario Outline: Emit independently of standard stream terminal state
    Given `CLAUDE_CODE_CHILD_SESSION` is non-empty
    And stdin is <terminal state>
    And stdout is <terminal state>
    And stderr is <terminal state>
    When Claude Code invokes `gh version`
    Then `gh` writes exactly one valid `claude-code-hint` line to stderr
    And the standard version output is written to stdout
    And the command exits successfully

    Examples:
      | terminal state        |
      | attached to a TTY     |
      | not attached to a TTY |

  Scenario: Run gh without the child-session variable
    Given `CLAUDE_CODE_CHILD_SESSION` is not set
    When the user runs `gh version`
    Then stderr is empty
    And the standard version output is written to stdout
    And the command exits successfully

  Scenario: Run gh with an empty child-session variable
    Given `CLAUDE_CODE_CHILD_SESSION` is empty
    When the user runs `gh version`
    Then stderr is empty
    And the standard version output is written to stdout
    And the command exits successfully

  Scenario: Show the recommendation in an eligible outer session
    Given the outer Claude Code session is local
    And the outer Claude Code session is interactive
    And the outer Claude Code session is attended
    And analytics are enabled
    And plugin installation hints are enabled
    And the official `gh` plugin is not installed
    And policy permits the official `gh` plugin
    And `CLAUDE_CODE_CHILD_SESSION` is non-empty
    When Claude Code invokes `gh version`
    Then Claude Code displays the "Plugin recommendation" dialog
    And the dialog names the official `gh` plugin
    And the dialog names its official marketplace

  Scenario: Continue normally in a non-interactive outer session
    Given the outer Claude Code session is non-interactive
    And `CLAUDE_CODE_CHILD_SESSION` is non-empty
    When Claude Code invokes `gh version`
    Then `gh` writes exactly one valid `claude-code-hint` line to stderr
    And Claude Code displays the standard command result
    And the plugin hint is not shown in the command output
    And the "Plugin recommendation" dialog is not displayed

  Scenario: Continue normally after the user rejects the recommendation
    Given the user previously chose "No" for the official `gh` plugin recommendation
    And `CLAUDE_CODE_CHILD_SESSION` is non-empty
    When Claude Code invokes `gh version`
    Then `gh` writes exactly one valid `claude-code-hint` line to stderr
    And Claude Code displays the standard command result
    And the plugin hint is not shown in the command output
    And the "Plugin recommendation" dialog is not displayed

  Scenario: Continue normally when the plugin is already installed
    Given the official `gh` plugin is installed
    And `CLAUDE_CODE_CHILD_SESSION` is non-empty
    When Claude Code invokes `gh version`
    Then `gh` writes exactly one valid `claude-code-hint` line to stderr
    And Claude Code displays the standard command result
    And the plugin hint is not shown in the command output
    And the "Plugin recommendation" dialog is not displayed

Acceptance criteria: deliver skill updates

Feature: Receive updates to the official gh skill

  Scenario: Publish an approved skill change
    Given an approved change to the maintained `gh` skill is merged to `trunk`
    And the marketplace entry references an earlier reviewed `cli/cli` commit
    When maintainers publish a plugin update
    Then the marketplace entry references a reviewed commit containing the skill change
    And the plugin resolves the `gh` skill from that commit

  Scenario: Download an update automatically
    Given the official `gh` plugin is installed
    And auto-update is enabled for the official marketplace
    And the marketplace has published a newer pinned version of the plugin
    When Claude Code refreshes the official marketplace after a session starts
    Then Claude Code downloads the updated plugin
    And Claude Code displays "Plugin updated: gh · Run /reload-plugins to apply"

  Scenario: Apply an update in the running session
    Given Claude Code has downloaded an update to the official `gh` plugin
    When the user runs `/reload-plugins`
    Then the updated maintained `gh` skill is available in the session

  Scenario: Apply an update in a subsequent session
    Given Claude Code has downloaded an update to the official `gh` plugin
    When the user starts a subsequent Claude Code session
    Then the updated maintained `gh` skill is available in the session

Additional context

The protocol explicitly permits emitting the hint on every invocation because Claude Code prompts only once per plugin, regardless of the user's answer. Choosing No suppresses future prompts for that plugin, while No, and don't show plugin installation hints again disables future plugin-hint prompts for the user.

No existing issue was found for packaging the maintained gh skill as an official Claude Code plugin and recommending it from gh.

Open delivery decisions:

  • Whether Anthropic will accept gh as the permanent official-marketplace identifier.
  • Which team owns proposing and reviewing marketplace pin updates.
  • What event initiates a pin update: an individual skill change, a GitHub CLI release, or a separate plugin release decision. This proposal does not require a fixed publication SLA.
  • Whether advancing the pinned commit should be automated, and where that automation should run.

Activity

  1. added
    needs-triage
    on Oct 7, 2026
  2. cli-triage commented on Oct 7, 2026

    @cli-triage
  3. added
    enhancement
    core
    on Oct 7, 2026
  4. github-actions commented on Oct 7, 2026

    @github-actions
  5. removed
    needs-triage
    on Oct 7, 2026
  6. wawerekxxx-debug commented on Oct 7, 2026

    @wawerekxxx-debug
  7. axelson commented on Nov 6, 2026

    @axelson

    Can this not be emitted when stderr is piped? Otherwise if Claude Code runs a command like gh <SOME_CMD> 2>&1 | jq <FILTER> that filtering will fail (I've seen this with the Stripe CLI). Or another way to "opt-out" of this would work as well, such as an environment variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    coreenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions