Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

comfy-workflow-json

БесплатноБез исполняемых скриптовНе проверен

Programmatically edit ComfyUI workflow JSON: edge-list link rebuilds, link-encoding schemas, preserving the extra block (App Mode config). Use when a workflow…

laurigatesот laurigates★ 61 звезда на GitHub

Об этом скилле

comfy-workflow-json

Workflow JSONs routinely exceed a Read tool's size limit (a moderately complex workflow can be 25k+ tokens). Don't chunk-read or hand-edit large workflow files — write a Python transform script that uses json.load / json.dump.

When to Use This Skill

Use this skill when... Use instead when...
A workflow JSON is too large to hand-edit, or you're splicing/rewiring nodes programmatically Auto-arranging node positions -> comfy-workflow-layout
A round-trip transform is silently dropping App Mode or canvas state Deciding whether to use a subgraph/Blueprint/App Mode at all -> comfy-subgraphs-app-mode

Edge-list rebuild — mutate links without hand-surgery

In-place link surgery (patching the flat links array and every node's inputs[].link / outputs[].links by hand) is error-prone — the silent-failure mode is a link id present in one place but not the other. The robust alternative:

  1. Extract edges to plain dicts: [{src, src_slot, dst, dst_slot, type}] from wf['links'].
  2. Mutate that edge list (redirect an edge's dst to a new node, drop edges touching a deleted node, append new edges) and add/remove nodes from wf['nodes'].
  3. Rebuild authoritatively: clear every node's inputs[].link → None and outputs[].links → [], then re-number all edges 1..N into wf['links'] and re-populate both endpoints' link refs from the edge list. Set last_link_id / last_node_id.

dst_slot indexes the node's inputs array (widget entries included); src_slot indexes outputs. New nodes get id = max(existing)+1. To insert node X between src and Target.model: find the edge with dst==Target, dst_slot==0, repoint its dst to X, then append X→Target.model. This keeps the socket-array / links-table invariant correct by construction.

Don't template off a live working JSON

A reference/comparison builder must clone a clean, stable template, not a workflow the user actively edits in the UI. A file you generated earlier can be silently reshaped between sessions (extra LoRAs, a swapped VAE-decode, a converted negative) — basing new variants on it inherits that drift and breaks structural assumptions a from-scratch builder made (e.g. a ConditioningZeroOut lookup can raise if the template gained unexpected nodes). Pick one canonical clean template, hardcode the per-variant deltas, and never read a user's live working copy as a template.

Running the workflow after editing it

To execute a workflow JSON headlessly (queue it, poll, collect outputs) without the browser, see the comfyui-pack-live-smoke skill's headless-API section. This is the fastest way to verify an edited or built workflow actually runs — the gold-standard check beyond JSON link-integrity validation.

Authoritative schema

The exact format ComfyUI validates against is the frontend's zod schema — there is no published JSON Schema. If uncertain about a field, extract the schema from the frontend's own sourcemap rather than guessing (see comfyui-node-authoring's sourcemap-verification recipe):

FE=<comfyui-root>/.venv/lib/python3.10/site-packages/comfyui_frontend_package/static/assets
python3 -c "import json,glob; m=json.load(open(glob.glob('$FE/api-*.js.map')[0])); i=m['sources'].index('../../src/platform/workflow/validation/schemas/workflowSchema.ts'); print(m['sourcesContent'][i])" > workflowSchema.ts

Re-extract after a frontend bump (the bundle hash changes) and keep the extracted file checked in with a provenance note, so uncertain transforms have a fast source of truth without re-extracting every time.

Schema facts that drive transforms:

  • Two top-level versions. version: 0.4 → zComfyWorkflow; version: 1 → zComfyWorkflow1. They differ in link encoding and graph-state fields (see table below). A frontend can emit either — don't hardcode an assumption about which one you'll see.
  • .passthrough() everywhere. Unknown keys are preserved, not rejected. json.load→mutate→json.dump is safe; the schema won't strip fields you don't touch (this is why preserving extra works for free).
  • id/slot fields accept strings or ints (zNodeId, zSlotIndex). GroupNode hacks node ids to "<id>:<i>" strings, and subgraph slot ids are UUIDs. Don't assume integer node ids.
  • widgets_values is array or object (zWidgetValues = array | record). Most core nodes use the positional array; some use a keyed record. Index-based widget edits break on the record form.

Link encoding by version

Where Format
Top-level links, 0.4 (zComfyLink) tuple [id, origin_id, origin_slot, target_id, target_slot, type]
Top-level links, v1 (zComfyLinkObject) dict {id, origin_id, origin_slot, target_id, target_slot, type, parentId?}
Subgraph-internal links (any host version) dict zComfyLinkObject — subgraph definitions always follow t
Полный SKILL.md на GitHub

Установить comfy-workflow-json в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Grep
Glob
Write
Edit

FAQ

Что делает скилл comfy-workflow-json?

Programmatically edit ComfyUI workflow JSON: edge-list link rebuilds, link-encoding schemas, preserving the extra block (App Mode config). Use when a workflow JSON is too large to hand-edit or a transform drops state.

Как установить скилл comfy-workflow-json?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл comfy-workflow-json запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить comfy-workflow-json с