ad-diagnose

A structured method for investigating difficult bugs and slowdowns by reproducing the problem, testing ranked explanations, measuring behavior, and adding a regression test.

In plain words
What is it for?
Use it for hard-to-reproduce bugs, performance regressions, and cases where several causes are plausible.
Why use it?
It replaces guesswork with evidence and helps ensure that a fix addresses the real cause without allowing the problem to return.

Skill for Claude CodeCodex

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/corridortech/posecap/ad-diagnose
Any agent
npx skills add CorridorTech/PoseCap --skill ad-diagnose
Clone the repo
git clone --depth 1 https://github.com/CorridorTech/PoseCap

Made for: Claude Code, Codex.

Per session 165 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,440 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 $0.00165 $0.02440
Opus 5 $0.00082 $0.01220
Sonnet 5 $0.00033 $0.00488
Haiku 4.5 $0.00016 $0.00244

Measured 3d ago against content hash ac40f0cd79dc, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

ad-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 3d 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.

.agents/skills/ad-diagnose/SKILL.md · 133 lines

How it starts

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

<background_information> Implements WORKFLOW.md §15 per ADR-0021 (doc/adr/0021-diagnose-discipline.md). Disciplined diagnosis for hard bugs and performance regressions. Process scaffold; the output is the verified fix + regression test landing through normal commits.

The shape is grounded in Kernighan & Pike, The Practice of Programming (1999, ch. 5–6) and Karl Popper's falsifiability framing. The Phase-1 framing ("the loop is the skill — everything else is mechanical") is borrowed from mattpocock/skills with attribution.

Codex auto-trigger on description keywords is less mature than Claude Code's. If auto-invocation does not fire when the user mentions diagnosing, debugging, a performance regression, or building a repro, invoke this skill manually. </background_information>

Route elsewhere when:

  • The bug is one-line obvious (typo, off-by-one) — fix it directly.
  • The bug is a clean ground-truth-pair regression (test was passing, output unchanged, now failing) → ad-tdg (WORKFLOW §9).
  • The technique itself is uncertain across multiple plausible approaches → ad-spike (WORKFLOW §14).
  • The spec or expected behavior is unclear → ad-grill-me.

Phase 1 — build a feedback loop. This is the skill. Everything else is mechanical. A fast, deterministic, agent-runnable pass/fail signal for the bug is what enables every later phase. Without a loop, no amount of staring at code finds the cause.

Spend disproportionate effort here. Be aggressive. Refuse to give up.

Loop construction (try in roughly this order):

  1. Failing test at the seam closest to the bug — unit, integration, or e2e.
  2. Curl / HTTP script against a running dev server.
  3. CLI invocation with a fixture input, diffing stdout against a known-good snapshot.
  4. Headless browser script (Playwright / Puppeteer) — drives the UI, asserts on DOM/console/network.
  5. Replay a captured trace — save a real network request / payload / event log, replay it through the code path in isolation.
  6. Throwaway harness — minimal subset of the system (one service, mocked deps) exercising the bug code path in a single function call.
  7. Property / fuzz loop — for "sometimes wrong output", run 1000 random inputs and look for the failure mode.
  8. Bisection harness — if the bug appeared between two known states, automate "boot at state X, check, repeat" so git bisect run can drive it.
  9. Differential loop — same input through old vs new (or two configs), diff outputs.
  10. HITL bash script — last resort. If a human must click, drive them with a structured loop so the signal still flows back.

Iterate on the loop itself. Once you have a loop:

  • Faster? Cache setup, skip unrelated init, narrow the test scope.
  • Sharper signal? Assert on the specific symptom, not "didn't crash".
  • More deterministic? Pin time, seed RNG, isolate filesystem, freeze network.

A 30-second flaky loop is barely better than no loop. A 2-second deterministic loop is a debugging superpower.

Non-deterministic bugs. Goal is not a clean repro but a higher reproduction rate. Loop the trigger 100×, parallelize, add stress, narrow timing windows, inject sleeps. A 50%-flake bug is debuggable; 1% is not — keep raising the rate.

When you genuinely cannot build a loop. Stop and say so explicitly. List what you tried. Ask the user for one of: (a) access to whatever environment reproduces it, (b) a captured artifact (HAR file, log dump, core dump, screen recording with timestamps), (c) permission to add temporary production instrumentation. Do not proceed to Phase 3 without a loop.

Read the full file on GitHub · 133 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 3d ago First seen · 133 lines · 165 tokens per session scan A ac40f0cd79dc

Subscribe to this mod's changes

ad-diagnose is a skill published in the GitHub repository CorridorTech/PoseCap (190 stars, last pushed 10d ago), licensed Apache-2.0. It adds 165 tokens to every session and 2,440 once invoked, about $0.0008 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

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

obra/superpowers · 37 tokens

auto-perf-optimize

Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.

microsoft/vscode · 62 tokens

chat-perf

Run chat perf benchmarks and memory leak checks against the local dev build or any published VS Code version. Use when investigating chat rendering regressions, validating perf-sensitive changes to chat UI, or checking for memory leaks in the chat response pipeline.

microsoft/vscode · 51 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens