# Gh PR checks exit code folds a by design red wait on the row

> Gh PR checks exit code folds a by design red wait on the row is an open-source agent skill for developer tools. Stops agents misreading a by-design red CI check as a failed pull request. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/wan-huiyan/agent-traffic-control/tree/main/plugins/agent-traffic-control/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row
- **Repository:** https://github.com/wan-huiyan/agent-traffic-control
- **GitHub stars:** 5
- **License:** MIT
- **Skill name:** gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row
- **Collection:** https://github.com/wan-huiyan/agent-traffic-control
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-04

## About

This skill covers a quirk of the GitHub CLI: gh pr checks reports one exit status for the whole pull request, so a check a repository keeps red on purpose, such as a required aggregation context on drafts, makes the command exit 1 even when every job that ran passed. The skill explains how to tell exit code 8 (pending) from a real failure and how to write a wait loop that polls the row for a specific check and sets its own exit status.

The workflow it gives the agent is a set of steps: read the exit code table from gh pr checks help, poll the per-check TSV rows or the JSON output (name, state, bucket) for the check that matters, keep an explicit list of contexts that are red by design, and confirm a red from the job log before reporting it as a failure. It also includes a verification step to run the waiter against a healthy draft and check it exits 0.

It expects the GitHub CLI (gh) to be installed and authenticated, plus a shell with awk and sed. The examples were measured on gh 2.97.0.

## When your agent uses it

> `gh pr checks` returns ONE exit status for the whole pull request, so a check your repo keeps red ON PURPOSE — a required aggregation context that is red while a PR is a draft, a placeholder context, a job the workflow allows to fail — makes the command exit non-zero on a pull request where everything that actually ran passed. Use when: (1) you are writing a background wait loop or watchdog that polls a PR and decides from `$?`; (2) a background poll came back "failed with exit code 1" and you are about to diagnose a red that may not exist; (3) you are about to report a PR as failing, or hold a queue on it, on the strength of an exit status; (4) your repo deliberately reds a context on drafts so a draft cannot merge on a green no suite produced. The exit code cannot tell a by-design red from a real one, and a non-zero exit from a backgrounded poll is surfaced by the harness exactly like a failing job. Poll the ROW for the check you care about and exit 0 yourself; `8` means pending, not failure; and confirm a

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/wan-huiyan/agent-traffic-control/tree/HEAD/plugins/agent-traffic-control/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row)
- [License: MIT](https://github.com/wan-huiyan/agent-traffic-control/tree/HEAD/plugins/agent-traffic-control/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row)

## Features

- **Exit code interpretation:** Explains what gh pr checks exit codes 0, 1 and 8 mean and why pending differs from failure.
- **Row-based polling:** Shows a shell loop that reads the state of one named check instead of the whole pull request.
- **By-design red registry:** Advises keeping a list of intentionally red contexts so only unexpected reds count as failures.
- **Log confirmation step:** Describes checking a job's log with gh run view before treating a red as expected or real.
- **Waiter verification:** Lists a test to confirm a background waiter exits 0 on a healthy draft pull request.

## Good for

- Wait for a specific CI check on a draft pull request before continuing work
- Write a background watchdog that polls a PR without misreading a deliberate red
- Check whether a failed background poll reflects a real CI failure
- Queue a pull request for landing only after its required check passes

## Install

### Claude Code

This skill ships in the `agent-traffic-control` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add wan-huiyan/agent-traffic-control
/plugin install agent-traffic-control@wan-huiyan-agent-traffic-control
```

Or copy only this skill to `~/.claude/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row &&
cp -R "$tmp/plugins/agent-traffic-control/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row" ~/.claude/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row &&
cp -R "$tmp/plugins/agent-traffic-control/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row" ~/.agents/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row &&
cp -R "$tmp/plugins/agent-traffic-control/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row" ~/.cursor/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/wan-huiyan/agent-traffic-control.git --path plugins/agent-traffic-control/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row
```

Or copy the folder to `~/.gemini/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row &&
cp -R "$tmp/plugins/agent-traffic-control/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row" ~/.copilot/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git
```

Then copy `agent-traffic-control/plugins/agent-traffic-control/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row` into your agent's skills folder as `gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row`. Agents that support SKILL.md read one folder per skill.

## FAQ

### When does Gh PR checks exit code folds a by design red wait on the row trigger?

It applies when writing a wait loop or watchdog that polls a pull request, when a background poll reports failed with exit code 1, when about to report a PR as failing based on an exit status, or when a repo deliberately reds a context on drafts.

### What does gh pr checks exit code 8 mean?

According to the skill, exit code 8 means checks are still pending, not failed.

### Does the skill change the repository's CI configuration?

No. It advises against making a by-design red context green and instead recommends fixing how the waiter reads the status.

### Which tools are needed?

The skill uses the GitHub CLI (gh) along with shell tools such as awk and sed, and was measured on gh 2.97.0.

### How do I install Gh PR checks exit code folds a by design red wait on the row in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row to use it in all your projects, or to .claude/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row in one project. Or install the agent-traffic-control plugin, which includes it: /plugin marketplace add wan-huiyan/agent-traffic-control, then /plugin install agent-traffic-control@wan-huiyan-agent-traffic-control.

### Does Gh PR checks exit code folds a by design red wait on the row run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Gh PR checks exit code folds a by design red wait on the row?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Gh PR checks exit code folds a by design red wait on the row?

The closest alternatives to Gh PR checks exit code folds a by design red wait on the row are Gh, Iterate PR, Fix ci, Gh fix ci and Fix PR.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Gh](https://ai-powered.com/skills/gh-prathamdby): Gh is an open-source agent skill for developer tools.
- [Iterate PR](https://ai-powered.com/skills/iterate-pr): Iterate PR is an open-source agent skill for developer tools.
- [Fix ci](https://ai-powered.com/skills/fix-ci): Fix ci is an open-source agent skill for developer tools.
- [Gh fix ci](https://ai-powered.com/skills/gh-fix-ci): Gh fix ci is a free agent skill for developer tools.
- [Fix PR](https://ai-powered.com/skills/fix-pr): Fix PR is an open-source agent skill for developer tools.
- [PR screenshots](https://ai-powered.com/skills/pr-screenshots-getsentry): PR screenshots is an open-source agent skill for developer tools.
- [Gh PR merge worktree checkout trap](https://ai-powered.com/skills/gh-pr-merge-worktree-checkout-trap): Gh PR merge worktree checkout trap is an open-source agent skill for developer tools.
- [Loop on ci](https://ai-powered.com/skills/loop-on-ci): Loop on ci is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/gh-pr-checks-exit-code-folds-a-by-design-red-wait-on-the-row
