Agent skill
diagram-render
Render PlantUML (@startuml…@enduml) and Mermaid fenced blocks to a self-contained HTML preview; if rendering fails, the error text must be embedded in the output image. Use when the user asks to render, preview, or export diagrams.
Install this agent skill to your Project
npx add-skill https://github.com/geggo98/dotfiles/tree/main/modules/ai/_files/skills/diagrams
SKILL.md
Diagram renderer (PlantUML + Mermaid)
This skill renders embedded PlantUML and Mermaid snippets to images and produces a self-contained HTML preview. It is safe-by-default: it does not write image files unless the user explicitly requests an output directory.
What counts as a “diagram block”
Extract diagrams from the provided inputs:
- PlantUML blocks:
@startuml ... @enduml - Markdown fenced blocks:
```plantuml/```puml/```uml```mermaid
How to run (always use the helper script)
The helper script lives at scripts/render_diagram.sh.
Important: Run the script directly (
./scripts/render_diagram.sh). Do not prefix withbash— the script requires zsh and will fail under bash.
If the user passes file/dir paths
Run:
scripts/render_diagram.sh $ARGUMENTS
If the user pasted diagram text instead of giving a path
Pipe the text to stdin and add --stdin (do not create a persistent file unless the user asks):
cat <<'EOF' | scripts/render_diagram.sh --stdin <other flags>- (paste the user’s text, containing @startuml..@enduml and/or fenced blocks)
EOF
Timeout
The wrapper script enforces a global timeout via gtimeout. Pass --timeout DURATION to override it (default: 5m). The duration format follows GNU coreutils (e.g. 30s, 5m, 1h).
scripts/render_diagram.sh docs/architecture.md --timeout 10m
Output rules
- Default: Produce an HTML preview with embedded images (no image files on disk).
- If the user wants images written, require an explicit
--out-dir <dir>and write there. - Always report the generated HTML path to the user (the script prints it to stdout).
- If any diagram fails, the preview must still include an image for it where the error text is rendered into the image.
- You can get structured JSON output with
--json(default: minimal, omitting source/bytes). Use--detail fullfor full output.
Selecting which diagrams to render
- To list extracted blocks and their IDs:
scripts/render_diagram.sh <paths...> --list
- To render a subset by ID:
scripts/render_diagram.sh <paths...> --only 2,5-7
Examples
- Render everything found in a Markdown doc:
scripts/render_diagram.sh docs/architecture.md
- Only Mermaid blocks from multiple files:
scripts/render_diagram.sh docs/*.md --select mermaid
- Only PlantUML
@startuml ... @endumlblocks:scripts/render_diagram.sh src/diagrams --blocks startuml
- Persist images for CI artifacts:
scripts/render_diagram.sh docs/architecture.md --out-dir out/diagrams
Tooling expectations
The helper script will try, in order:
- PlantUML:
plantumlexecutable; otherwisejava -jar <plantuml.jar>if available (viaPLANTUML_JAR). - Mermaid:
mmdc; otherwisenpx -y @mermaid-js/mermaid-cliifnpxexists.
If a tool is missing, still generate an error image explaining what is missing and how to fix it.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
eval-notebook
Execute .ipynb notebooks (Python, Kotlin, or any Jupyter kernel) without overwriting; return LLM-friendly JSON with outputs and errors. Use when you need to run or validate a Jupyter notebook.
nix-shell
Search Nix packages and run commands with packages from nixpkgs that are not installed locally. Use when you need a package not available locally or want to search nixpkgs.
tmux
Remote control tmux sessions for interactive CLIs (python, gdb, etc.) by sending keystrokes and scraping pane output.
slidev
Create and present web-based slidedecks for developers using Slidev with Markdown, Vue components, code highlighting, animations, and interactive features. Use when building technical presentations, conference talks, code walkthroughs, teaching materials, or developer decks. Also trigger when the user mentions Slidev, sli.dev, slide decks with code, or wants to create developer-facing presentations.
adr-writing
Use when documenting significant architectural decisions. Creates focused ADRs explaining context, decision, and alternatives. Prevents vague documentation and implementation detail bloat. Triggers: 'create ADR', 'document decision', making technology/framework/persistence/auth choices, cross-cutting concerns.
writing-clearly-and-concisely
Use when writing documentation, commit messages, error text, explanations, reports, or summaries. Applies Strunk's principles for clear, vigorous prose. Triggers: writing human-readable content, verbose text, unclear explanations.
Didn't find tool you were looking for?