Run registered ComfyUI workflows through a stable Agent-facing CLI, with prompt enhancement, fail-fast errors, and structured JSON results.
Use this skill when the user asks to:
Do not use this skill when the user only wants prompt writing, brainstorming, or discussion without actual generation.
A ComfyUI server being unavailable is not a reason to skip this skill. Return SERVER_UNAVAILABLE, ask whether ComfyUI is running on the local machine or on another machine, and point the user at check (single health check) and doctor (server health plus per-workflow preflight) to diagnose it.
SKILL.md and scripts/).comfyui-agent-skill-mie / comfyui-skill can be run from any directory.uv run --no-sync python -m comfyui (or uv run --no-sync comfyui-skill) for runtime calls.comfyui-skill (or comfyui-agent-skill-mie) directly; do not wrap with uv run.SERVER_UNAVAILABLE; do not search disk for ComfyUI installs or guess ports.config.local.json unless the user explicitly wants a persistent server URL. For one-off runs, use --server or COMFYUI_URL.reference_to_image, inspect the reference image with Agent vision and create a prompt. Do not upload that reference image to ComfyUI.--image is the image role. liveportrait also needs --video. qwen3_tts_clone needs -p, --text-input "ref_text=...", and --audio. Do not choose those flags from the capability name.--width/ --height only when the workflow config maps both dimensions and does not use size_strategy: "workflow_managed"; always pass both together. Otherwise the CLI returns INVALID_PARAM on both the sync and --submit paths instead of ignoring them.workflow.config.json exists.import-workflow only accepts API format (ComfyUI's Save (API) button, requires Settings → Enable Dev mode options). A plain Save product (UI/Save format, {nodes, links}) is refused with WORKFLOW_NOT_API_FORMAT. To convert existing UI/Save workflows in place, run convert-ui (needs a running ComfyUI + Playwright).Recommended install (tool-install mode):
bash
pipx install comfyui-agent-skill-mie
comfyui-agent-skill-miecomfyui-agent-skill-miecomfyui-skillPrerequisites:
GET /system_stats available.uv.Networking note:
http://127.0.0.1:8188 for same-environment setups.127.0.0.1 may refer to the runtime itself. Try --server http://localhost:8188 or the host machine IP (and optionally persist it via save-server).Initial setup from the skill root:
bash
uv sync
uv run --no-sync python -m comfyui --help
Tool-install mode:
bash
comfyui-agent-skill-mie --help
comfyui-agent-skill-mie check
comfyui-skill --help
comfyui-skill check
Minimal decision tree:
z_image_turbo fallback), but prefer a stronger registered match when workflow guidance indicates one (e.g. posters / anime / artistic styles).qwen_image_2512_4stepanima_turbokrea2_turboreference_to_image prompt → run z_image_turbogenerate --workflow klein_edit --image input_image=... -p "..."sam3_mat_imageliveportraitgenerate --workflow qwen3_tts --speech-text "..." --instruct "..."qwen3_tts_cloneltx_23_t2v_distill (text→video) or ltx_23_i2v_distilled (image→video)User intentWorkflow / modeRequired command shapeText to image (general fallback)z_image_turbo``generate -p "prompt"Poster / embedded text (preferred)qwen_image_2512_4step``generate --workflow qwen_image_2512_4step -p "prompt"Anime / manga / illustrationanima_turbo``generate --workflow anima_turbo -p "prompt"Artistic / painterly realism / concept art / productkrea2_turbo``generate --workflow krea2_turbo -p "prompt"Similar image from referenceAgent vision + T2IRead reference image, create English prompt, then T2IEdit imageklein_edit``generate --workflow klein_edit --image input_image=photo.png -p "edit prompt"Mask / cut out an object (text-driven)sam3_mat_image``generate --workflow sam3_mat_image --image photo.png -p "the cat"Face/expression transfer (photo + video)liveportrait``generate --workflow liveportrait --image face.png --video drive.mp4Text to videoltx_23_t2v_distill``generate --workflow ltx_23_t2v_distill -p "shot prompt"Image to videoltx_23_i2v_distilled``generate --workflow ltx_23_i2v_distilled --image input_image=photo.png -p "motion prompt"Text to musicace_step_15_music``generate --workflow ace_step_15_music -p "music tags"Text to speechqwen3_tts``generate --workflow qwen3_tts --speech-text "..." --instruct "..."Voice cloning (from a sample)qwen3_tts_clone``generate --workflow qwen3_tts_clone -p "new text" --text-input "ref_text=..." --audio sample.mp3
For workflow-specific size rules, capability boundaries, and examples, read references/workflows.md.
Environment doctor (check server + preflight registered workflows):
Tool-install mode:
bash
comfyui-skill doctor
Source mode:
bash
uv run --no-sync python -m comfyui doctor
If it exits with code 0, the environment is ready for all checked workflows. Exit code 1 means missing nodes/models or server is unreachable (see JSON payload).
Health check:
bash
uv run --no-sync python -m comfyui check
Tool-install mode:
bash
comfyui-skill check
Generate an image:
bash
uv run --no-sync python -m comfyui generate -p "a cute cat sitting on a windowsill at golden hour"
Tool-install mode:
bash
comfyui-skill generate -p "a cute cat sitting on a windowsill at golden hour"
Generate with a specific workflow and server:
bash
uv run --no-sync python -m comfyui generate --workflow z_image_turbo --server http://192.168.1.100:8188 -p "a landscape"
Save a persistent server URL only when the user asks for it:
bash
uv run --no-sync python -m comfyui save-server http://192.168.1.100:8188
Preflight a workflow before a long run:
bash
uv run --no-sync python -m comfyui generate --workflow qwen_image_2512_4step --preflight
Show progress for long jobs:
bash
uv run --no-sync python -m comfyui generate --workflow ltx_23_t2v_distill -p "cinematic waves at sunset, slow pan" --progress
Convert UI/Save workflows to API format (opt-in; needs a running ComfyUI + Playwright, does not run inference):
bash
uv run --no-sync python -m comfyui convert-ui path/to/ui_workflow.json --server http://127.0.0.1:8188
uv run --no-sync python -m comfyui convert-ui path/to/workflows_dir -o api_workflows/
Full CLI options, output path behavior, async submit/poll, and error code details are in references/cli.md.
Before generation, convert the user's intent into the right workflow inputs.
TypeRead this fileUse whencharacterreferences/prompt_enhancement/character.mdPortrait, person, character, figure photoreference_to_imagereferences/prompt_enhancement/reference_to_image.mdUser provides a reference image and wants a new similar imageimage_to_imagereferences/prompt_enhancement/image_to_image.mdUser provides an input image and wants to edit ittext_to_speechreferences/prompt_enhancement/text_to_speech.mdUser gives a short voice description and needs full Qwen3-TTS instruction
Reference-to-image flow:
NO_REFERENCE_IMAGE.VISION_UNAVAILABLE.Image-to-image flow:
klein_edit with --image input_image=path.Text-to-speech flow:
qwen3_tts with --speech-text and --instruct; do not use positional prompt.CLI failures are structured JSON on stdout. Agent-only pre-check failures for reference images should also be JSON.
Agent-only error shape:
json
{
"source": "agent",
"success": false,
"error": {"code": "VISION_UNAVAILABLE", "message": "Cannot read reference image in this runtime."}
}
Required fail-fast behavior:
EMPTY_PROMPT.WORKFLOW_NOT_REGISTERED.SERVER_UNAVAILABLE and ask whether ComfyUI is running locally or on another machine.reference_to_image: return Agent error NO_REFERENCE_IMAGE; do not call CLI.reference_to_image: return Agent error VISION_UNAVAILABLE; do not call CLI.NO_INPUT_IMAGE when an image role is absent and NO_INPUT_MEDIA when a video or audio role is absent. If the local path does not exist, handle INPUT_IMAGE_NOT_FOUND or INPUT_MEDIA_NOT_FOUND respectively. Do not report a missing video or audio input as NO_INPUT_IMAGE.MISSING_INPUT.PREFLIGHT_MISSING_NODES or PREFLIGHT_MISSING_MODELS.When the user provides a remote ComfyUI address, save it only if they want persistence:
bash
uv run --no-sync python -m comfyui save-server http://<address>:<port>
Otherwise retry the original command with --server http://<address>:<port>.
After successful generation, present the result to the user. Do not silently parse JSON and stop.
outputs[].path.--output; the CLI writes to a per-job directory under results/ inside the per-user data root and returns exact paths in JSON. The per-user data root is %APPDATA%\comfyui-skill on Windows, ~/Library/Application Support/comfyui-skill on macOS, and $XDG_DATA_HOME/comfyui-skill (or ~/.local/share/comfyui-skill) on Linux. save-server writes config.local.json under that same root. Always use the returned outputs[].path.--count > 1, parse the wrapper object and present each result.See references/cli.md for JSON schemas and output directory rules.
references/prompt_enhancement/ — prompt enhancement instructions.