Claude-skill-registry diagnose-state
Read state.json and diagnose PR statuses, errors, stuck entries, and anomalies.
git clone https://github.com/majiayu000/claude-skill-registry
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/diagnose-state" ~/.claude/skills/majiayu000-claude-skill-registry-diagnose-state && rm -rf "$T"
skills/data/diagnose-state/SKILL.mdYou are a diagnostics tool for the claude-code-reviewer service. Your job is to read and analyze the PR state file.
Input
The user may provide an optional argument: a PR identifier like
owner/repo#N or just N (PR number).
Data Source
Read the state file at
data/state.json. It follows the StateFileV2 format defined in src/types.ts:
- Top-level:
{ "version": 2, "prs": { "owner/repo#N": PRState, ... } } - Each
has: identity (owner, repo, number), status, PR metadata, review history, skip tracking, error tracking, comment/review tracking, timestamps, debouncePRState
If the file doesn't exist or is empty, report that and stop.
Modes
Summary Mode (no argument)
Present a dashboard of all tracked PRs:
-
Status Distribution — count PRs by status (
,pending_review
,reviewing
,reviewed
,changes_pushed
,error
,skipped
,closed
). Show as a table.merged -
Error Entries — for each PR with
, show:status: "error"- PR identifier (
)owner/repo#N
,lastError.phase
,lastError.message
(7 chars),lastError.shalastError.occurredAt
countconsecutiveErrors- Whether it's stuck (consecutiveErrors >=
frommaxRetries
, default: 3)config.yaml
- PR identifier (
-
Skipped PRs — for each PR with
, show:status: "skipped"- PR identifier and title
(draft / wip_title / diff_too_large)skipReason
if reason is diff_too_largeskipDiffLines
-
Anomaly Detection — flag these conditions:
- Any PR in
status (indicates a crash —reviewing
resets these on startup, so this only appears in a raw file read before restart or during an active review)store.ts - Any PR with
(stuck at max retries — readconsecutiveErrors >= maxRetries
fromreview.maxRetries
, default: 3)config.yaml - Any
PR with noreviewed
AND nocommentId
(review posted but no tracking ID)reviewId - Any
PR wherereviewed
(stale review — new push since last review)lastReviewedSha !== headSha - Any
PR wherereviewed
may have requeued it (reviewId/commentId is null but status is stillcomment-verifier.ts
)reviewed
- Any PR in
-
Summary Line — total PRs, active (non-terminal), terminal (closed + merged)
Single-PR Mode (with argument)
Look up the PR by key. If only a number is given, search all entries for a matching
number field. If not found, report that.
Display all fields of the
PRState grouped:
- Identity — owner, repo, number, key
- Status — current status, with interpretation
- PR Metadata — title, isDraft, headSha (abbreviated to 7 chars), baseBranch
- Review History — show
(7 chars),lastReviewedSha
, then format eachlastReviewedAt
as a table row:ReviewRecord
(7 chars) |sha
|reviewedAt
|verdict
| findings count (by severity: issue/suggestion/nitpick/question/praise) |posted
/commentIdreviewId- Show total findings breakdown across all reviews
- Skip Tracking — skipReason, skipDiffLines, skippedAtSha
- Error Tracking — lastError (phase, message, sha, occurredAt), consecutiveErrors
- Comment/Review Tracking — commentId, commentVerifiedAt, reviewId, reviewVerifiedAt
- Timestamps — firstSeenAt, updatedAt, closedAt, lastPushAt, lastReviewedAt
- Anomalies — same checks as summary mode, applied to this PR
Output Format
Use markdown tables and clear section headers. Keep it scannable. Use ⚠ prefix for anomalies and errors.