skill · built into metaphor
/artifact
Design and publish self-contained HTML + Tailwind + SVG visual artifacts (diagrams, interactive explainers, charts, mockups, structured docs) that blend seamlessly into Metaphor's theme
- Built in
- Slash command
you ›/artifact
metaphor ›Loaded the artifact 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.
The artifact tool renders a self-contained HTML/Tailwind/SVG fragment inside a sandboxed tab themed with Metaphor's design tokens, and places a compact card in chat.
Before your first artifact call in a turn, load the matching module skill with use_skill alongside this core guide:
| What the user is asking | Module skill to load | kind |
|---|---|---|
| "How does X work?" (physical, biological, protocol, algorithm, engine) | artifact-diagram (illustrative metaphor) |
diagram |
| "Architecture / components / layers of X" | artifact-diagram (structural containment) |
diagram |
| "Steps / pipeline / request trace / lifecycle" | artifact-diagram (flowchart / sequence) |
diagram |
| "Database schema / tables / foreign keys" | artifact-diagram (lib:mermaid erDiagram) |
diagram |
| "What happens when I vary X? / Tradeoff calculator / Simulation" | artifact-interactive (+ artifact-chart if plotted) |
interactive |
| "Compare A vs B vs C / Form / UI mockup / Data record" | artifact-mockup |
mockup |
| "Plot / benchmark / distribution / time series" | artifact-chart |
chart |
| "Digest / structured reference / learnings report" | (this core skill) | doc |
Core philosophy
- Seamless with the host. Artifacts live inside Metaphor's monochrome + single-accent workbench. Never hardcode light/dark backgrounds or hex text colors in HTML or SVG. Always use the host CSS variables, Tailwind token classes (
bg-surface2,text-neutral6,border-border1), orc-*color ramp classes so light and dark themes work automatically. - Quiet chrome, expressive content. The frame stays flat:
0.5pxborders, subtle surface elevation (bg-surface2), zero box-shadows, zero decorative gradients (a single 2-stop SVG<linearGradient>is fine when it encodes a continuous quantity like heat or pressure), zero emoji. The content is where you spend creativity — see "Make it memorable" below. - Explainers are self-contained lessons. For teaching, the artifact holds the narrative and the visuals together: a hook line at the top, then each beat as a short section (
<h3>+ 1–3 sentences, max ~60 words) with its diagram or control directly underneath, then a one-line takeaway. No essays — the visuals carry the idea and the text names what to look at. Captions and readouts update live when a control changes. Write maths as plain text or HTML, never LaTeX. - One subject per artifact. Keep one topic in one artifact; only split when there are genuinely two subjects (for example the system overview and a separate deep-dive).
- Update in place by reusing
title. Callingartifactagain with the sametitlepublishes a new revision (v2,v3) in the same tab.
Make it memorable (do this every time)
A grid of labelled boxes is the floor, not the goal. Before writing markup, decide in one sentence what the reader should see happen, then pick at least two of these:
- A physical metaphor. Draw the mechanism as something with a shape: a queue is a conveyor with parcels on it, a cache is a shelf in front of a warehouse, backpressure is a pipe narrowing, a lock is a turnstile, a retry is a loop that comes back around. Real names go on the parts; the metaphor carries the intuition.
- Motion that means something. Show data moving, not just existing. The host ships these classes:
class="arr flow"on a<line>/<path>makes dashes stream along it (data in transit).<circle r="5" class="token"><animateMotion dur="2.4s" repeatCount="indefinite" path="M60 80 H320 V160"/></circle>sends a request dot along a route. Use one token per concurrent thing, staggered withbegin="0.8s".class="arr draw" style="--mx-len: 420"draws a path in once (set--mx-lento roughly the path length).class="pulse"on the one element that is waiting, hot, or failing.class="reveal"on sibling cards or<g>groups makes them rise in, one after another. Motion is automatically disabled for users who prefer reduced motion. Animate at most 2–3 things at once; the eye must know where to look.
- Direct manipulation. If the real system has a knob (rate, size, timeout, count), give the reader that knob: a slider or toggle that changes the picture live (queue fills up, bar turns red, path reroutes). Pair it with a one-line readout of the consequence ("p99 ≈ 340 ms — the queue never drains").
- A stepper through state. For a lifecycle or trace, draw the whole system once and let
Prev/Nextbuttons light up one stage at a time while a caption explains why that step exists. Keep untouched parts visible but dimmed (opacity: 0.35). - One focal point and an annotation. Exactly one element uses a strong
c-*ramp or.tokenaccent; everything else staysc-grayor.box. Point at the surprising part with a.leaderline and a short.tsnote ("this is where the 30 s goes"). - Before / after. Show the naive design and the fixed design side by side, or let a toggle flip between them, with the broken spot marked in
c-red.
Quick check before calling artifact: if you replaced every label with "Box", would the picture still say something? If not, the shape is not doing any work yet.
Complexity budget (hard limits)
- Typography: 2 font weights only (
400regular,500medium — never600/700). Sentence case everywhere (neverALL CAPSlabels ortext-transform: uppercase). - Grid density: At most 4 cards or nodes per row. Minimum
12px(gap-3) between cards;60pxbetween diagram boxes. - Color budget: At most 2 categorical
c-*ramps per artifact unless encoding semantic status (green/amber/red). Include a 1-line legend whenever color encodes meaning. - Fragment rules: Pass only the inner markup in
html— never<!DOCTYPE>,<html>,<head>, or<body>. Never useposition: fixedorfixed(the iframe auto-sizes to its content). No externalhttp(s):scripts, stylesheets, fonts, or images.
What the host injects for you (artifact-host.css + Tailwind v4)
You do not need to write boilerplate CSS for controls, cards, or SVG nodes. The host automatically provides:
1. CSS variables & Tailwind token classes
- Surfaces:
var(--color-bg-primary)(bg-surface1),var(--color-bg-secondary)(bg-surface2),var(--color-bg-tertiary)(bg-surface3),var(--color-bg-info|success|warning|danger) - Text:
var(--color-text-primary)(text-neutral6/text-fg),var(--color-text-secondary)(text-neutral4/text-fg-subtle),var(--color-text-tertiary)(text-neutral3/text-fg-subtlest),var(--color-text-info|success|warning|danger) - Borders & Radii:
var(--color-border-tertiary)(border-border1),var(--color-border-secondary)(border-border2),var(--border-radius-md)(rounded-md, 6px),var(--border-radius-lg)(rounded-lg, 8px),var(--border-radius-xl)(rounded-xl, 12px) - Short aliases for inline styles:
var(--p)(primary text),var(--s)(secondary text),var(--t)(tertiary text),var(--bg2)(secondary surface),var(--b)(subtle border)
2. Pre-styled bare HTML elements & card classes
- Bare
<button>,<select>,<input type="text|number">,<input type="range">,<table>,<code>,<pre>are pre-styled to match Metaphor. .metric-card— flatbg-surface2card (padding: 1rem; border-radius: 6px; border: none)..raised-card— borderedbg-surface1card (border: 0.5px solid var(--color-border-tertiary); border-radius: 8px; padding: 1rem 1.25rem).
3. SVG diagram classes & shared arrow marker
- Every
<svg>automatically receives<defs><marker id="arrow" ... context-stroke .../></defs>— just usemarker-end="url(#arrow)"on<line>or<path>. .t(14px primary text),.ts(12px secondary subtitle),.th(14px medium 500 title)..box(neutral node fill + 0.5px border),.node(clickable pointer + hover opacity),.arr(1.5px connector line,fill: none),.leader(0.5px dashed leader line).- 9 color ramps:
.c-purple,.c-teal,.c-coral,.c-pink,.c-gray,.c-blue,.c-green,.c-amber,.c-red. Applyclass="node c-teal"on<g>and its child<rect>,.th/.t, and.tsautomatically get matching light/dark fill, stroke, and text contrast!
4. Bundled offline scripts & host bridge
<script src="lib:chart"></script>— inlines offline Chart.js (window.Chart).<script src="lib:mermaid"></script>— inlines offline Mermaid (window.mermaid, forerDiagramonly).sendPrompt("...")— sends a follow-up prompt to the chat when clicked (buttons callingsendPromptautomatically get a trailing↗).openFile("packages/harness/src/session/runner.ts", 42)or<a href="packages/harness/src/session/runner.ts:42">— opens the file at that line in Metaphor's editor! Always wire real code nodes and file references toopenFile(path, line)when explaining repository code.
Anti-bloat "tells" to avoid (frontend-design rules)
Never emit any of these AI-generated page tells:
- Purple-to-blue gradients, neon glow shadows, or glassmorphism blur cards.
- All-caps tracking headers (
OVERVIEW,KEY METRICS) or numbered01 / 02 / 03badges on non-sequential items. - Centered hero banners with marketing taglines inside an engineering explainer.
- Emoji prefixes on headings or card titles (
🚀 Performance,🔒 Security). - Wrapping a single SVG or chart inside a redundant outer bordered card with a duplicate title (the Artifact tab toolbar already renders the title and kind badge).
- Invented benchmark numbers or fabricated metrics — every plotted number must come from code, a command output, a formula, or a cited source.
Questions
What is the artifact skill?
Design and publish self-contained HTML + Tailwind + SVG visual artifacts (diagrams, interactive explainers, charts, mockups, structured docs) that blend seamlessly into Metaphor's theme
How do I use artifact in Metaphor?
It is built into Metaphor. Type /artifact 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
- /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
- /artifact-diagramSkillHand-placed SVG diagram rules for HTML artifacts — 680px viewBox geometry, Geist character width calibration, c-* color ramps, L-bend connectors, illustrative…ships with metaphor