Inspect GitHub PR for CI failures, merge conflicts, change requests, and unresolved review threads. Create fix plans and implement after user approval. Resolve review threads and notify reviewers after fixes.
This skill inherits all available tools. When active, it can use any tool Claude has access to.
LICENSE.txtscripts/inspect_pr_checks.pyUse gh to inspect PRs for:
Then propose a fix plan, implement after explicit approval, and optionally resolve threads and notify reviewers.
plan skill for drafting and approving the fix plan.Prereq: ensure gh is authenticated (for example, run gh auth login once), then run gh auth status with escalated permissions (include workflow/repo scopes) so gh commands succeed.
repo: path inside the repo (default .)pr: PR number or URL (optional; defaults to current branch PR)mode: inspection mode (checks, conflicts, reviews, all)gh authentication for the repo host# Inspect all (CI, conflicts, reviews) - default mode
python "<path-to-skill>/scripts/inspect_pr_checks.py" --repo "." --pr "<number>"
# CI checks only
python "<path-to-skill>/scripts/inspect_pr_checks.py" --repo "." --pr "<number>" --mode checks
# Conflicts only
python "<path-to-skill>/scripts/inspect_pr_checks.py" --repo "." --pr "<number>" --mode conflicts
# Reviews only (Change Requests + Unresolved Threads)
python "<path-to-skill>/scripts/inspect_pr_checks.py" --repo "." --pr "<number>" --mode reviews
# JSON output
python "<path-to-skill>/scripts/inspect_pr_checks.py" --repo "." --pr "<number>" --json
# Resolve all unresolved threads after fixing
python "<path-to-skill>/scripts/inspect_pr_checks.py" --repo "." --pr "<number>" --resolve-threads
# Add a comment to notify reviewers
python "<path-to-skill>/scripts/inspect_pr_checks.py" --repo "." --pr "<number>" --add-comment "Fixed all issues. Please re-review."
Verify gh authentication.
gh auth status in the repo with escalated scopes (workflow/repo).Resolve the PR.
gh pr view --json number,url.Inspect based on mode:
Conflicts Mode (--mode conflicts):
mergeable and mergeStateStatus fields.CONFLICTING or DIRTY, report conflict details.Reviews Mode (--mode reviews):
CHANGES_REQUESTED state.Checks Mode (--mode checks):
All Mode (--mode all):
Summarize issues for the user.
Create a plan.
plan skill to draft a fix plan and request approval.Implement after approval.
Resolve review threads (optional).
--resolve-threads, resolve all unresolved threads via GraphQL mutation.Repository Permissions > Contents: Read and Write.Notify reviewers (optional).
--add-comment "message", post a comment to the PR.Recheck status.
gh pr checks to confirm.Comprehensive PR inspection tool. Exits non-zero when issues remain.
Arguments:
| Argument | Default | Description |
|---|---|---|
--repo | . | Path inside the target Git repository |
--pr | (current) | PR number or URL |
--mode | all | Inspection mode: checks, conflicts, reviews, all |
--max-lines | 160 | Max lines for log snippets |
--context | 30 | Context lines around failure markers |
--json | false | Emit JSON output |
--resolve-threads | false | Resolve unresolved review threads |
--add-comment | (none) | Add a comment to the PR |
Exit codes:
0: No issues found1: Issues detected or error occurredDetects merge conflicts via mergeable and mergeStateStatus fields.
CONFLICTING / DIRTY: Conflict detectedMERGEABLE / CLEAN: No conflictsFetches reviews with state == "CHANGES_REQUESTED" and displays:
Uses GraphQL to fetch threads where isResolved == false:
Use --resolve-threads to mark threads as resolved via GraphQL mutation resolveReviewThread.
Required permissions:
Pull requests + Contents: Read and Writerepo scopeUse --add-comment "message" to post a summary comment to the PR after fixes.
PR #123: Comprehensive Check Results
============================================================
MERGE CONFLICTS
------------------------------------------------------------
Status: CONFLICTING
Merge State: DIRTY
Base: main <- Head: feature/my-branch
Action Required: Resolve conflicts before merging
CHANGE REQUESTS
------------------------------------------------------------
From @reviewer1 (2025-01-15):
"Please fix these issues..."
UNRESOLVED REVIEW THREADS
------------------------------------------------------------
[1] src/main.ts:42
Thread ID: PRRT_xxx123
@reviewer1: This needs refactoring...
CI FAILURES
------------------------------------------------------------
Check: build
Details: https://github.com/...
Failure snippet:
Error: TypeScript compilation failed
...
============================================================
{
"pr": "123",
"conflicts": {
"hasConflicts": true,
"mergeable": "CONFLICTING",
"mergeStateStatus": "DIRTY",
"baseRefName": "main",
"headRefName": "feature/my-branch"
},
"changeRequests": [
{
"id": 123456,
"reviewer": "reviewer1",
"body": "Please fix these issues...",
"submittedAt": "2025-01-15T12:00:00Z"
}
],
"unresolvedThreads": [
{
"id": "PRRT_xxx123",
"path": "src/main.ts",
"line": 42,
"comments": [
{"author": "reviewer1", "body": "This needs refactoring"}
]
}
],
"ciFailures": [
{
"name": "build",
"status": "ok",
"logSnippet": "..."
}
]
}