agentleFS
90184479018447/julia-pro-p/skills/creating-julia-app/SKILL.md

creating-julia-app

Skill0 starsChanged 3 days agoMITView on GitHub

Create a Julia command-line application or MCP server with `@main`, `[apps]`, and `Pkg.Apps`. Use when packaging an executable Julia program.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    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:

    Keep @main thin: parse arguments, call a library function, return a code.

    line 49
  2. Distinctive:

    Start-up latency matters for CLIs.

    line 50

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

Creating a Julia App

An app is a Julia package run as a standalone program (mytool args...) rather than loaded as a library. It is a normal package plus:

  • a @main entry point in the package module,
  • an [apps] table in Project.toml naming the executables.

Requires Julia 1.12+. Pkg app support is experimental; expect changes.

# src/MyReverseApp.jl
module MyReverseApp

function (@main)(ARGS)
    for arg in ARGS
        print(stdout, reverse(arg), " ")
    end
    return 0
end

end # module
# Project.toml (standard package fields above)
[apps]
reverse = {}

The empty table {} holds optional metadata. One package can define several apps, point one at a submodule, and set per-app Julia flags:

[apps]
main-app = {}
cli-app = { submodule = "CLI" }
fast-app = { julia_flags = ["--threads=auto", "--optimize=2"] }

Entry-point conventions

  • Return an Integer exit code from @main (0 success, non-zero failure); a return of nothing exits 0.
  • Print results to stdout, diagnostics and errors to stderr.
  • Validate ARGS up front and print usage on bad input. Use ArgParse.jl or Comonicon.jl for non-trivial option parsing rather than hand-rolled loops.
  • Keep @main thin: parse arguments, call a library function, return a code. Test the library function with testing-julia-package, not the process.
  • Start-up latency matters for CLIs; see precompiling-julia-package. For a fully standalone binary, see compiler-patterns (PackageCompiler.jl).

Installing and running

pkg> app add MyReverseApp
pkg> app add https://github.com/example/MyReverseApp.jl
pkg> app develop path/to/MyReverseApp   # local path must be a git repository

develop runs live from a local checkout so edits take effect immediately. Installation creates a shim in ~/.julia/bin, which you must add to PATH. Then:

reverse some input string

Manage with pkg> app status, app update [name], app rm name. An app uses the Julia executable that installed it; override with JULIA_APPS_JULIA_CMD.

Security: installing an app installs third-party code that runs when invoked. Prefer a registry entry or an immutable tag/commit SHA over a mutable branch, and review source you did not write.

MCP servers

A Julia MCP server is an app speaking JSON-RPC over stdio: requests on stdin, responses on stdout. Use the same @main/[apps] structure so it installs and launches by name. Keep stdout reserved for protocol messages; send all logs to stderr, since a stray println corrupts the stream. See the Model Context Protocol spec for the wire format.

References: Apps, Multiple Apps per Package.


Adapted from AtelierArith/atelier-arith-julia-development-skills (MIT). See THIRD_PARTY_NOTICES.md.

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.