From zworkflow
Draw a system architecture diagram as Excalidraw JSON + rendered PNG, then upload both to Slack. Triggers on "아키텍처 그려줘", "아키텍쳐 다이어그램", "구조도 그려줘", "architecture diagram", "system diagram", "draw architecture".
How this skill is triggered — by the user, by Claude, or both
Slash command
/zworkflow:architecture-diagramThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Produce a dark-themed system architecture diagram as a pair of artifacts:
Produce a dark-themed system architecture diagram as a pair of artifacts:
arch-<slug>-<ts>.excalidraw — editable JSON source (open at excalidraw.com)arch-<slug>-<ts>.png — rendered image for Slack previewBoth are uploaded to the current Slack thread via mcp__slack-mcp__send_media (PNG) and mcp__slack-mcp__send_file (JSON).
Bundled in references/ (vendored, no external plugin dependency):
render_excalidraw.py — Playwright-based rendererrender_template.html — loads Excalidraw ES module from esm.shpyproject.toml, uv.lock — Python depsRuntime:
uv + Python 3.11+ on PATHesm.sh at render time (already allow-listed in dev sandbox)List components + directional flows. Classify each component by semantic type (see palette). If input is too thin to render safely, ask a follow-up via structured UI (UIAskUserQuestion) — do not hallucinate.
Trigger: Apply this step only when either condition holds:
For simple diagrams (< 10 components, single concern), skip directly to Step 2 — Plan-then-Render has real overhead and is not worth it for small cases.
When triggered, produce a short markdown plan before writing any JSON:
## Components
- <name> — <semantic type> — <1-line reason>
- …
## Edges
- <from> → <to> — <label / protocol>
- …
## Grouping
- <cluster name>: [<member>, <member>, …]
- …
Then render the plan into JSON in Step 2. The plan is an internal artifact — do not upload it to Slack. Its purpose is to surface structural mistakes (missing component, wrong edge direction, bad clustering) at plan-level where they are cheap to fix, instead of at JSON or render level where they are expensive.
.excalidraw JSONWrite to $(pwd)/arch-<slug>-<ts>.excalidraw where $(pwd) is the session working directory (runtime guarantees /tmp/{slackId}/session_* — safe for Slack upload).
Required settings:
appState.viewBackgroundColor: "#020617" (slate-950)appState.gridSize: 20roundness: { "type": 3 }, roughness: 0roundness: { "type": 2 }, must set startBinding + endBindingstrokeColor MUST be #e2e8f0 (slate-200) or match the parent container's stroke color from the palette — black text is invisible on dark bgSemantic color palette (fill + stroke pair):
| Component | fill (bg) | stroke (border/text) |
|---|---|---|
| Frontend | #083344 | #22d3ee (cyan-400) |
| Backend | #064e3b | #34d399 (emerald-400) |
| Database | #4c1d95 | #a78bfa (violet-400) |
| AWS / Cloud | #78350f | #fbbf24 (amber-400) |
| Security | #881337 | #fb7185 (rose-400) |
| Message Bus | #7c2d12 | #fb923c (orange-400) |
| External | #1e293b | #94a3b8 (slate-400) |
Reference: see references/json-schema.md and references/element-templates.md for concrete element shapes.
Idempotent — safe to re-run:
cd "$CLAUDE_PLUGIN_ROOT/skills/architecture-diagram/references"
uv sync 2>/dev/null
uv run playwright install chromium 2>/dev/null
if ! curl -fsSI --max-time 5 https://esm.sh/ >/dev/null 2>&1; then
echo "ERROR: esm.sh unreachable — renderer requires network access to esm.sh." >&2
exit 2
fi
If this fails, do NOT proceed; report the error and endTurn.
cd "$CLAUDE_PLUGIN_ROOT/skills/architecture-diagram/references"
uv run python render_excalidraw.py "$(pwd_of_json)/arch-<slug>-<ts>.excalidraw"
The renderer writes PNG next to the input JSON.
PNG="$(pwd_of_json)/arch-<slug>-<ts>.png"
[ -f "$PNG" ] || { echo "ERROR: PNG not generated"; exit 1; }
size=$(stat -f%z "$PNG" 2>/dev/null || stat -c%s "$PNG")
[ "$size" -gt 5120 ] && [ "$size" -lt 10485760 ] || { echo "ERROR: PNG size suspect: $size bytes"; exit 1; }
python3 - "$PNG" <<'PY'
import struct, sys
p = sys.argv[1]
with open(p, "rb") as f:
if f.read(8) != b"\x89PNG\r\n\x1a\n":
raise SystemExit("not a PNG")
f.read(4)
if f.read(4) != b"IHDR":
raise SystemExit("invalid PNG header")
w, h = struct.unpack(">II", f.read(8))
if w < 400 or h < 300:
raise SystemExit(f"dim-fail:{w}x{h}")
PY
Mechanical checks in Step 6 catch missing files and degenerate dimensions — they do not catch visual mistakes (misrouted arrows, overlapping boxes, clipped labels, wrong semantic colors). Run a vision-based self-critique pass:
Read tool (Claude is multimodal — the rendered image becomes part of the conversation).references/critic-checklist.md — all 6 items.Common failure modes to look for:
#1e1e1e) on the dark background — invisible.After the initial render (Step 5), the skill may perform up to 3 retries before stopping. A retry is a full render+validate+critique pass that replaces the previous one. The 3-retry budget is partitioned by cause:
These two allotments are independent — a mechanical failure followed later by a critic failure is legal, as long as each stays within its own cap. After the budget is exhausted, stop. endTurn with the captured stderr (for mechanical errors) or the final critique notes (for visual failures). Do not loop.
mcp__slack-mcp__send_media(
file_path="<absolute path to PNG>",
title="<meaningful architecture title>",
alt_text="<1-2 sentence description of what the diagram shows>",
initial_comment="<optional 1-line context>"
)
mcp__slack-mcp__send_file(
file_path="<absolute path to .excalidraw>",
title="<same slug>.excalidraw (editable source)",
initial_comment="Open at excalidraw.com to edit."
)
If the session is NOT in a Slack-mention context (slack-mcp unavailable), the artifacts remain at $(pwd) and the skill reports the paths instead of uploading.
One-line confirmation. No preamble. No follow-up question unless the input was thin enough to warrant UIAskUserQuestion.
roughness > 0).startBinding / endBinding on arrows — breaks layout on resize.strokeColor at the default #1e1e1e — it disappears on dark backgrounds.references/color-palette.md — full semantic mappingreferences/element-templates.md — copy-paste element JSON + canonical archetype skeletonsreferences/critic-checklist.md — 6-item visual self-critique checklist used in Step 6.5references/json-schema.md — Excalidraw JSON schema (minimal)templates/template.html — legacy HTML/SVG visual reference (dev-only)Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub 2lab-ai/soma-work --plugin zworkflow