comfy-workflow-layout
БесплатноБез исполняемых скриптовНе проверенAuto-layout a ComfyUI workflow JSON with a layered DAG algorithm. Use when a workflow's nodes overlap, are messy or cramped, or were imported and need tidying…
от laurigates★ 61 звезда на GitHubОб этом скилле
ComfyUI workflow auto-layout
scripts/layout_workflow.py runs a layered (Sugiyama-style) DAG layout
over the nodes in a workflow JSON: median layering (each node sits at
the midpoint between its earliest and latest possible depth, so source
and sink nodes spread across columns instead of piling up at the edges),
a barycenter sweep within each layer to reduce edge crossings, and a
group-cohesion post-pass that clusters members of the same authored
group contiguously within each column. Group bounding boxes are re-fit
around their final members. Pure stdlib, no deps. Visual goal is "the
editor is readable again with comparable density to a hand-tuned
layout" — link routing is left to ComfyUI.
In practice on Wan 2.2 workflows in this install, output bounding-box area ranges from −13% to +23% of a hand-arranged layout (typically within ±10%), with 0 node overlaps. Without median layering it would be 2× larger.
When to Use This Skill
| Use this skill when... | Use instead when... |
|---|---|
| A workflow's nodes overlap, are messy/cramped, or were imported and need tidying | Editing the graph's wiring/links -> comfy-workflow-json |
Pipeline (default mode)
- Detect group membership by which nodes' centers sit in each group's authored bounding box. Tie-break to the smallest group.
- Absorb leaf singletons — ungrouped nodes whose neighbors are ≥2/3 in one group join that group's membership for layout purposes. Single-pass; central hub nodes (whose connections fan out across many groups) stay as singletons.
- Median layering — each node's column index is the average of its longest-path-from-sources and longest-path-from-sinks depth. Source nodes whose only consumer is at depth 8 land near depth 7, not 0. Sink nodes whose only producer is at depth 1 land near 1.
- Barycenter sweep within each layer to minimize edge crossings.
- Group-cohesion clustering — within each layer, re-permute so nodes sharing a group sit contiguously. Cluster order within a layer follows each cluster's median barycenter index.
- Vertically center each column around the layer band's midpoint so short columns float to center rather than top-align.
- Recompute group bounding boxes to wrap the final positions
(skip with
--no-groups).
--strict-groups switches to a two-level mode where each group becomes
its own bounded super-node region with a separate outer DAG between
groups. Looser packing (typically +30-50% area) but stronger visual
separation between groups; reach for it when the user prefers visible
group containers over compactness.
When to reach for this
- User pulled a workflow from somewhere and the nodes overlap.
- A workflow grew organically and is now unreadable in the editor.
- After bulk-editing a graph (added a Phantom tail, swapped sampler versions, refactored loaders) and the layout no longer reflects flow.
- User says "auto-arrange", "lay out", "clean up positions", or references the script by name.
Skip this for ~5–8 node workflows — hand-arrange is faster and the result will be tidier than what a layered algorithm produces on a tiny graph.
Default invocation (safe A/B)
From the install root, run the script via the venv on the target file:
.venv/bin/python scripts/layout_workflow.py user/default/workflows/2026-05/<file>.json
This writes <file>-laidout.json next to the original. Open both in
ComfyUI side-by-side (or load one, eyeball, then load the other) and
confirm the laid-out version is actually better before committing to
overwrite. ComfyUI picks up the new file on page reload — no service
restart needed.
The script prints a one-line summary on completion
(42 nodes (cohesion, 3 absorbed), 13 layers, 7 groups recomputed -> ...).
Pass --quiet to suppress it. In --strict-groups mode the summary
shape is different (42 nodes in 8 supers (7 group + 1 singleton (3 absorbed)), 5 outer layers, ...).
Tune the spacing
Defaults are --col-gap 40 (pixels between layers) and --row-gap 20
(pixels between nodes within a layer). If the output looks cramped,
raise the gaps. If sparse, lower them.
.venv/bin/python scripts/layout_workflow.py --col-gap 60 --row-gap 30 \
user/default/workflows/2026-05/<file>.json
Useful starting points: 30/15 for tight, 40/20 default, 60/30 for roomy,
80/40 for very large workflows where the user wants whitespace. In
--strict-groups mode the inner gap uses these values; the outer
between-groups gap is fixed at 60×80 (source constants SUPER_COL_GAP
/ SUPER_ROW_GAP).
Mode flags
.venv/bin/python scripts/layout_workflow.py --strict-groups <file>.json
Two-level group-aware layout: each group renders as its own bounded region in a separate outer DAG. Looser packing, stronger group separation. Use when the user wants visible group containers more than compactness.
.venv/bin/python scripts/layout_workflow.py --no-cohesion <file>.json
Skip the
Установить comfy-workflow-layout в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Bash(mv *)ReadGrepGlobFAQ
Что делает скилл comfy-workflow-layout?
Auto-layout a ComfyUI workflow JSON with a layered DAG algorithm. Use when a workflow's nodes overlap, are messy or cramped, or were imported and need tidying before use.
Как установить скилл comfy-workflow-layout?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл comfy-workflow-layout запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic