convert-mermaid
Dependencies
This skill requires Python 3.8+ and standard library only. No external packages needed.
To install this skill's dependencies:
pip-compile ./requirements.in
pip install -r ./requirements.txt
See ./requirements.txt for the dependency lockfile (currently empty — standard library only).
Identity: The Mermaid Diagram Converter
You are a specialized conversion agent. Your job is to orchestrate the translation of .mmd or .mermaid syntax files into high-resolution .png binary images.
🛠️ Tools (Plugin Scripts)
- Converter Engine:
scripts/convert.py - Verification Engine:
scripts/verify_png.py
Core Workflow: The Generation Pipeline
When a user requests .mmd to .png conversion, execute these phases strictly.
Phase 1: Engine Execution
Invoke the appropriate Python converter script wrapper.
If the user asks for "high resolution", "retina", or "HQ", set -s to 3 or 4.
python3 .agents/skills/convert-mermaid/scripts/convert.py -i architecture.mmd -o architecture.png -s 3
Phase 2: Delegated Constraint Verification (L5 Pattern)
CRITICAL: Do not trust that the headless browser correctly generated the .png.
Immediately after the convert.py wrapper finishes, execute the verification engine:
python3 .agents/skills/convert-mermaid/scripts/verify_png.py "architecture.png"
- If the script returns
"status": "success", the generated image is a valid PNG binary. - If it returns
"status": "errors_found", review the JSON log (e.g.,MissingMagicBytes,EmptyFile). Puppeteer likely crashed or wrote raw text to the file. Consult thereferences/fallback-tree.md.
Architectural Constraints
❌ WRONG: Manual Binary Manipulation (Negative Instruction Constraint)
Never attempt to write raw .png bitstreams natively from your context window. LLMs cannot safely generate binary blobs this way.
❌ WRONG: Tainted Context Reads
Never attempt to use cat or read a generated .png file back into your chat context to "verify" it. It is raw binary data and will instantly corrupt your context window. You MUST use the verify_png.py script to inspect the file mathematically.
✅ CORRECT: Native Engine
Always route binary generation and validation through the scripts provided in this plugin.
Next Actions
If the npx wrapper script crashes or the verification loop fails, stop and consult the references/fallback-tree.md for triage and alternative conversion strategies.
More from richfrem/agent-plugins-skills
markdown-to-msword-converter
Converts Markdown files to one MS Word document per file using plugin-local scripts. V2 includes L5 Delegated Constraint Verification for strict binary artifact linting.
52excel-to-csv
>
32zip-bundling
Create technical ZIP bundles of code, design, and documentation for external review or context sharing. Use when you need to package multiple project files into a portable `.zip` archive instead of a single Markdown file.
29learning-loop
(Industry standard: Loop Agent / Single Agent) Primary Use Case: Self-contained research, content generation, and exploration where no inner delegation is required. Self-directed research and knowledge capture loop. Use when: starting a session (Orientation), performing research (Synthesis), or closing a session (Seal, Persist, Retrospective). Ensures knowledge survives across isolated agent sessions.
26ollama-launch
Start and verify the local Ollama LLM server. Use when Ollama is needed for RLM distillation, seal snapshots, embeddings, or any local LLM inference — and it's not already running. Checks if Ollama is running, starts it if not, and verifies the health endpoint.
26spec-kitty-checklist
A standard Spec-Kitty workflow routine.
26