Skip to content
cccskills
FreePublished on GitHubEnglish overview

GitHub CLI usage

Use `gh`, the GitHub command-line tool, to list, inspect, and search issues, pull requests, repositories, and code. The skill also explains read-only REST and GraphQL queries, pagination, and ways to filter or format returned data.

OriginalShow the original description

Instructions for using the `gh` command to query and inspect GitHub state safely.

carbon-language/carbon-lang33,929 stars(GitHub 33,929 + cccskills 0)
Works withGitHub

Run score Not tested

See how to install

Good for

  • Checking an issue or pull request
  • Searching issues, code, or repositories
  • Querying GitHub data with the API

Overview

What it does

This skill explains how to use gh to search and inspect GitHub issues, pull requests, repositories, and code. It covers listing results, viewing individual items and pull request diffs, checking status, and searching with a query. For information unavailable through standard commands, it shows how to make read-only REST or GraphQL requests with gh api. Examples also cover fetching paginated results and filtering or formatting output with --json, --jq, and --template.

When it helps

Use it to check the state of existing issues, pull requests, or repositories before making changes. It is also useful when you want to find information on GitHub from the command line or retrieve only selected fields from an API.

Example requests

  • “Inspect this issue and find related open issues.”
  • “Show me this pull request’s diff and current status.”
  • “Get the repository’s contributors through the API.”

Notes

GitHub state changes through gh are prohibited, and api requests are limited to GET. The environment must have gh available. A human must change the default repository configuration when needed.

This overview was written by AI (OpenAI Codex) from the public SKILL.md. Check the original below for the exact behavior.

Document check

AI checked the SKILL.md for operations that need care and for setup requirements. The score comes only from actually running the skill (hands-on test).

SafetyAre sending data, deleting files, and running commands disclosed?
AGoodState changes are prohibited, and API use is limited to GET requests.
Easy setupDoes it need few tools or API keys, and are they documented?
BPartly lackingThe skill requires `gh`, but gives no installation steps.

Not counted in the score. Rated by AI (OpenAI Codex) as of Oct 26, 2026. Treat it as a guide and read the original before installing.

Disagree? Request a re-evaluation

Tell us which point is wrong and why. No login needed. We will check it against the SKILL.md, redo the evaluation, and show the result here.

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

Files included (1)

  • SKILL.md4.2 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

GitHub CLI usage

<!-- Part of the Carbon Language project, under the Apache License v2.0 with LLVM Exceptions. See /LICENSE for license information. SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -->

This skill provides instructions for using the GitHub CLI (gh) to query, inspect, and search GitHub state (issues, pull requests, repositories) for the Carbon project.

Safety First: Read-Only Usage

[!IMPORTANT] AI assistants MUST NOT use the gh tool to modify any GitHub project state. Do NOT run commands that create, edit, delete, label, comment on, or merge issues, pull requests, releases, or any other resources.

Allowed Verbs

  • list
  • view
  • search
  • status
  • api (Only with GET requests)

Prohibited Verbs

  • create
  • edit
  • delete
  • merge
  • reopen
  • close
  • comment
  • label

Repository Configuration

The gh tool interacts with a default repository when run within a local check out. For this project, the default repository is expected to be carbon-language/carbon-lang.

Verifying Default Repository

To verify the current default repository configuration:

gh repo view

The output should indicate the repository is carbon-language/carbon-lang.

Correcting Misconfigurations

If the default repository is misconfigured (for example, pointing to a personal fork or a different repository), the human operator must correct it.

[!IMPORTANT] AI Assistants MUST NOT attempt to mutate gh configuration or run commands that change the default repository (such as gh repository set-default).

Instruct the human operator to run the following command to select the correct default repository:

gh repo set-default

The operator will be prompted to select the correct repository (e.g., carbon-language/carbon-lang) from the available remotes.

Common Query Commands

Issues

  • List issues: gh issue list
  • View specific issue: gh issue view <number>
  • Search issues: gh issue search "<query>"
    • Example: gh issue search "crash" --state open

