con un clic
diagram
SVG diagrams, charts, and interactive visualizations for chat UI
Instalar con Codex o Claude Copia este prompt, pรฉgalo en Codex, Claude u otro asistente, y deja que revise la pรกgina de la skill y la instale por ti.
Menรบ
SVG diagrams, charts, and interactive visualizations for chat UI
Instalar con Codex o Claude Copia este prompt, pรฉgalo en Codex, Claude u otro asistente, y deja que revise la pรกgina de la skill y la instale por ti.
Basado en la clasificaciรณn ocupacional SOC
MUST USE for cli-jaw PABCD orchestration workflows โ orchestrate, phase, attest/attestation, interview mode, goal mode, checkpoints, and multi-phase development. Triggers: orchestrate, phase, attest, attestation, interview, goal mode, checkpoint, PABCD, ์๊ตฌ์ฌํญ ์ ๋ฆฌ, ์ธํฐ๋ทฐ, ์คํ ์ ๋ฆฌ. Operate state transitions only when the user explicitly requests orchestration or an active PABCD phase is injected โ do not transition state merely because a document mentions phases, goals, or checkpoints.
MUST USE for every coding task โ classifies work depth (C0-C5), task_tags overlays, modular limits, pre-write search, verification-before-completion, and safety rules. Triggers: develop, implement, refactor, feature, bug fix, test, review, code quality, scaffolding.
Use only on the Codex CLI for native image generation or image editing without an API key. Save final PNG files under ~/.cli-jaw/uploads, report web-ready absolute-path markdown, and send to Telegram or Discord only when explicitly requested.
MUST USE for any real runtime debugging in any language โ crashes, silent failures, wrong output, build/test failures, flaky tests, performance regressions, and integration bugs. A 5-phase root-cause method: architecture check โ investigate โ analyze โ hypothesize โ implement. Triggers: debug this, why is X failing, flaky test, fix the crash, root cause, error, stack trace, regression, ์ ์ ๋ผ, ๋๋ฒ๊น , ์์ธ ๋ถ์.
MUST USE for code review and review-readiness โ review process, quality thresholds, antipattern detection, review verdicts, and giving/receiving feedback. Triggers: review this, code review, PR review, check my diff, before merge, antipattern, review-readiness, ๋ฆฌ๋ทฐ, ์ฝ๋ ๋ฆฌ๋ทฐ, ๋จธ์ง ์ ์ ํ์ธ.
MUST USE for any frontend, web UI, or visual implementation work โ building, styling, or redesigning pages/components, responsive layouts, motion, component architecture, and production-surface polish. Triggers: frontend, UI, component, CSS, responsive, animation, React, Vue, Svelte, Tailwind, layout, styling, redesign, mockup, anti-slop, ํ๋ก ํธ์๋, UI ์์ , ๋ฐ์ํ, ๋์์ธ ์์ .
| name | diagram |
| description | SVG diagrams, charts, and interactive visualizations for chat UI |
| metadata | {"version":"1.3.0"} |
| capabilities | ["SVG: structural diagrams, comparisons, timelines, mockups, art","Mermaid: flowchart, sequence, ER, state, timeline, mindmap, gantt, pie, radar, git graph","Native chart shortcut: chart-json for simple single-series bar, line, and pie charts","Charts (Chart.js): bar, line, pie, scatter, doughnut, polar","Charts (ECharts): heatmap, sankey, radar, treemap, gauge, funnel, candlestick, chord","Maps (Leaflet): interactive maps with markers, popups, dark mode","Interactive: sliders, toggles, sendPrompt, physics (Matter.js), 3D (Three.js), audio (Tone.js), creative (p5.js)"] |
| references | ["svg-components.md โ SVG primitives, layout templates","color-palette.md โ 9-color design system","module-chart.md โ Chart.js + ECharts + D3","structured-renderers.md โ native renderer delegation notes","module-interactive.md โ controls, sendPrompt, debouncing","module-widget.md โ physics, 3D, audio, creative coding","module-map.md โ Leaflet maps","module-mockup.md โ UI mockup patterns","module-art.md โ decorative SVG","module-domain-cards.md โ weather, finance, sports, product card templates"] |
window.__jawTokens for canvas/JS.sendPrompt() or prose โ not the box.Route on the verb, not the noun. Same subject gets different diagrams. Prefer Mermaid when the diagram type maps cleanly to a native Mermaid syntax โ it's cheaper than hand-rolling SVG.
| User says / intent | Type | Output |
|---|---|---|
| "how does X work" | Illustrative SVG | Spatial metaphor, cross-section, physical layout |
| "architecture of X" (system context) | Structural SVG | Containers, regions, nesting |
| "steps of X" (generic process) | Flowchart SVG or Mermaid flowchart | Top-down boxes + arrows |
| "compare A vs B" | Comparison SVG | Side-by-side columns |
| "DB schema / entity relationship" | Mermaid | ```mermaid erDiagram |
| "class diagram / OOP structure" | Mermaid | ```mermaid classDiagram |
| "state machine / lifecycle" | Mermaid | ```mermaid stateDiagram-v2 |
| "sequence / call order / API flow" | Mermaid | ```mermaid sequenceDiagram |
| "timeline / roadmap / history" | Mermaid | ```mermaid timeline |
| "mind map / brainstorm / outline" | Mermaid | ```mermaid mindmap |
| "git branching / release history" | Mermaid | ```mermaid gitGraph |
| "2ร2 matrix / priority quadrant" | Mermaid | ```mermaid quadrantChart |
| "radar / spider / skill profile" | Mermaid v11.6+ (beta) | ```mermaid radar-beta |
| "gantt / project schedule" | Mermaid | ```mermaid gantt |
| "user journey map" | Mermaid | ```mermaid journey |
| "pie breakdown (simple)" | Mermaid | ```mermaid pie |
| "kanban board" | Mermaid v11.12+ (beta, test before use) | ```mermaid kanban |
| "cloud/infra architecture" | Mermaid (beta) | ```mermaid architecture-beta |
| "hierarchy / proportional size" | Mermaid (beta) | ```mermaid treemap-beta |
| "free-form block layout" | Mermaid (beta) | ```mermaid block-beta |
| "show sources / search results / citations" | structured-renderers skill | Non-diagram native card: load structured-renderers for search-results schema |
| "write / draft / compose email, message, document" | structured-renderers skill | Non-diagram native card: load structured-renderers for compose-block schema |
| "table / rows / sortable data / filterable data" | structured-renderers skill | Non-diagram native card: load structured-renderers for dataframe schema |
| "patch / diff / unified diff" | structured-renderers skill | Non-diagram native display: load structured-renderers for diff routing |
| "show data / chart" | chart-json for simple bar/line/pie; diagram-file for advanced charts | For chart-json, load structured-renderers; use file-backed Chart.js / D3 / ECharts iframe widgets when custom JS, maps, advanced chart types, or richer interactivity are required |
| "simulate / interactive" | diagram-file | File-backed Matter.js / Canvas / sliders widget |
| "large widget / iterative widget editing" | diagram-file | Default for all HTML widgets: write the full widget HTML to ~/.cli-jaw/widgets/<chatId>/<widgetId>.html, then emit an id-only file-backed fence |
| "interactive map (with pan/zoom/markers)" | diagram-file | File-backed Leaflet iframe widget โ see reference/module-map.md |
| "static country/state choropleth" | diagram-file | File-backed D3 + TopoJSON widget โ see reference/module-chart.md |
Default to illustrative SVG for "how does X work?" โ don't default to flowchart. Default to Mermaid when the type is in the table above โ don't hand-roll an SVG when classDiagram/sequenceDiagram/stateDiagram already exists.
diagram-file is the default for all HTML widget types. Use diagram-html only as a fallback when the chatId cannot be determined or for very small throwaway widgets that do not warrant a file.
Before producing a diagram-file HTML widget, check whether a native renderer is a better fit:
structured-renderers for search-results, compose-block, dataframe, chart-json, and diff schemas.chart-json for simple single-series bar/line/pie charts.diagram and use diagram-file for maps, multi-series charts, advanced chart types, custom JavaScript, external libraries, or richer interaction.These renderers are lighter than HTML widgets, survive sanitizer/hydration, and avoid iframe overhead. They are final-answer-only structured fences; during streaming they remain inert code blocks. Keep JSON complete, compact, and schema-versioned. See the active structured-renderers skill for canonical schemas and examples.
C4Context, C4Container, etc.) โ theme tokens are not applied in dark mode, text becomes unreadable (mermaid #4906). Substitute routing:
flowchart with subgraphsarchitecture-beta (cloud/infra layout)flowchart with subgraph groupingsequenceDiagramarchitecture-betasankey-beta / xychart-beta โ known to break scale-down at narrow chat widths. Prefer diagram-file + ECharts sankey for flow diagrams, Chart.js for simple XY.radar-beta is the keyword as of Mermaid v11.6+ (not bare radar โ the beta suffix is still required at the time of writing per mermaid/syntax/radar). treemap-beta, block-beta, architecture-beta, packet-beta, kanban are still beta but functional โ test each in cli-jaw Web UI before finalizing. If the installed Mermaid version drops the -beta suffix, update the routing table accordingly.sandbox securityLevel iframe background bug (mermaid #5034) โ affects host rendering, not your output. No action needed from the agent.themeVariables. Do NOT set explicit colors in %%{init: ...}%% unless overriding for semantic reasons.ํ๊ตญ์ด: "๊ทธ๋ ค์ค", "์๊ฐํ", "๋ค์ด์ด๊ทธ๋จ", "์ฐจํธ๋ก", "๋ํ๋ก", "๋น๊ตํ", "ํ๋ก์ฐ์ฐจํธ" ์์ด: "draw", "visualize", "diagram", "chart", "graph", "illustrate", "show me"
๋ค์ ์ํฉ์์ ํ ์คํธ๋ง์ผ๋ก๋ ์ ๋ฌ์ด ๋ถ์กฑํ ๋ ์๋ ์์ฑ:
์ฌ์ฉ์๊ฐ ์๊ฐ๋ฌผ์ ๊ตฌ์กฐ๋ฅผ ๋ช ์ฌ๊ตฌ๋ก ๊ธฐ์ :
All four formats โ inline SVG, ```mermaid, ```diagram-file, ```diagram-html โ are rendered inline in the chat response. The jaw frontend parses your reply text and mounts them automatically. diagram-file and diagram-html go into sandboxed <iframe> elements that the host creates; you do not create the iframe.
diagram-file)Use ```diagram-file as the default for all HTML widget output, including charts, maps, simulations, controls, games, and custom JavaScript widgets. Write the full widget HTML first to ~/.cli-jaw/widgets/<chatId>/<widgetId>.html, following the same HTML rules as diagram-html: the host renders it through the validator and sandboxed iframe, with the same CDN allowlist and theme token expectations.
The fence body is id-only: {"id": "<widgetId>"}. A bare widget id string is also accepted. Do not put paths in the fence; the host resolves <current chatId>/<widgetId>.html by convention. The file-backed cap is 2 MB, while inline diagram-html remains capped at 512 KB. File-backed widgets are mutable: editing the saved HTML updates every message that references the same id. Save under a new id when a frozen version is needed.
Determine the current chatId from runtime context when available. If it is not determinable, use inline diagram-html as the fail-safe. diagram-html is also acceptable for very small throwaway widgets that do not warrant a file.
| โ Don't | โ Do |
|---|---|
Save SVG/Mermaid outputs to .svg / .png files unless explicitly asked | Paste SVG/Mermaid blocks directly into your reply |
Wrap diagram-html in your own <iframe> / <html> / <body> / <head> | Start at <div> / <canvas> / <style> โ host injects the shell |
Send via /api/channel/send or Telegram/Discord โ it is NOT an attachment | Let the renderer handle it; diagrams are response text |
| Reference an external image URL and call it a diagram | Output the SVG/widget code itself |
If the user says "save this diagram" or "download it", still output it inline first so they see it rendered; only write a file if they explicitly ask for a file on disk (and even then, the inline version is the canonical delivery).
Output raw <svg> markup directly in the response. The chat UI renders it inline.
<svg viewBox="0 0 680 {height}" xmlns="http://www.w3.org/2000/svg"
role="img" aria-labelledby="title-id desc-id">
<title id="title-id">Diagram Title</title>
<desc id="desc-id">Brief description for screen readers</desc>
<!-- shapes, text, paths -->
</svg>
Rules:
role="img" + <title> + <desc>.node, .connector, .label, .label-start, etc.) โ .label forces text-anchor: middle (centered text only); for left-aligned text use .label-start or just the color classfont-family inherited from host (do NOT set explicit fonts)Use standard ```mermaid code blocks. The existing renderer handles these.
Use ```diagram-file by default. Wrap in a ```diagram-html code block only when the chatId cannot be determined or the widget is a very small throwaway. Rendered inside a sandboxed iframe.
` ` `diagram-html
<div id="chart-wrapper" style="position: relative; width: 100%; height: 300px;">
<canvas id="myChart" role="img" aria-label="Chart description">
Fallback text
</canvas>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.4.1/chart.umd.js"
onerror="document.body.innerHTML='<p>Chart library failed to load.</p>'">
</script>
<script>
const isDark = window.__jawTheme?.isDark ?? true;
// ... Chart.js code
</script>
` ` `
These are design quality rules (separate from security restrictions below):
<style> in Inline SVG<style> tags inside inline SVG ARE preserved. Custom CSS classes work:
<svg viewBox="0 0 100 100">
<style>
.highlight { fill: #e94560; }
.dim { fill: #94a3b8; }
</style>
<rect class="highlight" width="50" height="50"/>
</svg>
Security filters applied automatically:
@import rules โ stripped@font-face blocks โ strippedurl() โ replaced with none (internal url(#ref) preserved)Best practice: Prefer predefined .c-* classes (see reference/color-palette.md) for theme-aware colors. Use custom <style> when you need colors/patterns not in the design system.
These are stripped by DOMPurify โ NEVER use in inline <svg>:
<foreignObject> โ embeds HTML in SVG (XSS vector)<animate>, <set>, <animateTransform>, <animateMotion> โ animation XSS vectors<svg> โ use <g> groups insteadxlink:href โ use href="#fragment" on <use> only (no external URLs)on* event handlers (onclick, onerror, etc.) โ stripped by DOMPurifyNote:
diagram-fileand fallbackdiagram-htmlcontent run inside a sandboxed iframe where<script>,on*handlers, and CDN imports ARE allowed. The restrictions above apply only to inline SVG rendered in the main document.
Each ramp has 3 shades: fill (bg), stroke (border), text (label).
Use CSS class names โ see reference/color-palette.md:
| Ramp | Class prefix | Preferred use |
|---|---|---|
| cyan | .c-cyan | General categories (preferred for neutral info) |
| pink | .c-pink | General categories, highlights |
| purple | .c-purple | General categories, grouping |
| orange | .c-orange | General categories, accent |
| slate | .c-slate | Neutral, disabled, structural (start/end nodes) |
| blue | .c-blue | Informational (semantic โ use only when meaning is "info") |
| green | .c-green | Success, positive (semantic) |
| amber | .c-amber | Warning, attention (semantic) |
| red | .c-red | Error, negative (semantic) |
Color assignment: color encodes meaning, not sequence. Don't cycle through colors like a rainbow. Group by category โ all nodes of the same type share one color. Prefer cyan/pink/purple/orange for general categories. Reserve blue/green/amber/red for genuinely semantic concepts.
reference/svg-components.md for templates and detailed SVG rules.For diagram-file widgets and fallback diagram-html widgets:
<style> and <link> tags first<script> tags lastThis ensures visual content appears before scripts execute (important during streaming).
| Variable | Use |
|---|---|
--bg | Page background |
--surface | Card/surface background |
--text | Primary text |
--text-dim | Muted/secondary text |
--border | Default border |
--accent | Accent color |
--font-ui | UI font family |
--font-mono | Code font family |
--radius-md | 8px border radius |
--radius-lg | 12px border radius |
window.__jawTheme.isDark (boolean) for JS-side theme detectionwindow.__jawTokens['--bg'] etc. for computed host CSS valuesmatchMedia('prefers-color-scheme') โ the host controls theme<animate>, <set>, <animateMotion>) are stripped โ do not useAll CSS/JS animation is available:
CSS Transition (preferred for hover/state changes):
.element { transition: all 0.3s ease; }
.element:hover { transform: scale(1.05); opacity: 0.8; }
CSS Animation (keyframes):
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.element { animation: fadeIn 0.5s ease-out; }
JS requestAnimationFrame: already documented in module-widget.md (Matter.js, Three.js, p5.js)
transform and opacity (GPU-accelerated)width, height, top, left (layout thrashing)cancelAnimationFrame on cleanupFor detailed patterns, see:
reference/svg-components.md โ SVG primitives, viewBox checklist, layout templatesreference/color-palette.md โ Full color values (light + dark), assignment rulesreference/module-chart.md โ Chart.js + D3 + ECharts 6 integration (bar/line/pie/choropleth + heatmap/sankey/radar/treemap/gauge/funnel/candlestick/chord)reference/module-widget.md โ Physics (Matter.js), math graphs (Math.js), 3D (Three.js), creative coding (p5.js), audio (Tone.js), mini-gamesreference/module-interactive.md โ Sliders, selects, segmented buttons, toggles, play/pause/reset, debouncing, sendPrompt, keyboard accessibility, control layout patternreference/module-map.md โ Leaflet interactive maps (OpenStreetMap tiles, markers, popups, dark mode)reference/module-mockup.md โ UI mockup patternsreference/module-art.md โ Decorative SVG patternsreference/module-domain-cards.md โ Domain card templates (weather, finance, sports, product) + real-time data pipeline