CommunityBildgithub.com

infra-diagrams

Draws IT architecture diagrams (isometric, 2D block diagram, rack elevation) as SVG/PNG from a JSON scene, with vendor-neutral device fronts and optionally device fronts from your own or licensed Visio stencils whose licence allows conversion (asset library, e.g. on SharePoint). Use when someone wants an infrastructure, data centre, network, cluster or rack layout as a picture (also German requests such as Diagramm, Architekturbild, Blockschaltbild, Netzplan, Rack-Ansicht, Rack-Belegung).

Was ist infra-diagrams?

infra-diagrams is a Claude Code agent skill that draws IT architecture diagrams (isometric, 2D block diagram, rack elevation) as SVG/PNG from a JSON scene, with vendor-neutral device fronts and optionally device fronts from your own or licensed Visio stencils whose licence allows conversion (asset library, e.g. on SharePoint). Use when someone wants an infrastructure, data centre, network, cluster or rack layout as a picture (also German requests such as Diagramm, Architekturbild, Blockschaltbild, Netzplan, Rack-Ansicht, Rack-Belegung).

Funktioniert mit✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/MXNeo/infra-diagrams/tree/HEAD/skills/infra-diagrams

Installed? Explore more Bild skills: steipete/songsee, affaan-m/frontend-design, mattpocock/improve-codebase-architecture · View all 6 →

In Ihrer bevorzugten KI fragen

Öffnet einen neuen Chat, in dem dieser Agent-Skill bereits geladen ist.

Dokumentation

Was macht infra-diagrams?

Describe the environment in sentences → scene (JSON) → node infra-diagrams.mjs render → SVG (always) and PNG (when a renderer is available). Deterministic: the same scene gives a byte-identical SVG. Only Node.js ≥ 18, no installation. Answer the user in the language they write in; labels in the scene follow the user's language too.

Files of this skill

FileContent
infra-diagrams.mjsEngine and tools in one file: init, status, render, stencil, check
infra-diagrams-data.jsonComponents, designs, colours, brand register, brand images (must sit next to infra-diagrams.mjs)
README.mdScene format: iso nodes, "view": "2d", "view": "rack", levels, options
catalog.mdAll components (use), primitives (kind), rack devices, 2D elements with parameters
examples.mdPrompts with finished scenes; use them as templates
LESSONS.mdRules for every scene (glow, legend, lines, layout); always follow them
designs.md, stencils.md, logo-usage.md, building-components.mdDesigns/company palette, device fronts from stencils, logo clearances, primitives
cowork.mdWorkflow with SharePoint, layout of folder B, limits, failure patterns

Two folders

The user names two SharePoint folders; nothing else needs setting up:

  • Folder A – stencils (read-only): your own or licensed Visio stencils whose licence allows conversion. Never write there.
  • Folder B – workspace (read and write): the skill sets it up itself on the first call: infra-diagrams.json (settings), library/ (device fronts), stencils/stencil-index.json (catalogue of A), brands.local.json (logo clearances), scenes/ (one scene per diagram), out/ (images), README.md, knowledge/ (shared memory of all sessions).

Locally: work/B/ mirrors B (only the fetched files, same paths), work/A/ holds single stencils fetched from A (same relative path as in A).

Session start in Cowork (mandatory, before anything else)

  1. Engine: if infra-diagrams.mjs and infra-diagrams-data.json are not in the sandbox, download both from the skill folder side by side into one local folder (e.g. skill/) and call node skill/infra-diagrams.mjs …. check finds the browser for PNG and adds --no-sandbox in containers by itself. Only if it reports no renderer or PNG fails, set PLAYWRIGHT_BROWSERS_PATH=<folder with chromium-*>, INFRA_DIAGRAMS_CHROME_NO_SANDBOX=1, INFRA_DIAGRAMS_PNG=chrome. No pip/npm install, no version queries (blocked).
  2. Shared knowledge first: if B has knowledge/README.md, read it and the files it names (sandbox.md, workflow.md, lessons.md, scenes.md) before exploring anything. They are the memory of all users and take precedence; do not re-check what is written there with a check date, unless it fails.
  3. Mirror B into work/B/ (see "Every call"), then status --workspace work/B --json. knowledge.missing (with --listing) or needsInit → init, which adds knowledge/ without replacing anything.
  4. Before a new scene look for a template in knowledge/scenes.md. Real device first: look for the named device in the library (stencil lib), then in the stencil catalogue (stencil search; fmt shows whether its front is convertible), and use a generic component only when neither has it (or the licence forbids conversion).
  5. If an organisational policy blocks downloads from SharePoint (uploads may still work): continue with what is already local, do not retry in a loop, and note it in the journal.

