Install
openclaw skills install comfyui-skill-openclawRun ComfyUI workflows from any AI agent (Claude Code, OpenClaw, Codex) via a single CLI. Import workflows, manage dependencies, execute across multiple servers, and track history — all through shell commands. **Use this Skill when:** (1) The user requests to "generate an image", "draw a picture", or "execute a ComfyUI workflow". (2) The user has specific stylistic, character, or scene requirements for image generation. (3) The user asks you to import, register, sync, or configure saved ComfyUI workflows for later reuse.
openclaw skills install comfyui-skill-openclawAs an Agent equipped with the ComfyUI skill, your objective is to translate the user's conversational requests into strict, structured parameters and execute workflows across multi-server environments.
Prerequisites: Install the CLI tool once:
pip install comfyui-skill-cli. All commands must be run from this project's root directory.
| Command | Purpose |
|---|---|
comfyui-skill --json server status | Check if ComfyUI server is online |
comfyui-skill --json list | List all available workflows and parameters |
comfyui-skill --json info <id> | Show workflow details and parameter schema |
comfyui-skill --json submit <id> --args '{...}' | Submit a workflow (non-blocking) |
comfyui-skill --json status <prompt_id> | Check execution status |
comfyui-skill --json run <id> --args '{...}' | Execute a workflow (blocking) |
comfyui-skill --json deps check <id> | Check missing dependencies |
comfyui-skill --json deps install <id> --repos '[...]' | Install missing custom nodes |
Skill IDs use the format <server_id>/<workflow_id> (e.g., local/txt2img).
If the user asks you to open, launch, or bring up the local Web UI for this skill, run:
python3 ./ui/open_ui.py
This command will:
Before running a workflow, check whether the target ComfyUI server is online:
comfyui-skill --json server status
This returns JSON with "status": "online" or "status": "offline".
Recommended agent flow: Before Step 3 (Trigger Image Generation), run a server status check. If offline, ask the user to start ComfyUI and retry once it is online.
Use the manager UI/API when the user wants to register workflows into this skill instead of running them immediately.
/userdata, local files, manager API routes, and import result semantics, read references/workflow-import.md.If the user provides you with one new ComfyUI workflow JSON (API format) and asks you to "configure it" or "add it":
local../data/<server_id>/<new_workflow_id>/workflow.json.inputs inside node definitions, e.g., KSampler's seed, CLIPTextEncode's text for positive/negative prompts, EmptyLatentImage for width/height)../data/<server_id>/<new_workflow_id>/schema.json. The schema format must follow:
{
"workflow_id": "<new_workflow_id>",
"server_id": "<server_id>",
"description": "Auto-configured by Agent",
"enabled": true,
"parameters": {
"prompt": { "node_id": "3", "field": "text", "required": true, "type": "string", "description": "Positive prompt" }
}
}
Before attempting to generate any image, you must first query the registry to understand which workflows are currently supported and enabled:
comfyui-skill --json list
Return Format Parsing:
You will receive a JSON array containing all available workflows. Each is uniquely identified by the combination of server_id and workflow_id (or path format <server_id>/<workflow_id>):
required: true, if the user hasn't provided them, you must ask the user to provide them.required: false, you can infer and generate them yourself based on the user's description (e.g., translating and optimizing the user's scene), or simply use empty values/random numbers (e.g., seed = random number).Once you have identified the workflow to use and collected/generated all necessary parameters, you need to assemble them into a compact JSON string.
For example, if the schema exposes prompt and seed, you need to construct:
{"prompt": "A beautiful landscape, high quality, masterpiece", "seed": 40128491}
If critical parameters are missing, politely ask the user. For example: "To generate the image you need, would you like a specific person or animal? Do you have an expected visual style?"
Before executing a workflow, always run a dependency check to verify that all required custom nodes and models are available on the ComfyUI server:
comfyui-skill --json deps check <server_id>/<workflow_id>
Return format:
{
"is_ready": false,
"missing_nodes": [
{"class_type": "SAMDetectorCombined", "can_auto_install": false}
],
"missing_models": [
{"filename": "model.safetensors", "folder": "checkpoints", "loader_node": "CheckpointLoaderSimple", "node_id": "4"}
],
"total_nodes_required": 12,
"total_nodes_installed": 11
}
Agent behavior:
is_ready is true → proceed to Step 3 directly.is_ready is false → present the dependency report to the user in a clear, formatted message:
comfyui-skill --json deps install <server_id>/<workflow_id> --repos '["https://github.com/repo1", "https://github.com/repo2"]'
Use the source_repo URLs from the dependency check report as --repos values. This returns installation results for each package. Report the results to the user.
needs_restart is true, inform the user that ComfyUI needs to restart for changes to take effect.check-deps to confirm everything is resolved, then proceed to Step 3.model.safetensors and place it in the checkpoints folder").Once the complete parameters are collected and the dependency check passes, execute the workflow.
Note: Outer curly braces must be wrapped in single quotes to prevent bash from incorrectly parsing JSON double quotes.
There are two execution modes. Choose based on your environment:
submit + status so you can send progress updates between polls.submit + statusStep 3a — Submit the job:
comfyui-skill --json submit <server_id>/<workflow_id> --args '{"key1": "value1", "key2": 123}'
Returns immediately:
{"status": "submitted", "prompt_id": "91f87917-3b0b-4d0f-8768-356f8d18c2e6"}
After receiving the response, tell the user that image generation has started.
Step 3b — Poll for progress:
comfyui-skill --json status <prompt_id>
Returns immediately with the current state:
{"status": "queued", "prompt_id": "...", "position": 2} — waiting in line{"status": "running", "prompt_id": "..."} — ComfyUI is actively generating{"status": "success", "prompt_id": "...", "outputs": [{"filename": "ComfyUI_00001_.png", "subfolder": "", "type": "output"}]} — done{"status": "not_found", "prompt_id": "..."} — job not found in queue or history{"status": "error", "prompt_id": "...", "error": "..."} — generation failedPolling pattern — this is critical for real-time feedback:
Each status call must be a separate tool invocation (i.e., a separate bash command). Do NOT write a shell loop or combine multiple status checks into one command. The correct pattern is:
status as a standalone bash command."queued" or "running": send a text message to the user with the current progress (e.g., "Queued at position 2…", "Generating…"), then run status again as another standalone bash command."success": proceed to Step 4."error": report the error.This ensures each progress update is delivered to the user immediately, rather than being batched at the end.
comfyui-skill --json run <server_id>/<workflow_id> --args '{"key1": "value1", "key2": 123}'
Blocks until ComfyUI finishes, then returns the full result:
{"status": "success", "prompt_id": "...", "outputs": [{"filename": "ComfyUI_00001_.png", "subfolder": "", "type": "output"}]}
Result format (both modes):
prompt_id and an outputs array containing ComfyUI output file references (filename, subfolder, type).error code and message.The manager stores execution history per workflow, including raw args, resolved args, prompt ID, result files, status, timing, and error summary. History records live under data/<server_id>/<workflow_id>/history/.
Once you obtain the output filenames from the result, use your native capabilities to present the files to the user (e.g., in an OpenClaw environment, returning the path allows the client to intercept it and convert it into rich text or an image preview).
comfyui-skill --json server status and ask the user to start the ComfyUI service before retrying.comfyui-skill --json list and tell the user they need to first go to the Web UI panel to upload and configure the mapping for that workflow on the desired server.--args is a valid JSON string wrapped in single quotes.