AgentSkillsCN

comfy-edit

当您需要编辑 ComfyUI 工作流的 JSON 文件、添加节点、连接线路、修改工作流、为工作流添加 ControlNet/LoRA/超分辨率功能,或向 ComfyUI 提交工作流时,可使用此技能。

SKILL.md
--- frontmatter
name: comfy-edit
description: Use when editing ComfyUI workflow JSON, adding nodes, wiring connections, modifying workflows, adding ControlNet/LoRA/upscaling to a workflow, or submitting workflows to ComfyUI.
version: 1.0.0

ComfyUI Workflow Editing

Edit workflow JSON files using the VibeComfy CLI.

Repo: https://github.com/peteromallet/VibeComfy

When working in the repo, see CLAUDE.md for full command reference.

CLI Commands

All edit commands require -o output.json. Use --dry-run to preview changes.

CommandPurpose
trace WF NODEShow node inputs/outputs with slot names
upstream WF NODEFind nodes feeding into target
downstream WF NODEFind nodes fed by source
wire WF SRC_ID SRC_SLOT DST_ID DST_SLOT -o OUTConnect nodes
copy WF NODE -o OUTDuplicate a node
set WF NODE key=val -o OUTSet widget values
delete WF NODE -o OUTRemove nodes
create WF TYPE -o OUTCreate new node
batch WF SCRIPT -o OUTMulti-step edits
submit WFRun workflow in ComfyUI

Tip: Use trace first to find slot numbers, then wire to connect.

Adding Nodes Workflow

  1. Find the node: comfy_search("controlnet") (use comfy-registry skill)
  2. Get the spec: comfy_spec("ControlNetLoader") - see inputs/outputs
  3. Understand the flow: python we_vibin.py trace workflow.json <ksampler_id>
  4. Create and wire:
bash
python we_vibin.py create workflow.json ControlNetLoader -o step1.json
python we_vibin.py trace step1.json <new_node_id>  # Find the slot numbers
python we_vibin.py wire step1.json <src_id> <src_slot> <dst_id> <dst_slot> -o step2.json

Or use batch scripts for multi-step edits (slot names work in batch mode):

bash
create ControlNetLoader as $cn
wire $cn:control_net -> 15:control_net

Common Patterns

What nodes go together. See references/PATTERNS.md for details.

Image Generation

PatternFlow
txt2imgCheckpoint → CLIP (x2) → EmptyLatent → KSampler → VAEDecode → Save
img2imgLoadImage → VAEEncode → KSampler (denoise<1) → VAEDecode → Save
inpaintLoadImage + Mask → VAEEncodeForInpaint → KSampler → VAEDecode

Enhancements

PatternFlow
ControlNetLoadControlNet → ControlNetApply → KSampler
LoRACheckpoint → LoraLoader → KSampler
UpscaleLoadUpscaleModel → ImageUpscaleWithModel → Save
IPAdapterLoadIPAdapter → IPAdapterApply → KSampler

Video

PatternFlow
AnimateDiffCheckpoint → ADE_LoadAnimateDiff → ADE_Apply → KSampler → VHS_Combine
Wan t2vWanModelLoader → WanTextEncode → WanSampler → WanDecode
LTXLTXVLoader → LTXVTextEncode → LTXVSampler → LTXVDecode
v2vVHS_LoadVideo → VAEEncode → KSampler → VAEDecode → VHS_Combine

Flux

PatternFlow
Flux txt2imgUNETLoader + DualCLIPLoader + VAELoader → FluxGuidance → KSampler

Batch Scripts

For multi-step edits, use batch scripts:

bash
# Copy node, assign to variable
copy 1183 as $selector

# Set widgets
set $selector indexes="0:81"

# Wire using slot names
wire 1140:IMAGE -> $selector:image

# Delete nodes
delete 1220 1228

Run with: python we_vibin.py batch workflow.json script.txt -o out.json --dry-run