Julia Vibe Coding Skill
Workflow for Julia × claude-code (julia-mcp): avoid TTFX, keep code in Literate.jl format.
How julia-mcp works
Keeps a julia -i process alive per project directory. Code is sent via stdin/stdout pipe.
Variables, loaded packages, and function definitions persist across julia_eval calls.
Available MCP tools:
julia_eval(code, env_path?, timeout?)— execute code (main tool)julia_restart(env_path?)— force session reset (last resort only)julia_list_sessions()— list active sessions
Rules (always follow)
1. Write to file first, then include
# ❌ Inline execution (except 1-liners)
julia_eval("result = some_complex_calculation()")
# ✅ Write to scripts/, then include
julia_eval('include("scripts/explore_topic.jl")', env_path="/abs/path/to/project")
Exception: single-line checks like julia_eval("versioninfo()") are OK inline.
2. Write all .jl files in Literate.jl format
See references/literate_format.md for full syntax. Key rules:
#prefix → Markdown text# # Title→ H1,# ## Section→ H2- No prefix → Julia code block
expr #hide→ executed but hidden in output
3. Always specify env_path explicitly
julia_eval(code, env_path="/abs/path/to/project")
Omitting env_path creates a throwaway session without the project environment.
4. Trust Revise.jl
julia-mcp auto-loads using Revise on startup.
After editing src/, do not call julia_restart — Revise handles it.
5. Never touch Pkg (humans only)
# ❌ Absolutely forbidden
julia_eval('import Pkg; Pkg.add("Plots")')
If a package is missing, stop and notify the human:
⚠️ Package not installed. Please run in Julia REPL:
] add SomePackage
Resume when done.
File layout
project/
├── Project.toml
├── Manifest.toml
├── src/ # package code (watched by Revise)
├── scripts/ # exploration scripts (Literate.jl format)
├── notebooks/ # Literate.jl output (.md)
└── test/
- Exploration code →
scripts/(Literate format) - Reusable logic →
src/ - Generated notes →
notebooks/
Typical workflow
- Create
scripts/explore_xxx.jlin Literate format julia_eval('include("scripts/explore_xxx.jl")', env_path=...)- Edit the file, re-include
- Extract stable logic to
src/ - Export note:
Literate.markdown("scripts/explore_xxx.jl", "notebooks/") - For PDF/HTML/Word: use Quarto flavor and render (see
references/quarto_workflow.md)Literate.markdown("scripts/explore_xxx.jl", "notebooks/"; flavor=Literate.QuartoFlavor())quarto render notebooks/explore_xxx.qmd --to typst-pdf
Common mistakes
| Situation | Wrong | Right |
|---|---|---|
| Want to try code | Inline julia_eval("...") | Write to scripts/, include |
| Got an error | Call julia_restart | Read the error, fix the code |
| Package missing | Pkg.add in julia_eval | Notify human with ] add PkgName |
Edited src/ | Call julia_restart | Let Revise handle it |
References
references/literate_format.md— Literate.jl syntax and examplesreferences/julia_mcp_setup.md— julia-mcp setup instructionsreferences/quarto_workflow.md— Literate.jl → Quarto → PDF/HTML/Word pipeline