| name | compile |
| description | Compile a single SOP or flowchart in the current project to PDF. For SOPs, runs `typst compile`. For flowcharts, first renders the Mermaid/D2 source to SVG (via mmdc or d2), then compiles the Typst wrapper that embeds it. Outputs to the project's `output/` directory by default. Use when the user wants to produce or refresh a single printable PDF. |
compile
Render a single document to PDF. Project-scoped — operates on files in the current working directory.
Inputs to gather
- Source path — the
.typ, .mmd, or .d2 file to compile. Accept absolute or project-relative.
- Output path (optional) — defaults to
output/<source-stem>.pdf in the project root, creating output/ if missing.
What to do
If the source is a .typ file
- Detect any sibling
.mmd or .d2 files referenced by #image(...) in the Typst source. For each, render to SVG first (see flowchart steps below).
- Run:
typst compile <source.typ> <output.pdf>
- Report the output path and file size.
If the source is a .mmd file (Mermaid)
mmdc -i <source.mmd> -o <source-stem>.svg
Then compile the sibling .typ wrapper if one exists, or just leave the SVG.
If the source is a .d2 file
d2 <source.d2> <source-stem>.svg
Same follow-up as Mermaid.
Pre-flight checks
command -v typst — if missing, tell the user to install it (cargo install typst-cli or distro package).
command -v mmdc — only required if any Mermaid sources exist; install via npm i -g @mermaid-js/mermaid-cli.
command -v d2 — only required if any D2 sources exist.
Notes
- Don't auto-rebuild every doc in the project — this skill compiles one file. For batch-compiling everything in a project, the user can loop in shell or use
bundle-binder (which compiles its inputs as a side effect).
- If
typst compile fails, surface the error verbatim — Typst's error messages are good and the user needs to see them.