check-existing-pr

Check for existing pull requests on the current branch via gh and jq.

7|3|Updated Oct 23, 2025
One-click install
npx skills add https://github.com/BerryKuipers/claude-code-toolkit --skill check-existing-pr
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: check-existing-pr
Source: https://github.com/BerryKuipers/claude-code-toolkit/tree/main/.claude/skills/github-integration/check-existing-pr
Command: npx skills add https://github.com/BerryKuipers/claude-code-toolkit --skill check-existing-pr

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires gh CLI, git, jq.

What problem does it solves? Accidentally creating duplicate pull requests or not knowing if a PR already exists for a feature branch can lead to confusion, wasted effort, and merge conflicts. This Skill intelligently checks for existing PRs.

Core Features & Use Cases

  • Current Branch Detection: Automatically identifies the current git branch to query for associated pull requests.
  • GitHub CLI Integration: Leverages gh CLI to efficiently query GitHub for any existing PRs linked to the current branch.
  • PR Status Analysis: Parses PR details (number, title, URL, state, draft status) and checks the status of associated CI checks.
  • Resumption Recommendation: Provides a clear recommendation for workflow resumption based on the PR's status (e.g., "Monitor CI checks," "Fix failing CI checks," "Create pull request").
  • Use Case: Before initiating a new Pull Request in a conductor workflow, use this Skill to verify if one already exists, preventing duplicates and guiding the workflow to the correct next step.

Quick Start

Check for an existing PR on the current branch

check-existing-pr

Output:

{

"status": "success",

"prExists": true,

"pr": {

"number": 45,

"title": "feat: Add user dark mode preference toggle",

"state": "OPEN",

"isDraft": false,

"checks": {"total": 5, "passing": 4, "failing": 1, "pending": 0, "status": false}

},

"resumption": {"phase": 5, "action": "Fix failing CI checks"}

}

Frequently Asked Questions about check-existing-pr

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent duplicate pull requests in my workflow?

Check for existing PRs before creating new ones using GitHub CLI to query your current branch. This Skill automatically detects whether a PR already exists, its state, and CI check status, then recommends the next workflow action—whether to monitor checks, fix failures, or proceed with creation.

Can I check PR status and CI checks from the command line?

Yes. This Skill queries GitHub via `gh CLI`, parses PR details including number, title, state, and draft status, then evaluates associated CI check outcomes. It returns a structured result with total, passing, failing, and pending checks to guide your next step.

What should I do when a pull request already exists for my branch?

The Skill analyzes the existing PR's state and CI check results, then provides a resumption recommendation—such as monitoring ongoing checks, fixing failures, or waiting for results. This prevents duplicate work and keeps your workflow on track.

How does this Skill work with CI/CD workflows?

Designed for workflow orchestration contexts like Conductor Phase 4 and load-resumption-state, it detects the current branch, queries linked PRs, evaluates CI check status, and outputs a resumption phase and action to automate your next workflow step.

What tools do I need to check for existing PRs?

You need `gh CLI` for GitHub queries, `git` to identify your current branch, and `jq` to parse PR metadata. These dependencies enable efficient branch detection and PR status retrieval without manual GitHub navigation.