agentsclimarketplace

Diagram generator

Skill garygentry/agent-docs/skills/diagram-generator

Generate rich, professional diagrams as SVG (and PNG) images instead of ASCII art. Use whenever the user asks to create a diagram, visualize architecture, draw a system design, create a flowchart, illustrate data flow, map out infrastructure, show how something works, or produce any technical visual — including sequence diagrams, ER diagrams, network topologies, pipeline flows, state machines, and deployment architectures. Even if the user says "ASCII diagram", produce an image with this skill.From its SKILL.md

Install
npx -y skills add garygentry/agent-docs --skill diagram-generator

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

9.7 KB, as published. Nobody here has run it

diagram-generator

Turn a natural-language request into a polished, tier-2-portable diagram image. You author an engine-neutral DiagramSpec JSON from the user's prose, then invoke the bundled renderer CLI. There is no separate natural-language renderer — both the conversational path (you, from prose) and the scriptable path (a build step, from a committed file) converge on the same CLI execution path. The only difference is who produces the DiagramSpec.

When to use

Use for ANY request to visualize, draw, diagram, illustrate, or show how a system, flow, or relationship works. Six diagram types are supported: architecture, flowchart, sequence, er, state, dataflow.

Reference docs (read before authoring)

  • references/schema-guide.md — the human-readable DiagramSpec reference: every field, the six diagramType values, the closed NodeRole vocabulary, the sequence-only participants/messages fields, the diagramType↔field-agreement rules, and a worked JSON example per type. This is your authoring reference for step 2 below.
  • references/diagram-craft.md — the craft rules a good diagram honors: the role→color taxonomy, z-order (arrows behind boxes), legend placement, and spacing. Use it to choose roles and structure that render well.

Conversational procedure

