Skill v1.0.1
currentAutomated scan100/100+6 new
version: "1.0.1" name: viz-render description: >- Render markdown or Mermaid content as formatted HTML in the browser. Triggers when the user asks to view, render, or preview a document as HTML; when the user asks to visualize, diagram, chart, or draw architecture, flows, sequence/class/state/ER diagrams; when resolving plan files from ~/.claude/plans/; or proactively when about to output a table over ~20 lines or with 4+ rows and 3+ columns, a structured comparison, an audit, a feature matrix, or any formatted content exceeding ~20 lines in the terminal.
Viz Render Skill
Render markdown documents, Mermaid diagrams, or plan files as formatted HTML with syntax highlighting, math formulas, and Pele diagrams (Mermaid syntax), in the dark-only Musingfox design system. One skill, one script, three input shapes.
Requires macOS (open, stat -f), python3, curl, lsof, and network access for the CDN that loads Pele, KaTeX, and highlighting.
When NOT to Use
- Short non-table content (<20 lines) or simple diagrams (2–8 nodes) — use the
viz-inline skill's chat shapes (call tree, pseudocode, diff) instead
- User explicitly wants terminal/text output
- User is asking to edit or modify the content, not view it
Input Shapes → Workflow
Shape A: file path
User gave an absolute/relative path to a markdown file.
bash "${CLAUDE_PLUGIN_ROOT}/lib/render.sh" "{file_path}" "doc-{name}"
Shape B: plan name (bare name, no path separator, no .md)
List available plans or resolve by name against ~/.claude/plans/:
INPUT="$ARGUMENTS"PLANS_DIR="$HOME/.claude/plans"if [ -z "$INPUT" ]; thenecho "Available plans in $PLANS_DIR:"ls -t "$PLANS_DIR"/*.md 2>/dev/null | head -20 | xargs -n1 basename | sed 's/\.md$//' | sed 's/^/ - /'elif [ -f "$INPUT" ]; thenDOC_FILE="$INPUT"; DOC_NAME=$(basename "$DOC_FILE" .md)bash "${CLAUDE_PLUGIN_ROOT}/lib/render.sh" "$DOC_FILE" "doc-$DOC_NAME"elseDOC_FILE="$PLANS_DIR/$INPUT.md"[ -f "$DOC_FILE" ] && bash "${CLAUDE_PLUGIN_ROOT}/lib/render.sh" "$DOC_FILE" "doc-$INPUT" \|| { echo "Plan not found: $INPUT.md"; ls -t "$PLANS_DIR"/*.md 2>/dev/null | head -10 | xargs -n1 basename | sed 's/\.md$//' | sed 's/^/ - /'; }fi
Shape C: inline content or Mermaid code
Write the content (or Mermaid wrapped in a ``` `mermaid ``` fence) to a temp markdown file, then render.
For inline markdown, write to /tmp/viz-doc-{timestamp}.md.
For bare Mermaid code, wrap as:
# {Diagram Title}
{mermaid code}
…write to /tmp/viz-diagram-{name}.md, then:
bash "${CLAUDE_PLUGIN_ROOT}/lib/render.sh" "/tmp/viz-diagram-{name}.md" "diagram-{name}"
Generating Mermaid From Scratch
When the user requests a diagram without providing the code:
- Pick a diagram type (see
references/diagram-types.mdfor syntax) - Keep it focused: descriptive labels <30 chars, no-space IDs
- If requirements are too broad, suggest splitting into multiple diagrams
- After rendering, ask the user to confirm the diagram drew: Pele runs in
the browser, and a syntax error shows as red text in place of the diagram, visible only to them
Output
The render script prints the output HTML path (under /tmp/viz/{project}/), then a URL: line, and opens that URL in the default browser. Every render goes through the local viz server on 127.0.0.1; only when no port is free does it fall back to opening the file and print no URL. Report the path to the user.
Over SSH (SSH_CLIENT or SSH_CONNECTION set) the server binds 0.0.0.0, the URL: line carries the Tailscale IP, and no browser opens. Report that URL to the user instead of the path.
Recipes (interactive HTML artifacts)
If the markdown file starts with frontmatter viz: <recipe>, the render script swaps the generic viewer for a recipe-specific interactive template. Recipes treat markdown as the canonical source: the HTML reads from it on load and exports a roundtrippable markdown back to the clipboard on Export.
Use a recipe when the user wants an output they will iterate on (mark items as done/wontfix, filter, edit fields), not just read.
Available recipes:
- pr-review — severity-grouped finding cards with status badges,
inline-editable metadata, and severity filters. See references/recipes/pr-review.md for the markdown structure spec.
- feedback — renders any markdown read-only and collects a structured
answer (option pick + notes) written back into frontmatter; a round of several decisions opens on a card view projected from the body, with the verbatim markdown one click away. See references/recipes/feedback.md.
Controls: Save writes the edit back to the source .md (labelled 儲存回饋 in feedback); Export copies the updated markdown to the clipboard (labelled 複製 in feedback).
Workflow:
- Author the markdown with the recipe's frontmatter and structure.
bash "${CLAUDE_PLUGIN_ROOT}/lib/render.sh" <file.md> <output-name>- Arm the Monitor from
references/recipes/round-trip-monitoring.mdon the
source file; the user edits in HTML and clicks Save, which wakes you to read the file back.
- Fallback when the page opened over
file://(Save hidden): the user clicks
Export and pastes the markdown to chat; overwrite the source .md and re-render.
Markdown without viz: frontmatter falls through to the generic viewer unchanged.
The viz server, and with it the recipe Save endpoint, listens on port 18090 by default. If that port is held by another process, render.sh auto-selects the next free port (trying up to 5 candidates) so the recipe still opens over http:// — no manual override needed. Set VIZ_PORT=<port> only to pin a specific base port.
References
- Diagram type syntax:
references/diagram-types.md - Recipe specs and round-trip monitoring:
references/recipes/ - Mermaid docs: https://mermaid.js.org/
- Live editor: https://mermaid.live