一键导入
trace-state-machine
Parse PRStatus, trace all state transitions across source files, and flag anomalies.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Parse PRStatus, trace all state transitions across source files, and flag anomalies.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Review a pull request diff for bugs, security issues, and code quality. Use when reviewing PRs or diffs.
Guide adding a new config field across types, defaults, config.yaml, and optional state/env wiring.
System prompt for automated PR description generation. Used by the runtime module.
Trace a specific PR through the review pipeline to diagnose failures.
Read state.json and diagnose PR statuses, errors, stuck entries, and anomalies.
Generate a structured PR description from the diff. Fetches the diff, analyzes changes, and optionally applies the description.
| name | trace-state-machine |
| description | Parse PRStatus, trace all state transitions across source files, and flag anomalies. |
| user-invocable | true |
You are a state machine analyzer for the claude-code-reviewer project. Your job is to extract all PR status transitions from the codebase, build a complete transition graph, and flag issues.
Read src/types.ts and extract all values from the PRStatus type union:
pending_review, reviewing, reviewed, changes_pushed, error, skipped, closed, mergedSearch across all files in src/ for status transitions. Look for:
setStatus( calls — the third argument is the new statusstore.update( calls with status: in the updates objectstatus: assignments in object literals (e.g., in getOrCreate, migrateV1)For each transition found, record:
src/reviewer/reviewer.ts — review cycle transitions:
reviewing)evaluateTransitions)evaluateTransitions)src/webhook/server.ts — lifecycle events: any→closed, any→merged, any→skipped (converted_to_draft when skipDrafts enabled)src/state/store.ts — crash recovery: reviewing→pending_review; initial creation: →pending_review; V1 migration: →reviewedsrc/reviewer/comment-verifier.ts — reviewed→pending_review (when review/comment is deleted or dismissed)src/state/cleanup.ts — deletion of closed/merged/stuck-error entries (not a status change, but removes from state)src/polling/poller.ts — reconcileClosedPRs() performs direct transitions: any non-terminal→merged, any non-terminal→closed (reconciles state when PRs are closed/merged between poll cycles). Also calls processPR and evaluateTransitions which trigger transitions listed under reviewer.ts.src/state/decisions.ts — does not set status directly but gates which transitions can happenPresent all transitions as a markdown table:
| From | To | Trigger | File:Line |
|---|---|---|---|
| pending_review | reviewing | Review started | reviewer.ts:XX |
| reviewing | reviewed | Review completed | reviewer.ts:XX |
| ... | ... | ... | ... |
Also note transitions from "any" state (e.g., →closed, →merged from lifecycle events).
Check these invariants:
closed and merged should never transition to another status (cleanup deletes them, but doesn't change status)Read the documented state flow from CLAUDE.md:
pending_review → reviewing → reviewed → changes_pushed → (cycle)
↓
error → retry (exponential backoff) or stuck (max retries)
Any → closed / merged (terminal)
Any → skipped (draft, WIP, diff_too_large) → pending_review (when cleared)
Flag any transitions found in code that are NOT in the documentation, and any documented transitions NOT found in code.
Report any issues:
PRStatus that never appear in any transitionUse clear section headers and the markdown table for transitions. Prefix anomalies with ⚠. End with a summary verdict: whether the state machine is consistent with documentation.