When a user asks for a diagram:

  1. Elicit / confirm the diagram type and the concrete elements the user described — components, connections, groupings (or participants and ordered messages for a sequence diagram). Do not interrogate; infer the obvious and confirm only what is genuinely ambiguous.
  2. Translate prose → a DiagramSpec JSON conforming to the schema (references/schema-guide.md): nodes/edges/containers for graph types, or participants/messages for sequence. Assign each node a semantic role from the closed NodeRole taxonomy only where the user's description implies one (a "Postgres database" → database; an unqualified "service" → omit role).
  3. Keep the interim spec out of the user's repo. The DiagramSpec JSON is a throwaway intermediate — only the final rendered image is a deliverable.
    • Single SVG → pipe via stdin, write no file at all: build the spec and pipe it to the CLI with - (… | diagram-render -), capturing the SVG from stdout.
    • PNG, both, or multi-theme → write the spec under a system temp dir (mktemp -d, or /tmp/diagram-spec.json), never the working tree. Reserve a repo-relative spec path only for the deliberate committed build-step workflow, where src/diagrams/*.json is intentionally version-controlled (e.g. doc-site's diagrams component). Ad-hoc/conversational diagrams must not add spec files to the user's repo.
  4. Invoke the bundled CLI at skills/diagram-generator/scripts/diagram-render.mjs (or the adapter-relative path under the running target) with the appropriate flags — the exact same contract a build step uses (see "Scriptable invocation" below).
  5. Visually inspect the output before declaring success (#16). Render at least the SVG (or a PNG via --format both) and look at it — do not assume it is correct. Open the image and sanity-check:
    • Fills: role-colored nodes are solid cards by default (dark-tint fill + vivid border + same-hue label) and match their legend swatches. Pass --fill-style translucent to soften over a transparent host, or --fill-style transparent for outline-only nodes.
    • Cards & panel: by default nodes are rounded cards with a soft drop shadow (--card-style flat for square/shadowless) on an opaque, rounded, bordered theme panel. Pass --background transparent only when the diagram must blend into the host surface (it then loses the panel framing).
    • Legend: placed automatically — a bottom row for wide/horizontal diagrams, a right column for tall ones. Force it with --legend right|bottom, or drop it with --legend none.
    • Margins: content is not flush against the canvas edge (default --padding handles this; raise it if cramped).
    • Aspect ratio / legibility: the diagram is not an unreadable ultra-wide or ultra-tall strip. The CLI prints a warning: to stderr when the ratio exceeds ~6:1 — heed it and pass --direction TB/LR (or restructure) for long flows.
    • PNG text: if you produced a PNG, confirm labels actually render (not blank).
    • Background: opaque rounded panel by default — pass --background transparent when the diagram should blend into the host surface instead.
    • Font: SVGs use a system font stack by default (small, crisp on web/docs). For an artifact that must render byte-identically offline (Inkscape, Office, PDF), pass --embed-font true to bake in the subset font (~20 KB). PNGs always embed.
  6. Report the written artifact path(s) on success. On a non-zero exit, surface the CLI's stderr verbatim to the user, correct the spec, and re-invoke.

Embedding on light/dark surfaces

A single SVG bakes one theme's colors and cannot self-adapt to light/dark (GitHub strips <style>/media queries). For host surfaces that switch themes, render a light + dark pair and embed them with a <picture> element — see references/embedding.md.

REQ-IN-03 — depict only what the user described

Depict only what the user described. Never invent semantic content, components, or architecture the user did not state. Do not add implied databases, assumed gateways, caches, load balancers, queues, or "typical" components to make the diagram look complete. The schema validates structural well-formedness, not semantic faithfulness — this prompt discipline is the only thing that keeps the diagram true to the request.

  • ✅ User: "a web app talking to an API" → two nodes (webapp → api) and one edge. Nothing else.
  • ❌ Do not add a database, cache, or gateway node the user never mentioned, even if such a system "usually" has one.

If the user's description is genuinely incomplete and a component seems necessary, ask — do not silently fill it in.

Scriptable invocation (mode parity)

The conversational path and the non-interactive scriptable path are both P0 and converge on this one CLI. The CLI contract is frozen and versioned (--version prints CONTRACT_VERSION); consumers such as doc-site pin against it.

diagram-render <input.json | -> [options]

  --type   <architecture|flowchart|sequence|er|state|dataflow>  override spec.diagramType
  --theme  <light|dark>     default: spec.theme (else "light")
  --accent <#rrggbb>        override spec.accent (validated as #rrggbb)
  --background <transparent|opaque|#rrggbb>  default: "opaque" (rounded, bordered theme panel)
  --direction <LR|TB|RL|BT>  override layout direction (graph types) to tame long flows
  --padding <px>            uniform canvas margin around content (default 20)
  --fill-style <translucent|solid|transparent>  role-shape fill; default "solid" (opaque card)
  --card-style <elevated|flat>  node treatment; default "elevated" (rounded + drop shadow)
  --legend <auto|right|bottom|none>  legend placement; default "auto" (bottom for wide, right for tall)
  --embed-font <true|false>  embed the subset font for offline-identical SVGs; default false (system stack)
  --format <svg|png|both>   default: "svg"
  --out-file <path>         explicit output path (highest precedence)
  --out-name <base>         base name written into --out-dir (overrides slug)
  --out-dir  <dir>          directory for derived/named artifacts; default <slug>.<theme>.<ext>
  --version                 print CONTRACT_VERSION, exit 0
  -                         read spec JSON from stdin; with no output target → SVG to stdout

Output-path precedence (highest → lowest): --out-file > --out-dir + --out-name > --out-dir + <slug> > stdout. A png/both format with no resolved file target is refused (binary must not stream to stdout). Writes are confined to the caller-specified directory. Exit 0 on success; distinct non-zero codes per failure class with a stderr message and no partial writes.

Examples:

# Ad-hoc, preferred: stdin → stdout, no file touches the repo (single SVG)
build_spec | node skills/diagram-generator/scripts/diagram-render.mjs - > /tmp/diagram.svg

# Ad-hoc, PNG/both/multi-theme: spec in a temp dir, image to the user's chosen path
node skills/diagram-generator/scripts/diagram-render.mjs "$(mktemp -d)/spec.json" \
    --format both --out-file ~/Desktop/arch.svg   # → arch.svg + arch.png

# Committed build-step ONLY: repo-relative spec is intentionally version-controlled
node skills/diagram-generator/scripts/diagram-render.mjs src/diagrams/arch.json \
    --type architecture --format both --out-file out/arch.svg   # → out/arch.svg + out/arch.png

# Pin the contract version
node skills/diagram-generator/scripts/diagram-render.mjs --version   # → 1.0.0

Because both modes run the identical bundled CLI, behavior is the same regardless of which of the five agent targets runs the skill.

Keep looking

Skills are one crate of 607,533. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.