json-generator

An agent that turns an approved diagram plan into valid Excalidraw JSON. Excalidraw is a drawing format and editor for diagrams such as flowcharts, architecture diagrams, and mind maps.

In plain words
What is it for?
It is for creating diagram elements, labels, positions, colors, arrows, and style settings in a format Excalidraw can open.
Why use it?
It checks that planned elements and connections are complete and correctly referenced before generating the diagram data. This reduces malformed files and missing links between diagram items.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/luongnv89/skills/json-generator
Clone the repo
git clone --depth 1 https://github.com/luongnv89/skills
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 843 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00843
Opus 5 $0.00000 $0.00421
Sonnet 5 $0.00000 $0.00169
Haiku 4.5 $0.00000 $0.00084

Measured 3d ago against content hash c436cf6bef22, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

json-generator scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/diagram-generator/excalidraw-generator/agents/json-generator.md · 82 lines

How it starts

The opening of the file, as written. The whole thing — 82 lines — stays where its author put it; the contents beside it link to each section on GitHub.

JSON Generator Agent

Role: Generate complete, valid Excalidraw JSON from a confirmed diagram plan.

Input

Receive from main agent:

  • diagram_type: Type of diagram (flowchart, architecture, ER, mind map, etc.)
  • elements_list: Array of planned elements with structure:
    [
      { id, type, label, x, y, width, height, fill_color, stroke_color, text_color },
      ...
    ]
    
  • arrows_list: Array of connections:
    [
      { id, from_element_id, to_element_id, label, arrow_type },
      ...
    ]
    
  • style_options: User-selected style (palette, roughness, font)
  • complexity_estimate: Element count for threshold check

Procedure

  1. Validate input completeness

    • All required fields present in elements_list and arrows_list
    • No missing IDs or cross-references
    • If any field missing, request clarification before proceeding
  2. Generate base JSON structure

    • Create root object with type: "excalidraw", version: 2
    • Initialize elements: [], appState: {}, files: {}
  3. Generate element objects

    • For each element in elements_list:
      • Create id (ensure unique)
      • Set type (rectangle, diamond, ellipse, etc.)
      • Place x, y, width, height
      • Add all required fields: angle, strokeColor, backgroundColor, fillStyle, strokeWidth, strokeStyle, roughness, opacity, groupIds, frameId, roundness, isDeleted, boundElements, updated, link, locked, seed
      • For text elements: add text, fontSize, fontFamily, textAlign, verticalAlign, containerId, originalText, lineHeight, autoResize
      • Important: Calculate shape dimensions to fit bound text:
        • Count lines in text: line_count = text.split('\n').length
        • Min text height: line_count * fontSize * 1.25
        • Min shape height: min_text_height + 40 (20px padding)
        • Min shape width: longest line pixel width + 20px
  4. Generate arrow objects

    • For each arrow in arrows_list:
      • Create with type: "arrow"
      • Set startBinding and endBinding with elementId and focus
      • Calculate points array (relative positions: [[0, 0], [dx, dy], ...])
      • Include all required fields
      • Set startArrowhead and endArrowhead (default: "arrow")

Read the full file on GitHub · 82 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 82 lines · 0 tokens per session scan A c436cf6bef22

Subscribe to this mod's changes

json-generator is an agent published in the GitHub repository luongnv89/skills (121 stars, last pushed 3d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 843 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.