julia-comonicon/SKILL.md
Build Julia command-line interfaces with Comonicon.jl using @main, @cast, docstring-driven help text, options/flags parsing, command trees, and package install/build workflows. Use this skill when creating or refactoring Julia CLI scripts/packages, adding subcommands, configuring Comonicon.toml, or troubleshooting Comonicon CLI behavior.
npx skillsauth add krastanov/juliallmagentskills julia-comoniconInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use Comonicon to turn Julia functions/modules into CLI commands.
Use @main on a function for one-command CLIs:
using Comonicon
"""
Example CLI.
# Arguments
- `input`: input value.
# Options
- `-o, --output <path>`: output path.
# Flags
- `-f, --force`: overwrite existing files.
"""
@main function mycmd(input; output="out.txt", force::Bool=false)
println("input=", input, " output=", output, " force=", force)
end
Run with:
julia myscript.jl -h
If creating an executable script, add a Julia shebang and chmod +x.
Use @cast to register leaf commands and modules, then @main for the entry:
module Demo
using Comonicon
@cast greet(name; loud::Bool=false) = loud ? println(uppercase(name)) : println(name)
@cast version() = println("Demo CLI")
module Admin
using Comonicon
@cast prune(days::Int=30) = println("pruning older than ", days, " days")
end
@cast Admin
@main
end # module
Prefer package-style CLIs for serious use. This gives install/build workflows and better startup optimization options.
After @main, Comonicon generates module helpers, including:
command_main for CLI entry.comonicon_install and comonicon_install_path for install flows.julia_main for standalone application builds.CASTED_COMMANDS registry for generated command AST/metadata.Use a deps/build.jl install entry like:
using Demo
Demo.comonicon_install()
Bool=false kwargs for flags._ in kwarg names to become - in CLI long options.# Arguments, # Options, and # Flags for rich help.-h/--help and --version are always generated.For exact syntax patterns, open references/conventions.md.
Use Comonicon.toml (or JuliaComonicon.toml) in project root for behavior like plugin enablement and system-image/application builds.
For concrete templates and installation/build flow, open references/project-workflow.md.
julia-package-dev - creating Julia packages and managing package or Pkg-app workflowsjulia-tests - running package tests while developing CLI codedevelopment
Fix trailing whitespace and ensure files end with newlines. Use this skill when preparing code for commit or when whitespace issues are detected.
development
Parse and write YAML in Julia with YAML.jl, including load/load_file/load_all APIs, dictionary type customization, anchors/aliases behavior, and write/write_file emission. Use this skill when reading YAML configs, converting YAML to Julia structures, or generating YAML outputs from Julia data.
development
Parse and write TOML in Julia using the TOML standard library (TOML.jl), including parse/tryparse APIs, ParserError handling, Parser reuse, and TOML.print serialization options. Use this skill when reading or generating TOML config files such as Project.toml, Manifest snippets, or other TOML-based settings.
development
Implement and debug Julia multithreading with Threads.@threads, Threads.@spawn, threadpools, locks, atomics, and race-avoidance patterns. Use this skill when parallelizing CPU work, configuring Julia thread counts, fixing data races, or handling thread-specific caveats such as task migration.