Pull Requests

  • List PRs: gh pr list
  • View specific PR: gh pr view <number>
  • View PR diff: gh pr diff <number>
  • Check PR status: gh pr status

Search

  • Search code: gh search code "<query>"
  • Search repositories: gh search repos "<query>"

Advanced Usage: GitHub API

For queries that are not supported by standard gh commands, you can use the gh api command to query the GitHub REST or GraphQL APIs.

REST API

Query the REST API using paths relative to the API root.

  • List contributors:

    gh api repos/carbon-language/carbon-lang/contributors
    
  • List issue comments:

    gh api repos/carbon-language/carbon-lang/issues/<issue_number>/comments
    

GraphQL API

For complex queries, use GraphQL to fetch exactly the data needed.

  • Get repository information:

    gh api graphql -f query='
      query {
        repository(owner: "carbon-language", name: "carbon-lang") {
          description
          stargazerCount
        }
      }
    '
    

Pagination

Use the --paginate flag to automatically fetch all pages of results.

gh api --paginate repos/carbon-language/carbon-lang/issues

Filtering and Formatting

Use --json to request JSON output, and --jq or --template to filter or format the results.

  • List PR titles and authors:

    gh pr list --json title,author --jq '.[] | "\(.title) by \(.author.login)"'
    
  • Format with Go templates:

    gh issue list --template '{{range .}}{{.number}} - {{.title}}{{"\n"}}{{end}}'
    

Documentation References

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Use this skill to read GitHub issue details and comments from the command line with `gh`. It covers issues referenced by number or URL, including issues in other repositories, and keeps access read-only so issue state is not changed.

  • Reading an issue and its full comment history
  • Opening an issue referenced by URL
  • Viewing an issue from another repository
carbon-language/carbon-lang33.9KUpdated Oct 26, 2026

Agent tools

FreeSummary

Use this skill to guide an AI assistant working in the Carbon repository on viewing, searching, and editing files with specialized environment tools. It also sets rules for temporary files and when custom programs may be used.

  • Choosing approved tools to view, search, or edit files
  • Checking where temporary analysis and test files belong
  • Deciding when a custom transformation program is allowed
carbon-language/carbon-lang33.9KUpdated Oct 26, 2026

Bazel usage

FreeSummary

Follow the Carbon project's Bazel workflow through Bazelisk, a version-managing launcher. Learn commands for building targets, running tests and binaries, enabling AddressSanitizer, and refreshing cached state after system dependency changes.

  • Building a Carbon target
  • Running focused project tests
  • Launching a Bazel-built binary
carbon-language/carbon-lang33.9KUpdated Oct 26, 2026

Use this skill to implement builtin functions in the Carbon compiler, from registering a function name and checking its signature to evaluating constant calls and generating LLVM IR for runtime calls. It also covers prelude bindings and focused tests.

  • Registering a new Carbon builtin function
  • Adding compile-time evaluation behavior
  • Lowering runtime builtins to LLVM IR
carbon-language/carbon-lang33.9KUpdated Oct 26, 2026

Code style

FreeSummary

Apply Carbon toolchain conventions for formatting Bazel, C++, Carbon, Markdown, and Python files. The skill also covers clear comments and documentation, accurate names, design choices, and concise commit descriptions.

  • Formatting a changed source file
  • Writing or revising code comments
  • Choosing names that match their meaning
carbon-language/carbon-lang33.9KUpdated Oct 26, 2026

Diagnostics

FreeSummary

Use this skill to add or revise diagnostics in the Carbon toolchain. It explains how to register message kinds, format typed arguments, attach source labels and context, and verify that diagnostics follow the project’s wording and test coverage rules.

  • Adding an error or warning to the Carbon compiler
  • Attaching source locations and explanatory labels
  • Checking diagnostic wording and formatting conventions
carbon-language/carbon-lang33.9KUpdated Oct 26, 2026

See all skills by carbon-language

Report a problem with this skill