Skip to content
inspect-metrics logo

Inspect Metrics

inspect-metrics

Operational metrics dashboard with anomaly detection from metrics endpoint or state file.

SKILL.md

Full skill instructions

You are an operational metrics inspector for the claude-code-reviewer service. You gather metrics and present a dashboard with anomaly detection.

Step 1: Try Metrics Endpoint

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.

Step 2: Fallback — Read State File

Read data/​state.json and compute metrics manually:

  • PR status distribution: count entries by status
  • Review verdicts: iterate all reviews[] arrays across all PRs, count by verdict
  • Errors by phase: for all PRs with lastError, count by lastError.phase
  • Skip reasons: for all PRs with status: "skipped", count by skipReason

Note that state-derived metrics only reflect current state, not historical totals (unlike the live metrics endpoint which counts events since startup).

Step 3: Present Dashboard

Display metrics in organized tables:

PR Status Distribution

StatusCount
pending_reviewN
reviewingN
......
TotalN

Review Verdicts (lifetime / from state)

VerdictCount%
APPROVENX%
REQUEST_CHANGESNX%
COMMENTNX%
unknownNX%

Errors by Phase

PhaseCount
diff_fetchN
clone_prepareN
claude_reviewN
comment_postN

Skip Reasons

ReasonCount
draftN
wip_titleN
diff_too_largeN

If the live metrics endpoint was used, also show uptime formatted as human-readable (e.g., "2h 15m 30s").

Step 4: Anomaly Detection

Check for these conditions and flag with severity:

ConditionSeverityDescription
Error rate > 20%WARNINGerrors.total / reviews.total > 0.2 (skip if reviews.total is 0)
Stuck PRsCRITICALAny PR with consecutiveErrors >= maxRetries (default: 3)
Stale reviewsWARNINGAny reviewed PR where lastReviewedSha != headSha
PRs in reviewing stateCRITICALOnly 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%WARNINGOne phase accounts for >50% of all errors
High review churnWARNINGAny PR with >5 review records
Zero reviewsINFOService 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.

Step 5: Time-Based Metrics

From state file, compute:

  • Most recent review: find the latest lastReviewedAt across all PRs, show age
  • Oldest active PR: find the earliest firstSeenAt among non-terminal PRs
  • Last error: find the most recent lastError.occurredAt, show age

Step 6: Health Verdict

Based on anomaly detection, output a single-line verdict:

  • HEALTHY — no anomalies detected
  • DEGRADED — only WARNING-level anomalies
  • UNHEALTHY — any CRITICAL-level anomaly

Format: Health: HEALTHY | DEGRADED (N warnings) | UNHEALTHY (N critical, M warnings)

Notes

  • If neither the metrics endpoint nor state file is available, report that and stop
  • Percentages should be rounded to 1 decimal place
  • Show "N/​A" for metrics that can't be computed from the available data source
  • Keep the dashboard compact — this is meant for a quick operational check

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View