# Julia Comonicon

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

- **Type:** Skill
- **Install:** `agentstack add skill-krastanov-juliallmagentskills-julia-comonicon`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [Krastanov](https://agentstack.voostack.com/s/krastanov)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** Unlicense
- **Upstream author:** [Krastanov](https://github.com/Krastanov)
- **Source:** https://github.com/Krastanov/JuliaLLMAgentSkills/tree/master/julia-comonicon

## Install

```sh
agentstack add skill-krastanov-juliallmagentskills-julia-comonicon
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Julia Comonicon

Use Comonicon to turn Julia functions/modules into CLI commands.

## Quick Start: Single Command Script

Use `@main` on a function for one-command CLIs:

```julia
using Comonicon

"""
Example CLI.

# Arguments
- `input`: input value.

# Options
- `-o, --output `: 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:

```bash
julia myscript.jl -h
```

If creating an executable script, add a Julia shebang and `chmod +x`.

## Build a Multi-Command CLI Package

Use `@cast` to register leaf commands and modules, then `@main` for the entry:

```julia
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.

## Use the Built-In Entry/Install Functions

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:

```julia
using Demo
Demo.comonicon_install()
```

## Follow Comonicon Naming and Help Conventions

- Map positional arguments to CLI arguments.
- Map keyword arguments to options/flags.
- Use `Bool=false` kwargs for flags.
- Expect `_` in kwarg names to become `-` in CLI long options.
- Use docstring sections `# Arguments`, `# Options`, and `# Flags` for rich help.
- Remember `-h/--help` and `--version` are always generated.

For exact syntax patterns, open `references/conventions.md`.

## Configure Build and Advanced Behavior

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`.

## Related Skills

- `julia-package-dev` - creating Julia packages and managing package or Pkg-app workflows
- `julia-tests` - running package tests while developing CLI code

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [Krastanov](https://github.com/Krastanov)
- **Source:** [Krastanov/JuliaLLMAgentSkills](https://github.com/Krastanov/JuliaLLMAgentSkills)
- **License:** Unlicense

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-krastanov-juliallmagentskills-julia-comonicon
- Seller: https://agentstack.voostack.com/s/krastanov
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
