tldraw-json-to-tldr
Setup
The generator script gen-tldr.mjs must be present in the user's project. Typical locations:
scripts/gen-tldr.mjs(if repo was cloned directly)skills/tldraw-json-to-tldr/scripts/gen-tldr.mjs(if installed as a subdirectory)
Before running commands, locate gen-tldr.mjs in the project with a file search.
Quick Workflow
- Locate
gen-tldr.mjsin the project directory. - If not found, run bootstrap:
node skills/tldraw-json-to-tldr/scripts/bootstrap-project.mjs --target .node "$HOME/.claude/skills/tldraw-json-to-tldr/scripts/bootstrap-project.mjs" --target .(Bash/Zsh)node "$env:USERPROFILE/.claude/skills/tldraw-json-to-tldr/scripts/bootstrap-project.mjs" --target .(PowerShell)
- Locate input JSON (default:
.diagrams/diagram.json). - Run the generator script.
- Validate that output is valid JSON.
- If blank canvas is reported, run doctor (bootstrap + workspace cache reset):
node "$env:USERPROFILE/.claude/skills/tldraw-json-to-tldr/scripts/doctor-vscode-tldraw.mjs" --target . --reset-workspace-cache(PowerShell)node "$HOME/.claude/skills/tldraw-json-to-tldr/scripts/doctor-vscode-tldraw.mjs" --target . --reset-workspace-cache(Bash/Zsh)
- Re-open file in VS Code and verify shapes are visible.
Commands
Use the actual path where gen-tldr.mjs was found. Examples for each layout:
# Bootstrap current project if script/config is missing:
node skills/tldraw-json-to-tldr/scripts/bootstrap-project.mjs --target .
node "$HOME/.claude/skills/tldraw-json-to-tldr/scripts/bootstrap-project.mjs" --target . # Bash/Zsh
node "$env:USERPROFILE/.claude/skills/tldraw-json-to-tldr/scripts/bootstrap-project.mjs" --target . # PowerShell
# If canvas is still blank in this workspace:
node "$env:USERPROFILE/.claude/skills/tldraw-json-to-tldr/scripts/doctor-vscode-tldraw.mjs" --target . --reset-workspace-cache # PowerShell
node "$HOME/.claude/skills/tldraw-json-to-tldr/scripts/doctor-vscode-tldraw.mjs" --target . --reset-workspace-cache # Bash/Zsh
# If scripts/ is at project root:
node scripts/gen-tldr.mjs --in .diagrams/diagram.json --out .diagrams/diagram.tldr
node scripts/gen-tldr.mjs --smoke --out .diagrams/smoke-test.tldr
# If installed as a subdirectory:
node skills/tldraw-json-to-tldr/scripts/gen-tldr.mjs --in .diagrams/diagram.json --out .diagrams/diagram.tldr
Input Format
title: string— diagram titlenodes: [{ id, label, group }]— nodes with group-based column layoutedges: [{ from, to, label }]— arrows between nodes
Output Contract
The generated .tldr file uses:
tldrawFileFormatVersion: 1schema.schemaVersion: 2props.richText(ProseMirror format, NOT legacyprops.text)- Full
schema.sequenceswith allcom.tldraw.*migration keys - Required base records:
document:document,page:page,camera:page:page
Troubleshooting
- Generate smoke file and open it first.
- If smoke file is visible but main diagram is blank, regenerate main output from JSON.
- If both are blank, use VS Code
Developer: Reload Windowand re-open. - Never use legacy
props.text— always useprops.richText. - Never reduce
schema.sequencesto empty — all keys are required. - Keep
.diagrams/diagram.jsonin UTF-8 (without BOM) and standard double quotes.
Shape Property Reference
geo shape props
geo, dash, url, w, h, growY, scale, labelColor, color, fill, size, font, align, verticalAlign, richText
arrow shape props
kind, labelColor, color, fill, dash, size, arrowheadStart, arrowheadEnd, font, start, end, bend, richText, labelPosition, scale, elbowMidPoint
text shape props
richText, size, font, textAlign, color, w, scale, autoSize