بنقرة واحدة
inspect-metrics
Operational metrics dashboard with anomaly detection from metrics endpoint or state file.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Operational metrics dashboard with anomaly detection from metrics endpoint or state file.
التثبيت باستخدام 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 | inspect-metrics |
| description | Operational metrics dashboard with anomaly detection from metrics endpoint or state file. |
| user-invocable | true |
You are an operational metrics inspector for the claude-code-reviewer service. You gather metrics and present a dashboard with anomaly detection.
Read config.yaml to get webhook.port (default: 3000).
Try fetching: curl -s http://localhost:<port>/metrics
The metrics endpoint returns a MetricsSnapshot JSON (defined in src/metrics.ts):
{
"uptime": 3600,
"reviews": { "total": 10, "byVerdict": { "APPROVE": 5, "REQUEST_CHANGES": 3, "COMMENT": 2, "unknown": 0 } },
"errors": { "total": 2, "byPhase": { "diff_fetch": 0, "clone_prepare": 0, "claude_review": 1, "comment_post": 1 } },
"skips": { "total": 1, "byReason": { "draft": 1 } },
"prs": { "total": 15, "byStatus": { ... } }
}
If the endpoint returns data, use it as the primary source. If it fails (connection refused, 404, etc.), fall back to Step 2.
Read data/state.json and compute metrics manually:
statusreviews[] arrays across all PRs, count by verdictlastError, count by lastError.phasestatus: "skipped", count by skipReasonNote that state-derived metrics only reflect current state, not historical totals (unlike the live metrics endpoint which counts events since startup).
Display metrics in organized tables:
| Status | Count |
|---|---|
| pending_review | N |
| reviewing | N |
| ... | ... |
| Total | N |
| Verdict | Count | % |
|---|---|---|
| APPROVE | N | X% |
| REQUEST_CHANGES | N | X% |
| COMMENT | N | X% |
| unknown | N | X% |
| Phase | Count |
|---|---|
| diff_fetch | N |
| clone_prepare | N |
| claude_review | N |
| comment_post | N |
| Reason | Count |
|---|---|
| draft | N |
| wip_title | N |
| diff_too_large | N |
If the live metrics endpoint was used, also show uptime formatted as human-readable (e.g., "2h 15m 30s").
Check for these conditions and flag with severity:
| Condition | Severity | Description |
|---|---|---|
| Error rate > 20% | WARNING | errors.total / reviews.total > 0.2 (skip if reviews.total is 0) |
| Stuck PRs | CRITICAL | Any PR with consecutiveErrors >= maxRetries (default: 3) |
| Stale reviews | WARNING | Any reviewed PR where lastReviewedSha != headSha |
| PRs in reviewing state | CRITICAL | Only detectable via live /metrics endpoint during active operation. The state file will never show this because store.ts crash recovery resets reviewing → pending_review on load. If using state file fallback, skip this check. |
| Dominant error phase > 50% | WARNING | One phase accounts for >50% of all errors |
| High review churn | WARNING | Any PR with >5 review records |
| Zero reviews | INFO | Service running but no reviews completed |
Read config.yaml for review.maxRetries to determine stuck threshold.
For state-based checks (stuck PRs, stale reviews, reviewing state), always read data/state.json even if the metrics endpoint was available.
From state file, compute:
lastReviewedAt across all PRs, show agefirstSeenAt among non-terminal PRslastError.occurredAt, show ageBased on anomaly detection, output a single-line verdict:
Format: Health: HEALTHY | DEGRADED (N warnings) | UNHEALTHY (N critical, M warnings)