算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
excalidraw-generator【设计与创意】Generate diagrams as valid Excalidraw JSON — flowcharts, architecture, ER diagrams, mind maps, sequence diagrams, wireframes, C4 models, and more. Don't use for draw.io/Mermaid output, slide decks, or pixel-perfect brand graphics.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Generate professional diagrams as valid Excalidraw JSON. Every request flows through four phases — Understand, Propose, Generate, Validate — before the file is written. The body stays lean to respect the agent's context budget; depth lives in references/.
Part of the diagram-generator suite. For precise, editable-in-draw.io output, use
drawio-generatorinstead; thediagram-generatorumbrella routes between the two.
The frontmatter description sets triggers and exclusions. Output: a .excalidraw file, plus a companion .md only on request.
If the Agent tool is available, use subagents per Subagent Architecture for large diagrams; fresh-context validation avoids single-pass context overflow. Without it (e.g., Claude.ai), run every phase inline and self-review against the 10 checks.
Run this once: before reading an existing .excalidraw file (Iteration), otherwise before the Phase 4 write. The sync target is the output file's directory.
repo="$(git -C "<output dir>" rev-parse --show-toplevel)". If it fails, skip the sync and record sync: skipped (not a git repo).git -C "$repo" remote get-url origin. If it fails, skip steps 3–7 and record sync: skipped (no origin).branch="$(git -C "$repo" rev-parse --abbrev-ref HEAD)". If it prints HEAD, skip steps 4–7 and record sync: skipped (detached HEAD).git -C "$repo" status --porcelain. If the output is empty, run git -C "$repo" fetch origin && git -C "$repo" pull --rebase origin "$branch".git -C "$repo" stash push -u -m "excalidraw-generator pre-sync", then the same fetch and pull, then git -C "$repo" stash pop.fetch or pull fails before a rebase starts (network, authentication, or a missing remote branch), do not retry. Run git -C "$repo" stash pop when step 5 stashed, record sync: failed (<first error line>), and continue. The Final Report repeats it on the Uncertainty: line.git -C "$repo" rebase --abort, then git -C "$repo" stash pop when step 5 stashed. If the stash pop conflicts, leave the stash in place. In both cases do not write the file; stop and ask the user how to continue. With no answer, the status is BLOCKED.This skill commits nothing.
Confirm what to draw before generating anything.
references/diagram-types.md).Present the numbered plan below.
roughness: 1, Virgil font (fontFamily: 1), best-fit layout.references/diagram-types.md; offer numbered alternatives if several fit.(A) Top-to-bottom, (B) Left-to-right, (C) Radial.references/style-and-iteration.md. No fixed palette.Compose the .excalidraw document in memory (raw JSON, no wrapper). Phase 4 writes the file.
Output path: use the path the user gave. Otherwise use a descriptive kebab-case name ending in .excalidraw (auth-flow.excalidraw) in the current working directory. If that file exists and the user did not ask to update it, confirm with the user before you overwrite it; to update it, follow Iteration.
Start from the envelope in references/excalidraw-format.md → Top-Level Structure (type, version, source, elements, appState, files); set theme and viewBackgroundColor to suit the diagram. That file holds the full element schema and field defaults.
Critical rules every element must follow:
references/validation-checks.md → Check 2.node-api-gateway).fontSize: 16.containerId ↔ boundElements, startBinding/endBinding ↔ boundElements).Embedding in Markdown: only when asked, write the .excalidraw file first, then a companion .md holding the same JSON in a fenced block tagged excalidraw.
Run all 10 checks on the in-memory JSON before writing the file. See references/validation-checks.md for checks, the Check 10 formula, and fixes.
COMPLETE.PARTIAL with the failed check numbers.BLOCKED with the failed checks.The 10 checks: (1) JSON envelope, (2) required fields, (3) unique IDs, (4) text bindings, (5) arrow bindings, (6) arrow points, (7) overlaps, (8) semantic completeness, (9) readable text, (10) shape-to-text fit — the most common failure.
For "draw a flowchart of the user login process": a login-flow.excalidraw file written to disk (raw JSON), then the Final Report. A bound shape-and-label pair is in references/excalidraw-format.md → Minimal bound-text example.
End every run, stops included, with this compact text block. A Phase 1–2 question that awaits the user's answer does not end the run; if the user ends the run without answering, report BLOCKED. Status is COMPLETE (file written, 10/10 checks pass), PARTIAL (file written, a check from 7–10 failed), or BLOCKED (no file written). Fill rules, PARTIAL and BLOCKED examples, and reader checks: references/final-report.md. Example:
Result: COMPLETE. Wrote login-flow.excalidraw (6 shapes, 6 text labels, 5 arrows).
Evidence: /abs/path/login-flow.excalidraw. Validation 10/10 checks passed (inline, 1 cycle). sync: skipped (not a git repo)
Uncertainty: Rendering in Excalidraw untested. Assumed top-to-bottom flow; the request gave no direction.
Decision: No approval needed.
Verify these for every run:
.excalidraw file is written to disk and its JSON parses with top-level type, version, elements, appState, files, unless the status is BLOCKED.references/validation-checks.md pass, or the Final Report lists each failed check.Result: and its status, and has Evidence:, Uncertainty: and Decision: lines. Evidence: cites only checks that ran; 10/10 appears only when all 10 passed.references/final-report.md (result findable, facts and assumptions separated, claims traceable, next decision clear). Without a human reviewer's answer, human understanding is unconfirmed.references/diagram-types.md..excalidraw file: follow Iteration — never regenerate it from scratch.More edge cases: references/style-and-iteration.md.
After each phase, print a short status report with that phase's checks; the template and per-phase checks are in references/step-reports.md. The Validate report precedes the Final Report; it does not replace it.
When iterating on an existing diagram, read the file and modify the JSON in memory. Preserve element IDs that haven't changed (request patterns: references/style-and-iteration.md → Iteration). Run Phase 4 on the result before rewriting the file; a BLOCKED result leaves the original file untouched.
Large diagrams (>30 elements) run this loop; others run inline. Detail: references/style-and-iteration.md → Subagent Architecture.
agents/json-generator.md with the confirmed plan.agents/json-validator.md; it reports PASS/FAIL for all 10 checks.agents/json-fixer.md, which patches and never regenerates. If it returns ready_for_validation: false (check 1 or 8), re-spawn the generator instead. Each fix or regeneration is one cycle; stop at 3.