debug

A troubleshooting procedure for failed or abnormal machine-learning experiments, such as runs that stop, run out of memory, produce invalid numbers, or become unusually slow.

In plain words
What is it for?
Use it to inspect running processes, system messages, GPU status, logs, and saved checkpoints, then test a suspected cause with a small check.
Why use it?
It gathers system and run evidence before suggesting a cause, reducing the risk of applying a fix based only on guesswork.

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/fcakyon/phd-skills/debug
Any agent
npx skills add fcakyon/phd-skills --skill debug
Clone the repo
git clone --depth 1 https://github.com/fcakyon/phd-skills

Made for: Claude Code, Codex.

Per session 97 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,281 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.00097 $0.01281
Opus 5 $0.00048 $0.00641
Sonnet 5 $0.00019 $0.00256
Haiku 4.5 $0.00010 $0.00128

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

Security

Grade A, and why

debug 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 2d 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.

plugin/skills/debug/SKILL.md · 126 lines

How it starts

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

Debug: evidence-before-action investigation

The most expensive class of mistake in ML debugging is asserting a cause based on plausibility, then attempting a "fix" that masks the real problem. This skill enforces the discipline of probe → hypothesis → smoke → controls → claim, in that order.

The agentic Stop hook routes here from reason when an assistant claims a cause without backing tool output.

When to run

The user just said any of:

  • "why is X failing / diverging / NaN / OOM / hung / slow / crashed"
  • "the loss is going up", "metrics look weird", "GPU util is 0"
  • "debug this", "diagnose", "troubleshoot", "investigate this run"
  • pasted a log excerpt asking what's wrong

Five-step protocol

Step 1: cheap probes

Before forming any hypothesis, gather the cheap evidence. None of these cost more than a few seconds:

Process state:

ps aux | grep -E '(python|train|torchrun|accelerate)' | grep -v grep

Is the process still running? Zombie? Defunct? Multiple instances?

Kernel / system events:

dmesg | tail -100 # OOM kills, hardware errors, NFS errors
journalctl -xe --since "1 hour ago" | tail -50

GPU state:

nvidia-smi
nvidia-smi --query-gpu=utilization.gpu,memory.used,temperature.gpu --format=csv

Is the GPU even being used? Idle GPU during "training" means the process is blocked on data loading or has died.

Disk / filesystem:

df -h /path/to/run-dir
du -sh /path/to/run-dir/*

Out of disk? Checkpoints not being written?

Log scrollback: Read the last few hundred lines of the training log. Don't trust the user's summary, they may have skimmed. Look for:

  • exception tracebacks
  • repeated "loss=NaN" or "grad_norm=Inf"
  • early-stop announcements (the run may have completed normally)
  • the last successful epoch / step (where did progress stop)

Checkpoint state:

ls -la /path/to/run-dir/checkpoints/

When was the last checkpoint written? What does its size suggest? An empty .pt is different from a 2GB one cut short.

Read the full file on GitHub · 126 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. 2d ago First seen · 126 lines · 97 tokens per session scan A 4577b9681f1c

Subscribe to this mod's changes

debug is a skill published in the GitHub repository fcakyon/phd-skills (380 stars, last pushed 2mo ago), licensed MIT. It adds 97 tokens to every session and 1,281 once invoked, about $0.0005 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.