skill · built into metaphor
/artifact-diagram
Hand-placed SVG diagram rules for HTML artifacts — 680px viewBox geometry, Geist character width calibration, c-* color ramps, L-bend connectors, illustrative spatial metaphors, and ERDs
- Built in
- Slash command
you ›/artifact-diagram
metaphor ›Loaded the artifact-diagram skill. What should I work on?
What the agent is told
This is the skill's SKILL.md, exactly what Metaphor reads before the task.
Use hand-placed <svg viewBox="0 0 680 H" width="100%"> for all diagrams (except database schemas with many columns, which use <script src="lib:mermaid"> with erDiagram).
1. Route on the verb first
| Prompt intent | Diagram style | Key rule |
|---|---|---|
| "How does X work?" | Illustrative (default, most ambitious) | Draw the spatial/physical metaphor (buffers filling, wave/packet moving, memory slots, tree splitting), not just named boxes. If the system has a knob or threshold, add a slider! |
| "Architecture of X" | Structural | Outer <rect rx="12" stroke-dasharray="4 3"> container holding 2–4 inner <g class="node c-..."> boxes. Max 2–3 nesting levels. |
| "Steps / trace / flow" | Flowchart / sequence | 3–5 nodes per diagram, left-to-right or top-to-bottom, with concrete payload values (POST /run {id: 7}) on the connectors or subtitles. |
| "Cycle / state loop" | HTML stepper (never a ring) | Never draw a circular ring of arrows — build an HTML stepper (Prev / Next buttons + step indicator) where each step swaps or highlights the active stage on the SVG. |
| "Database schema / ERD" | Mermaid erDiagram |
Use <script src="lib:mermaid"></script> and mermaid.render(...). |
2. SVG canvas & Geist width calibration
- Fixed coordinate width: Always
<svg width="100%" viewBox="0 0 680 H">whereHis the lowest element's bottom edge +24..36. - Safe area: Keep all boxes and text inside
x = 40..640,y >= 20. Never use negative coordinates. - Geist font width calibration: Measure every label before choosing
widthso text never clips or overflows its<rect>(theartifacttool runs an automatic layout linter and will report overflows!):.th/.t(14pxGeist): ~8px per character (width >= text.length * 8 + 28)..ts(12pxGeist): ~6.8px per character (width >= text.length * 6.8 + 24).- Single-line node height:
44px. - Two-line node height (title
.th+ subtitle.ts):56px(place title aty + 22, subtitle aty + 40, centered atx + width / 2withtext-anchor="middle"anddominant-baseline="central"). - Keep subtitles to 5 words or fewer.
3. Node & connector template
<svg width="100%" viewBox="0 0 680 180">
<!-- Node 1: clickable to open a workspace file -->
<g class="node c-purple" onclick="openFile('packages/harness/src/session/runner.ts', 42)">
<rect x="40" y="52" width="160" height="56" rx="8" />
<text class="th" x="120" y="72" text-anchor="middle" dominant-baseline="central">Session runner</text>
<text class="ts" x="120" y="92" text-anchor="middle" dominant-baseline="central">runner.ts:42</text>
</g>
<!-- Connector: stops at box edges (200 -> 260), never crosses inside a box -->
<line x1="200" y1="80" x2="258" y2="80" class="arr" marker-end="url(#arrow)" />
<text class="ts" x="229" y="70" text-anchor="middle">tool call</text>
<!-- Node 2 -->
<g class="node c-teal" onclick="openFile('packages/harness/src/tool/artifact.ts', 1)">
<rect x="260" y="52" width="160" height="56" rx="8" />
<text class="th" x="340" y="72" text-anchor="middle" dominant-baseline="central">Artifact tool</text>
<text class="ts" x="340" y="92" text-anchor="middle" dominant-baseline="central">validates + lints</text>
</g>
<line x1="420" y1="80" x2="478" y2="80" class="arr" marker-end="url(#arrow)" />
<!-- Node 3 -->
<g class="node c-blue">
<rect x="480" y="52" width="160" height="56" rx="8" />
<text class="th" x="560" y="72" text-anchor="middle" dominant-baseline="central">Sandboxed tab</text>
<text class="ts" x="560" y="92" text-anchor="middle" dominant-baseline="central">null-origin iframe</text>
</g>
</svg>
4. Connector & color rules (checked by the host linter)
- Every
<path>or<polyline>connector must setfill="none"(orclass="arr"), otherwise SVG fills the bend with a black triangle. - Lines stop at box edges (
x1 = boxA.x + boxA.width,x2 = boxB.x - 2). Never route a straight<line>through an unrelated<rect>; use an L-bend<path d="M x1 y1 L x1 yMid L x2 yMid L x2 y2" class="arr" marker-end="url(#arrow)" fill="none" />. - Never nest a
<g class="c-*">inside another<g class="c-*">— CSS descendant selectors will overwrite the inner ramp's text/fill colors. Keep all nodes as sibling<g>elements. - Color assignment:
- Prefer
c-purple,c-teal,c-coral,c-pinkfor categorical grouping (stages, components, actors). - Reserve
c-blue(info/focus),c-green(success/healthy),c-amber(warning/queued),c-red(error/rejected) for semantic meaning. - Use
c-grayor.boxfor supporting/idle nodes so the active path stands out.
- Prefer
- No rotated text (
transform="rotate(...)"on<text>) — keep every label horizontal.
Questions
What is the artifact-diagram skill?
Hand-placed SVG diagram rules for HTML artifacts — 680px viewBox geometry, Geist character width calibration, c-* color ramps, L-bend connectors, illustrative spatial metaphors, and ERDs
How do I use artifact-diagram in Metaphor?
It is built into Metaphor. Type /artifact-diagram in the composer, or describe the task and the agent loads the skill when it fits.
What is a skill?
A skill is a set of written instructions the agent reads before it starts a kind of task. It changes how the agent works, not what it is allowed to do.
More built-in skills
- /ai-ciSkillBudgeted investigation of failed GitHub Actions / PR checks — bootstrap annotations first, then failed logs, localize to code, classify flake vs real vs infraships with metaphor
- /ai-prSkillBudgeted whole-PR critique via the pr subagent — map diff, evidence findings, return a pr_review_draft for the Agent Review canvasships with metaphor
- /ai-securitySkillBudgeted security and AI-agent risk review — ai_security scan, OSV CVE/GHSA lookups, OWASP LLM/MCP/Top10 tagging, draft for Agent Review canvasships with metaphor
- /ai-sreSkillBudgeted production investigation against connected observability/logs MCP servers — scope, resolve schema, query, correlate, conclude with evidenceships with metaphor
- /artifactSkillDesign and publish self-contained HTML + Tailwind + SVG visual artifacts (diagrams, interactive explainers, charts, mockups, structured docs) that blend…ships with metaphor
- /artifact-chartSkillChart.js rules for HTML artifacts — offline lib:chart script, wrapper-div sizing, custom HTML legends with values, hex palette for canvas, and honest data rulesships with metaphor