canvas-layout
Skill299 starsChanged 8 months agoMITView on GitHub
Re-layout existing Obsidian Canvas nodes using 6 spatial algorithms: grid (galleries, mood boards), dagre (flowcharts, org charts), radial (mind maps), force-directed (knowledge graphs), linear (timelines), and auto-detect. Preserves group membership, snaps to 20px grid, refits zones around content. Triggers on: canvas layout, re-layout canvas, arrange canvas, auto-layout, organize canvas, fix canvas layout, canvas grid, canvas dagre.
In this repository8 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- canvas-createSkill
- canvas-exportSkill
- canvas-generateSkill
- canvas-populateSkill
- canvas-presentSkill
- canvasSkill
- canvas-templateSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 0 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Read ../canvas/references/layout-algorithms.md for algorithm details and selection guide.
- Very specific: line 16
Read ../canvas/references/performance-guide.md for node limits.
- Very specific: line 22
Identify target canvas: Use the active canvas or ask which one (/canvas list to show options).
- Very specific: line 23
Select algorithm: Use the user-specified algorithm, or run auto detection.
- Very specific: line 31
Validate: Run python3 scripts/canvas_validate.py [canvas_path] to confirm valid output.
- Very specific: line 37
When the user says /canvas layout auto or doesn't specify an algorithm, use the auto-detection in the script.
- Very specific: line 68
Add --dry-run to preview without writing.
- Very specific: line 74
When a canvas has more than 30 nodes, dispatch the canvas-layout agent instead of running the script directly.
- Very specific: line 89
Backup conflict: If .bak already exists, use .bak2, .bak3, etc.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
canvas-layout: Re-Layout Canvas Nodes
Read ../canvas/references/layout-algorithms.md for algorithm details and selection guide.
Read ../canvas/references/performance-guide.md for node limits.
Workflow
- Identify target canvas: Use the active canvas or ask which one (
/canvas listto show options). - Select algorithm: Use the user-specified algorithm, or run
autodetection. - Confirm before applying: Show what will happen: "Will apply [algorithm] layout to [canvas] ([N] nodes, [M] groups). Create backup? [Y/n]"
- Run the layout script:
python3 scripts/canvas_layout.py [canvas_path] [algorithm] [options] - Report results: "Moved [N] of [M] nodes. [G] groups refitted. Backup at [path].bak"
- Validate: Run
python3 scripts/canvas_validate.py [canvas_path]to confirm valid output.
Algorithm Selection
When the user says /canvas layout auto or doesn't specify an algorithm, use the auto-detection in the script. It analyzes edge density, node types, and connection patterns.
For explicit requests, map user intent to algorithm:
| User says | Algorithm | Options |
| "organize these images" | grid | --sort-by type |
| "make a grid" | grid | |
| "flowchart layout" | dagre | --direction TB |
| "left to right flow" | dagre | --direction LR |
| "mind map layout" | radial | |
| "expand from [node]" | radial | --center [node-id] |
| "untangle this" | force | |
| "spread out the nodes" | force | |
| "make a timeline" | linear | --axis horizontal |
| "vertical sequence" | linear | --axis vertical |
| "auto-layout" | auto | |
| "fix the layout" | auto |
Options Forwarding
Pass algorithm-specific options to the script:
- grid:
--columns N(override auto-detection),--sort-by type|size - dagre:
--direction TB|LR|BT|RL - radial:
--center node-id(override auto-detection of hub node) - force:
--iterations N(default 100, reduce to 50 for 50+ nodes) - linear:
--axis horizontal|vertical
Add --dry-run to preview without writing.
For Complex Layouts (30+ Nodes)
When a canvas has more than 30 nodes, dispatch the canvas-layout agent instead of running the script directly. The agent can:
- Analyze the canvas content to choose sub-groups for different algorithms
- Split large canvases into zone-by-zone layouts
- Handle edge crossing minimization that the basic dagre doesn't cover
- Refine positions after the algorithm runs for better visual balance
Edge Cases
- Empty canvas: Report "No nodes to layout" and skip.
- Single node: Center it at (0, 0) and skip.
- No edges + dagre requested: Warn "dagre works best with edges. Using grid instead." Fall back to grid.
- 100+ nodes: Warn about performance. Suggest splitting into sub-canvases.
- Backup conflict: If
.bakalready exists, use.bak2,.bak3, etc.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