Session end in Cowork (mandatory)

  1. Upload the new scene and images, then library files, the shared indexes last (see "Ground rules").
  2. Create exactly ONE new journal file knowledge/journal/YYYY-MM-DD-<initials>-<topic>.md (template knowledge/journal/TEMPLATE.md: task, what had to be explored, result, assumptions, open points).
  3. Add one line to knowledge/scenes.md (download → add → write back in place; on a conflict download again and merge).
  4. Only new, verified rules go into knowledge/lessons.md, with date; guesses only into the journal. New sandbox facts into knowledge/sandbox.md with check date.
  5. Never delete, rename or blindly overwrite. An upload cannot replace a file: modify the downloaded copy and write it back.

Ground rules

  • SharePoint is not a file system: fetch files with the M365 file functions, process them locally, then upload exactly the files listed in "upload" of the --json output, each to its "to" (path in B).
  • Never write to folder A. Never delete or rename anything in folder B; create files from init only if they do not exist in B yet (never replace).
  • Shared indexes last: fetch library/index.json and stencils/stencil-index.json from B again right before uploading, then run stencil reindex --workspace work/B or stencil catalog --workspace work/B (they merge your own entries back in and delete nothing), then upload. Never --prune.
  • Work only in the working folder; never write into the skill folder.
  • Extern is the default: without --audience intern, vendor logos and device photos appear only for cleared brands (brands.local.json), otherwise text and a neutral front. Use intern only for internal documents.
  • Stencils and library: the stencils' licence applies. Convert and copy into the library only if the licence allows conversion and copying; many vendor stencils only allow creating diagrams and forbid conversion, redistribution and public use. When in doubt, ask and render without stencil fronts (neutral fronts). Keep the library internal, never in a public repository.
  • Keep agent turns cheap: one script run per task with a one-line JSON summary instead of many single steps; decisions that follow from a file format belong in code (the skill's commands already decide EMF vs raster), not in the agent; write big outputs (listings, indexes) to files and print only a summary; check visually with one downscaled image and at most one or two crops.

Without SharePoint (Claude Code, claude.ai, GitHub Copilot, local)

If the user names no folders A/B, everything about SharePoint, init and upload is dropped. infra-diagrams.mjs sits in the same folder as this SKILL.md; call it with its full path, working folder = current folder:

  1. node <skill-folder>/infra-diagrams.mjs check
  2. Write the scene to <name>.json in the working folder (format README.md, building blocks catalog.md, template examples.md, rules LESSONS.md).
  3. node <skill-folder>/infra-diagrams.mjs render <name>.json --out out --json (--audience intern only on request), and give the user the paths from the output (SVG always, PNG when a renderer is available).

Device fronts from stencils only if the user names a stencil folder and its licence allows conversion and copying: stencil search <folder> "<query>", stencil extract <folder> "<master>" --lib <library>, then render … --lib <library>. Your own brands.local.json with --brands-local <file>. A local folder can also serve as a workspace like B (init --workspace <folder>, then every command with --workspace <folder>).

First call

  1. node infra-diagrams.mjs check (Node version, PNG renderer).
  2. Fetch infra-diagrams.json from B into work/B/. If it exists, continue with "Every call". If B only holds iso-visual.json (the skill's former name): fetch it; init takes it over as infra-diagrams.json (upload); the old file stays, delete nothing.
  3. Otherwise: list B (names only) → work/listing-B.json; list A (relative path, size, modification date, download nothing) → work/listing-A.json. Format: a JSON list with name/path, size, lastModifiedDateTime (the Graph API's value list works as is) or text, one path | bytes | date per line.
  4. node infra-diagrams.mjs init --workspace work/B --stencils work/listing-A.json --listing work/listing-B.json --stencil-folder "<location of A>" --workspace-folder "<location of B>" --json
  5. Create the folders from "folders" in B, upload the files from "upload" to "to". If anything is listed under "fetch" (already in B): fetch it and run init again. A second init reports everything unchanged, "upload": [].

Every call

  1. Fetch into work/B/: infra-diagrams.json, library/index.json, stencils/stencil-index.json, brands.local.json. node infra-diagrams.mjs status --workspace work/B --json: next names the next step (needsInit → init, which only adds what is missing; a newer skill version adds new settings).
  2. Check the library: node infra-diagrams.mjs stencil lib "<model> front" --workspace work/B --json → ref (e.g. lib:<vendor>/<slug>) and file; fetch library/<file> and the .json next to it into work/B/library/.
  3. Otherwise search the catalogue (downloads nothing): node infra-diagrams.mjs stencil search "<vendor> <model> front" --workspace work/B --json
    • Hits with master: pick the matching one (configuration from the prompt, e.g. a master with 24D 2.5 = 24 × 2.5"), download = path in A, bytes = size.
    • Hits with "master": null (status pending or stale): file from A not read yet. A vendor or product family in the query finds them by file name.
    • New files in A: list A again, stencil catalog work/listing-A.json --workspace work/B --json (new → pending, changed → stale, missing → removed; nothing is deleted).
  4. Fetch and convert (only if the licence allows conversion and copying): only the one file download from A into work/A/<download>, then node infra-diagrams.mjs stencil extract "<master>" --stencils work/A --workspace work/B --json → ref. This also adds the stencil's master list to the catalogue. If the hit was a file without a master: stencil index work/A/<download> --stencils work/A --workspace work/B --json, then search again.
  5. Write the scene to work/B/scenes/<name>.json: format from README.md, building blocks from catalog.md, template from examples.md, rules from LESSONS.md. Device fronts with "asset": "lib:<vendor>/<slug>". Design, colours, link types, legend and audience come from defaults in infra-diagrams.json; set in the scene only what should differ (the scene wins). To change an existing diagram: fetch scenes/<name>.json.
  6. Render: node infra-diagrams.mjs render work/B/scenes/<name>.json --workspace work/B --json (--audience intern for internal versions). Library, logo clearances and out/ come from the workspace; a scene outside scenes/ is copied there. On errors the message names the next command.
  7. Write back: every path from "upload" to "to": images (out/), scene (scenes/), library files (library/<vendor>/<slug>.svg|json), catalogue sidecars (stencils/indexed/). The two indexes last, as above (fetch again, reindex/catalog, upload). Same input → unchanged, nothing to upload.

PNG

render --json reports "png": backend chrome (exact), rsvg/cairosvg (small deviations, note) or null with skipped. Chrome/Chromium is found by itself (also Playwright browsers under /opt/*/chromium-*); in Linux containers --no-sandbox is added automatically (check shows both). Without PNG, deliver the SVG: Word, PowerPoint, Teams and browsers show SVG directly; if needed, a PNG can be made in PowerPoint via "Save as Picture". --png off switches PNG off, --png on turns a missing PNG into an error (default from defaults.png).

Scenes in brief

{ "nodes": [
  { "use": "firewall", "id": "fw", "at": [0, 0, 0], "glow": "red" },
  { "use": "tag", "for": "fw", "title": "FG-01", "sub": "Gateway", "status": "active" }
] }

2D block diagram with "view": "2d" (groups, devices, nodes, lines with type), rack with "view": "rack" (racks[].items[] with u, use or asset). Classic design "design": "classic" (alias klassisch; default hypermodern), company colours "colors". Devices are vendor-neutral; a brand only when the user names one: iso "components": { "server-2u": { "faces": { "top": { "brand": { "id": "dell" } }, "front": { "brand": { "id": "dell" } } } } }, rack "brand": "dell" on the item, 2D "brand" + "asset" on the device (without an image of your own the name appears as text). A brand id that is not registered renders as text too, with a warning under "warnings". Iso axes: x to the lower right, y to the lower left, z up; fronts face +y; details in README.md ("Iso coordinates and axes"). Primitives go with "kind" ("kind": "text"), components with "use". Glow only when the user asks for it, as "glow": "gold" (or true, { "tone", "opacity", "spread" }) on the object (iso, 2D, rack); otherwise none. Legend with "legend": true.

2D layout by tiers (3-tier), always top to bottom: outside world (internet, WAN, cloud) → network (firewalls, switches, LAN nodes, OOB) → servers → storage. Backup (backup server, repository, tape) at storage height beside it, never at server height. SAN switches may sit as an intermediate tier between servers and storage. Several sites = one column each with the same tiers at the same height; connections between sites run horizontally at the height of their tier. Deviate only on explicit request.

Own device images (user attaches a photo)

When the user attaches a photo or front view of a device and wants it in the diagram (details: custom-images.md):

  1. Look at the image: find the device front (pixel box x0,y0,x1,y1, top left and bottom right) and the rack units (19" front ≈ 10.86 : 1 per unit: 1U ≈ 10.9, 2U ≈ 5.4, 4U ≈ 2.7). Pick a brand id (acme) and the role of the device type: front-1u, front-2u (servers), front-backup-server, front-storage-2u, front-switch-1u, … (front for a 2D device, mark for a logo).
  2. Save the attachment in the working folder, then node infra-diagrams.mjs asset add <image> --brand <id> --role <role> [--name "<brand name>"] [--crop x0,y0,x1,y1] --workspace work/B --json (without a workspace: --brands-local brands.local.json). Read warnings (rack units, size) and fix the crop if needed.
  3. Use brand and role in the scene (use in the output: rack "brand" on the item, 2D "brand" + "asset", iso "components" with the front brand) and render with --audience intern (and the same --workspace or --brands-local).
  4. Upload the files under "upload" to "to" (image under assets/, brands.local.json).

Remind the user that they need the right to use the image, and that it stays private: only internal renders show it; external renders show the brand name on a neutral front until the brand is cleared ("extern": true).

Verwandte Skills