playbook-debug
Skill0 starsChanged 3 days agoMITView on GitHub
Debug a wrong number, NaN, divergence, or type error in Julia code. Use for a Julia failure that needs triage, a minimal reproduction, a root-cause fix, and a regression test.
In this repository55 other files it gives its agents.
- advanced-optimizationSkill
- bayesian-inferenceSkill
- bayesian-pinnSkill
- bayesian-ude-workflowSkill
- catalyst-reactionsSkill
- continuum-mechanics-and-rheologySkill
- control-theorySkill
- creating-julia-appSkill
- debugging-toolkitSkill
- differential-equationsSkill
- differentiationSkill
- equation-discoverySkill
- experiment-trackingSkill
- fem-feaSkill
- julia-graph-neural-networksSkill
- julia-languageSkill
- julia-ml-and-dlSkill
- julia-model-deploymentSkill
- julia-paper-implementationSkill
- julia-pro-helpSkill
- julia-pro-modeSkill
- julia-reinforcement-learningSkill
- modeling-toolkitSkill
- neural-pdeSkill
- nonlinear-dynamicsSkill
- numerical-methods-implementationSkill
- package-development-workflowSkill
- performance-tuningSkill
- physical-learning-systemsSkill
- playbook-model-validateSkill
- playbook-package-releaseSkill
- playbook-paper-implementSkill
- playbook-perfSkill
- playbook-test-specSkill
- principle-both-sidesSkill
- principle-breakingSkill
- principle-file-is-truthSkill
- principle-gateSkill
- principle-limitsSkill
- principle-loud-failureSkill
- principle-one-stepSkill
- principle-proof-listSkill
- principle-rebuttalSkill
- principle-runtime-surfaceSkill
- principle-three-boundsSkill
- principle-three-clocksSkill
- scientific-visualizationSkill
- sciml-and-diffeqSkill
- setup-julia-proSkill
- signal-processingSkill
- simulation-and-hpcSkill
- statistical-physicsSkill
- symbolic-mathSkill
- web-development-juliaSkill
- zarr-cloud-arraysSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 46
Add the reproduction as a @testset, plus the invariant that would have caught it (non-finite check, residual bound, retcode assertion).
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
A number went wrong
Numerical failures arrive as plausible numbers more often than as exceptions. Triage by class first; the class decides the probe.
1. Triage the class
| Class | First probe |
| NaN or Inf | find the first index that becomes non-finite: findfirst(!isfinite, u), then bisect the step |
| solver divergence | sol.retcode, sol.stats, maxiters, retry with Rodas5/KenCarp4 |
| type instability | @code_warntype, then JET.report_opt |
| dispatch ambiguity | Test.detect_ambiguities(MyPkg), @which f(x) |
| shape or axis mismatch | size, axes, eachindex on every operand at the failure point |
| AD gradient wrong | compare against FiniteDifferences.central_fdm(5, 1); check for mutation under Zygote |
| MCMC divergence | summarize(chain), check rhat, reparameterize non-centered |
| irreproducible result | seed the RNG explicitly, check Dict/Set iteration order, check thread scheduling |
| GPU failure | check for scalar indexing, @allowscalar, host round-trips in the loop |
Done when: the class is named and the probe that shows it is recorded.
2. Minimal reproduction
Shrink to one function, one input, one call. A 40-line reproduction that fails is worth more than a 4000-line script that fails sometimes. Save it as a test file; it becomes the regression guard.
Done when: the reproduction fails on the current code and is under ~50 lines.
3. Hypotheses, ranked
Three to five, each with a probability and a falsification test. Test the cheapest first. Record what each test showed, including the ones that cleared.
Done when: one hypothesis survives every test you can run.
4. Fix at the cause
The fix lands where the class originates, not where the NaN appears. A NaN at step 900 usually starts at a boundary condition at step 0. A loud failure at the source (principle-loud-failure) replaces a downstream guard.
Done when: the minimal reproduction passes and the class's probe no longer fires.
5. Guard it
Add the reproduction as a @testset, plus the invariant that would have caught it (non-finite check, residual bound, retcode assertion).
Done when: Pkg.test() covers the path, and the proof list records the run (principle-proof-list).
Topics this playbook opens
Load one at the step named. The table exists so you do not read all of them up front.
| Topic | The step that needs it | What it settles |
| debugging-toolkit | 2 Minimal reproduction | the first wrong value, before any hypothesis is ranked |
| differential-equations | 1 Triage the class | a stiff system returning wrong numbers while the solver reports success |
| bayesian-inference | 1 Triage the class | divergences and low ESS read as sampler failures, not model failures |
| differentiation | 3 Hypotheses, ranked | a NaN in the gradient narrows to one backend and one direction |
| julia-language | 3 Hypotheses, ranked | type instability and world age explain failures that survive a rewrite |
| numerical-methods-implementation | 3 Hypotheses, ranked | a stability or CFL violation reads as a wrong discretisation |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

