battle-tested-patterns: Skill for Claude Code

.claude/skills/diagnose/SKILL.md

diagnose is a skill for Claude Code from Totoro-jam/battle-tested-patterns. It costs 25 tokens per session (319 once invoked), scanned A, original, MIT.

A structured debugging workflow for test failures and build errors in a software project.

In plain words
What is it for?
Reproducing an error, identifying the smallest failing test or build step, testing a hypothesis, applying a focused fix, running the full checks, and adding a regression test when needed.
Why use it?
It requires reproducing and isolating the failure before changing code, which reduces guesses and helps prevent regressions.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

This is Totoro-jam/battle-tested-patterns's own configuration. It tells Claude Code how to work on battle-tested-patterns itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything battle-tested-patterns configures →

Reuse

Borrowing it

Nothing to install: this file belongs to Totoro-jam/battle-tested-patterns. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/Totoro-jam/battle-tested-patterns/main/.claude/skills/diagnose/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/Totoro-jam/battle-tested-patterns

Made for: Claude Code.

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/totoro-jam/battle-tested-patterns/diagnose/github.svg)](https://agentmods.dev/skills/totoro-jam/battle-tested-patterns/diagnose)
Your own site
<a href="https://agentmods.dev/skills/totoro-jam/battle-tested-patterns/diagnose"><img src="https://agentmods.dev/badge/skills/totoro-jam/battle-tested-patterns/diagnose/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for diagnose

Your own site · 80×15
<a href="https://agentmods.dev/skills/totoro-jam/battle-tested-patterns/diagnose"><img src="https://agentmods.dev/badge/skills/totoro-jam/battle-tested-patterns/diagnose.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 25 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 319 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00025 $0.00319
Opus 5 $0.00013 $0.00160
Sonnet 5 $0.00005 $0.00064
Haiku 4.5 $0.00003 $0.00032

Measured 10d ago against content hash 65261c909bb9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, 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 10d 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.

.claude/skills/diagnose/SKILL.md · 54 lines

What it actually says

Diagnose a Failure

You are debugging a test failure or build error in this project. Follow the structured loop — do NOT jump to a fix without reproducing first.

Loop

1. Reproduce

Run the failing command and capture the exact error:

pnpm test          # All tests (docs + exercises in TS/Rust/Go/Python)
pnpm test:rust     # Rust only
pnpm test:go       # Go only
pnpm test:python   # Python only (auto-finds Python ≥ 3.10)
pnpm build         # VitePress

2. Isolate

Narrow down to the smallest failing unit:

  • Which test file?
  • Which test case?
  • Which assertion?

3. Hypothesize

State your hypothesis in one sentence before changing any code.

4. Instrument

Add minimal logging or assertions to confirm/deny your hypothesis. Do NOT change production code yet.

5. Fix

Apply the minimal fix. Change as little as possible.

6. Verify

Run the full test suite, not just the failing test:

pnpm test && pnpm build

If it still fails, return to step 1 with what you learned.

7. Regression Test

If the bug was non-trivial, add a test that would have caught it.

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. 10d ago First seen · 54 lines · 25 tokens per session scan A 65261c909bb9

Subscribe to this mod's changes

diagnose is a skill published in the GitHub repository Totoro-jam/battle-tested-patterns (341 stars, last pushed 5d ago), licensed MIT. It adds 25 tokens to every session and 319 once invoked, about $0.0001 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-30.

Related

Other skills, from other repositories

pinchtab-dev

Develop and contribute to the PinchTab project. Use when working on PinchTab source code, adding features, fixing bugs, running tests, or preparing PRs. Triggers on "work on pinchtab", "pinchtab development", "contribute to pinchtab", "fix pinchtab bug", "add pinchtab feature".

pinchtab/pinchtab · 77 tokens

debugging-failures

Diagnose a failing Ginkgo suite as an agent — always run with --json-report into a predictable temp/gitignored location, read the terminal verdict line, then use jq to extract structured failure details (name, message, file:line, panic value, captured logs). Covers the panicked-vs-failed trap, panic locations pointing…

onsi/ginkgo · 122 tokens

verify-bug

Post-merge UAT verification workflow. Walks JIRA reproduce steps, performs comparative audits (Before/After), attaches evidence to JIRA, and transitions status on PASS.

HoangNguyen0403/agent-skills-standard · 39 tokens

quality-engineering-test-healing

Failure taxonomy and allowed/forbidden repairs for a failing E2E test. Use when a Playwright/Maestro/Detox/XCUITest/Espresso/Appium test fails and you must decide whether to repair the test or route to a real bug.

HoangNguyen0403/agent-skills-standard · 60 tokens

config-loader-helper

Diagnose configuration-related failures, enumerate required env vars, and guide safe local test setup (no secrets).

pilinux/gorest · 25 tokens

fix-suggester

Diagnose failures and propose minimal, test-backed fixes with verification and rollback instructions.

pilinux/gorest · 21 tokens