/aa-jl:debugging-juliafrom aa-jl
Captures and reads Julia stack traces, locates failing methods with @which/@code_warntype/@code_typed, finds runtime errors with JET.jl, and narrows to minimal reproductions.
Ships in aa-jl. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Start with reproducible command-line steps that work in a non-interactive session. If an interactive Julia terminal is available and the failure benefits from stepping through code, an interactive debugger can complement these steps; do not assume one is available to the agent.
Pin the exact invocation so the failure is repeatable and independent of the user's shell setup:
julia --startup-file=no --project script.jl args...
Skip --startup-file=no only when the failure depends on the user's startup
file. Shrink args... and any input files until you have the smallest input
that still fails — a minimal reproduction makes every later step cheaper and the
final fix verifiable.
Julia prints a stack trace on an uncaught exception, but if your code swallows
it, log it explicitly instead of letting catch discard the backtrace:
try
main()
catch e
@error "uncaught" exception = (e, catch_backtrace())
rethrow()
end
To print it directly, use Base.showerror with the captured backtrace:
catch e
bt = catch_backtrace()
showerror(stderr, e, bt)
println(stderr)
end
When frames you expect are missing, they were likely inlined: rerun with
julia --debug-info=2, and add Base.@noinline to the suspect function to keep
its frame visible. Read the trace top-down, but the bug is usually at the first
frame that belongs to your code, not in the deepest Base/stdlib frame.
When explaining the trace to a user, summarize the error and the first relevant frame instead of dumping the full trace. If the user is coming from Python, note that Julia puts the exception at the top and the first user frame is the best place to look, whereas Python tracebacks put the error at the bottom.
InteractiveUtils ships with Julia, so these need no dependency:
@which f(args...) # which method the call resolves to; a MethodError means none matched
f # methods(f) list, or @methods f
@code_warntype f(args) # inferred types, with unstable ones flagged
@code_typed f(args) # the type-inferred IR (what Cthulhu shows interactively)
@code_lowered f(args) # lowered code, no inference
For a MethodError, the message lists the argument types and the "closest
candidates". Compare the actual argument types against the method signatures to
see which dispatch failed — often a concrete type narrowed somewhere upstream.
@code_typed / @code_warntype are the non-interactive substitute for
descending in Cthulhu: they print the inferred types and the dispatch decisions
to stdout so you can see exactly where inference falls back to Any.
JET reuses the compiler's inference to report calls that may throw before you
hit them, which is useful for MethodError-style bugs that depend on input
types you have not tried yet:
using JET
@report_call target_function(1, 2.0)
Pass representative values; JET infers from their types. report_package(MyPkg)
covers a whole package. JET analyzes by loading the target code, so it runs
top-level statements and __init__ — only analyze code you trust. For JET's
version support and the temporary-environment install workaround, see
[[profiling-julia-performance]], which also covers performance (as opposed to
correctness) analysis.
When the trace points at a region but not the exact line, add cheap instrumentation and rerun:
@debug "msg" x y plus JULIA_DEBUG=MyPkg to enable it, so noise stays off by
default.@assert cond "message" to fail fast at the point where a wrong value first
appears.julia --check-bounds=yes to turn out-of-bounds accesses into errors
instead of undefined behavior.isfinite(x) / isnan(x) at loop
boundaries.Remove the instrumentation once the cause is found; do not leave debug prints or assertions in committed code unless they are genuine invariants.
git bisect between a known-good and known-bad
commit finds the introducing change. Each step checks out and runs historical
code, so only bisect commits you trust.catch; end or catch e; @warn e
loses the stack; always attach catch_backtrace().--debug-info=2 and Base.@noinline.julia --project -e 'using Pkg; Pkg.precompile()') or invalidate it
after edits.Debugger/Infiltrator/Cthulhu
wait for a human and will hang a non-interactive run.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub atelierarith/atelier-arith-julia-development-skills --plugin aa-jl14 skills in this plugin
/auditing-julia-package-practicesUse when you review an existing or in-progress Julia package against this repository's development practices and want prioritized, evidence-based findings and concrete remediation suggestions/creating-julia-appUse when you create a CLI written in Julia packages or MCP servers/developing-julia-packageUse when you implement or edit code inside an existing Julia package: module/`include` layout, multiple dispatch, type annotations and stability, formatting, and docstrings/developing-julia-rust-bindingsUse when implementing or debugging Julia bindings to a Rust library with RustCall.jl or a native ABI. Covers memory ownership, Julia dispatch, reproducible builds, and isolating upstream failures with executable reproductions./documenting-julia-packageUse when you add, build, or publish documentation for a Julia package with Documenter.jl: the `docs/` layout, `docs/Project.toml`, `makedocs`/`deploydocs`, `@docs` and docstring blocks, doctests, and GitHub Pages deployment/finding-latest-julia-versionUse when you need the latest stable JuliaLang version number (e.g., to fill `VERSION=` in an install script) instead of hard-coding a value