agentleFS
90184479018447/julia-pro-p/skills/playbook-debug/SKILL.md

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.

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
  1. Very specific:

    Add the reproduction as a @testset, plus the invariant that would have caught it (non-finite check, residual bound, retcode assertion).

    line 46

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

ClassFirst probe
NaN or Inffind the first index that becomes non-finite: findfirst(!isfinite, u), then bisect the step
solver divergencesol.retcode, sol.stats, maxiters, retry with Rodas5/KenCarp4
type instability@code_warntype, then JET.report_opt
dispatch ambiguityTest.detect_ambiguities(MyPkg), @which f(x)
shape or axis mismatchsize, axes, eachindex on every operand at the failure point
AD gradient wrongcompare against FiniteDifferences.central_fdm(5, 1); check for mutation under Zygote
MCMC divergencesummarize(chain), check rhat, reparameterize non-centered
irreproducible resultseed the RNG explicitly, check Dict/Set iteration order, check thread scheduling
GPU failurecheck 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.

TopicThe step that needs itWhat it settles
debugging-toolkit2 Minimal reproductionthe first wrong value, before any hypothesis is ranked
differential-equations1 Triage the classa stiff system returning wrong numbers while the solver reports success
bayesian-inference1 Triage the classdivergences and low ESS read as sampler failures, not model failures
differentiation3 Hypotheses, rankeda NaN in the gradient narrows to one backend and one direction
julia-language3 Hypotheses, rankedtype instability and world age explain failures that survive a rewrite
numerical-methods-implementation3 Hypotheses, rankeda stability or CFL violation reads as a wrong discretisation

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.