diagnose

diagnose is a skill for Claude Code from cukas/patrol. It costs 39 tokens per session (729 once invoked), scanned A, original, MIT.

A structured process for finding the root cause of a bug or other unexpected behavior. It compares expected and actual results, traces the relevant code, tests a possible explanation, and presents the findings before changes are made.

In plain words
What is it for?
Use it when investigating bugs, failures, or surprising application behavior that requires tracing code and verifying a suspected cause.
Why use it?
It reduces guesswork and discourages edits made before the problem is understood. This helps avoid fixes that only hide the symptom or create new issues.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the patrol plugin — 4 skills, 7 commands, 3 hooks shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/cukas/patrol/diagnose
Any agent
npx skills add cukas/patrol --skill diagnose
Clone the repo
git clone --depth 1 https://github.com/cukas/patrol

Made for: Claude Code.

Or install patrol, the plugin that ships this one along with the rest of its 4 skills, 7 commands, 3 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for diagnose

README.md
[![agentmods](https://agentmods.dev/badge/skills/cukas/patrol/diagnose.svg)](https://agentmods.dev/skills/cukas/patrol/diagnose)
Your own site
<a href="https://agentmods.dev/skills/cukas/patrol/diagnose"><img src="https://agentmods.dev/badge/skills/cukas/patrol/diagnose.svg" alt="Measured on agentmods" height="20"></a>
Per session 39 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 729 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00039 $0.00729
Opus 5 $0.00019 $0.00365
Sonnet 5 $0.00008 $0.00146
Haiku 4.5 $0.00004 $0.00073

Measured 6d ago against content hash 2367bf3ea849, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

diagnose scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/diagnose/SKILL.md · 67 lines

How it starts

The opening of the file, as written. The whole thing — 67 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Structured Root-Cause Investigation

You are in investigation mode. Do NOT edit any code until you complete the protocol below.

Protocol

Step 1: Understand the symptom

  • What exactly is the user reporting?
  • What is the expected behavior vs actual behavior?
  • Can you reproduce it? Under what conditions?

Step 2: Trace the code path

  • Read all files in the call chain from entry point to where the bug manifests
  • For each file, note: what it does, what it passes to the next layer, where it could go wrong
  • Do NOT skip files — read every file in the path

Step 3: Form a hypothesis

  • Based on the code you've read, what is the most likely root cause?
  • What evidence supports this hypothesis?
  • What would disprove it?
  • Rate your confidence: LOW / MEDIUM / HIGH

Step 4: Verify the hypothesis

  • If confidence is LOW: read more files, check related tests, grep for similar patterns
  • If confidence is MEDIUM: check edge cases and error handling in the suspected area
  • If confidence is HIGH: proceed to Step 5

Step 5: Present analysis

Before writing ANY code, present to the user:

  1. Root cause: One sentence explaining what's broken and why
  2. Evidence: Which files/lines confirmed this
  3. Proposed fix: What you'll change and why
  4. Risk: What else could this fix affect?

Step 6: Implement and verify

  • Apply the minimal fix
  • Run build and tests
  • Confirm the fix addresses the symptom

Example Investigation

Symptom: "The sidebar counter shows 0 items even after adding tasks."

Step 1 — Understand: Expected: counter increments when a task is added. Actual: always shows 0. Reproducible on every add.

Step 2 — Trace: Read TaskList.tsx (renders counter) → useTaskStore.ts (Zustand store) → addTask() action → Sidebar.tsx (subscribes to tasks.length).

Step 3 — Hypothesis: Sidebar.tsx subscribes to store.tasks but addTask() mutates the array in place instead of creating a new reference. Zustand's shallow comparison doesn't detect the change. Confidence: HIGH — the push() call on line 42 of useTaskStore.ts is the smoking gun.

Read the full file on GitHub · 67 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 67 lines · 39 tokens per session scan A 2367bf3ea849

Subscribe to this mod's changes

diagnose is a skill published in the GitHub repository cukas/patrol (3 stars, last pushed 5mo ago), licensed MIT. It adds 39 tokens to every session and 729 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

slopmop

Trigger when you would normally reach for pytest, gh, mypy, black, or other raw repo tooling. Redirect to sm swab, sm scour, sm buff, sm sail, sm refit, or sm doctor so remediation follows the established rails. Also trigger when asked to "install" or "set up" slop-mop in a repo, or when you find a repo with sm…

ScienceIsNeato/slop-mop · 186 tokens

ai-development-guide

Applies language-agnostic and backend technical decision criteria, anti-pattern detection, debugging, and quality gates. Use when reviewing general/backend implementation choices, code smells, failures, or implementation completeness.

shinpr/claude-code-workflows · 43 tokens

recipe-diagnose

Investigate problem, verify findings, and derive solutions.

shinpr/claude-code-workflows · 15 tokens

health-check

Runs plugin health checks (venv packages, skill registration, and album slug collisions). Use when the user asks to check plugin health, verify setup, or troubleshoot missing skills.

bitwize-music-studio/claude-ai-music-skills · 38 tokens

cloudflare-workers-observability

Cloudflare Workers observability with logging, Analytics Engine, Tail Workers, metrics, and alerting. Use for monitoring, debugging, tracing, or encountering log parsing, metric aggregation, alert configuration errors.

secondsky/claude-skills · 47 tokens

cloudflare-workers-dev-experience

Cloudflare Workers local development with Wrangler, Miniflare, hot reload, debugging. Use for project setup, wrangler.jsonc configuration, or encountering local dev, HMR, binding simulation errors.

secondsky/claude-skills · 47 tokens