/comfy:gen A text description of the image to generatefrom comfy
Generates an image via ComfyUI from a text prompt. Automatically downloads a checkpoint if none are installed, creates a txt2img workflow, enqueues it, and monitors progress in the background.
Ships in comfy. Installing the plugin adds it to Claude Code.
The user wants to generate an image using ComfyUI. Their prompt is provided as the argument to this command.
Parse the user's prompt. The argument after /comfy-gen is the image description: $ARGUMENTS
If no argument was provided, ask the user what they'd like to generate.
Check available models. Use the list_local_models tool with model_type: "checkpoints" to see what checkpoints are installed.
If no checkpoints are installed, acquire one automatically.
Do NOT ask the user to download a model. Instead, find and download one yourself:
Option A: CivitAI (preferred if CIVITAI_API_TOKEN is set):
https://civitai.com/api/v1/models?query=SDXL&types=Checkpoint&sort=Most+Downloaded&limit=5https://civitai.com/api/download/models/{modelVersionId}?token={CIVITAI_API_TOKEN}download_model with target_subfolder: "checkpoints" to download itOption B: HuggingFace (default):
download_model action:"search" to find a suitable checkpoint (e.g., query "SDXL" or "stable diffusion xl").safetensors download URL from the model page (typically https://huggingface.co/{repo}/resolve/main/{filename})download_model with target_subfolder: "checkpoints" to download itSensible defaults by category:
stabilityai/stable-diffusion-xl-base-1.0)Tell the user what you're downloading and why. Large checkpoints can be 2-7 GB.
Create the workflow. Use the create_workflow tool with:
template: "txt2img"params: Include positive_prompt from the user's input. Set checkpoint to the model filename. Use sensible defaults (1024x1024 for SDXL, 20 steps, cfg 8).Enqueue the workflow. Pass the workflow JSON from step 3 to enqueue_workflow(action="enqueue"). This returns immediately with a prompt_id.
Monitor progress in background. Start a background task to track the job:
Bash(run_in_background: true):
node "${CLAUDE_PLUGIN_ROOT}/scripts/monitor-progress.mjs" <prompt_id>
This connects to ComfyUI's WebSocket and prints real-time step progress (e.g., step 3/14 (21%)), then reports completion with output filenames. You do NOT need to poll queue (action:"status"); the background task handles it.
Continue the conversation while waiting. Check the background task output when notified it completed.
If the job fails, the monitor prints error details (node, message). Use get_history(action="diagnose") for the full traceback plus anything missing.
Fallback: If the background script is unavailable, use queue (action:"status") to poll until done is true.
Show the result. Once the background monitor reports completion, use get_image (action:"list_outputs") (limit 1) to find the newest image. Read it with the Read tool to display it to the user.
Open the image. Open the image so the user sees it right away without navigating to the output folder. Use the Bash tool with the appropriate command for the OS:
open /path/to/image.pngxdg-open /path/to/image.pngstart "" "/path/to/image.png"The image will be saved to ComfyUI's output directory (check get_system_stats for the --output-directory arg, or default to ~/Documents/ComfyUI/output/).
When choosing a checkpoint, consider:
get_system_stats. Flux needs ~12GB. SDXL needs ~6GB. SD 1.5 works on ~4GB.If the environment variable CIVITAI_API_TOKEN is available, prefer CivitAI for model discovery because it has:
CivitAI REST API endpoints:
GET https://civitai.com/api/v1/models?query={query}&types=Checkpoint&sort=Most+Downloaded&limit=5GET https://civitai.com/api/v1/models/{modelId}GET https://civitai.com/api/download/models/{modelVersionId}?token={token}Always include the token query parameter when downloading.
User: /comfy-gen a beautiful sunset over mountains with golden light
Steps:
stabilityai/stable-diffusion-xl-base-1.0sd_xl_base_1.0.safetensors to checkpoints foldercreate_workflowWhat the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
npx claudepluginhub artokun/comfyui-mcp --plugin comfy11 commands in this plugin
/batch/comfy-batch — Parameter Sweep GenerationParameter sweep generation across multiple values/compare/comfy-compare — Compare Two WorkflowsDiff two ComfyUI workflows to see what changed/convert/comfy-convert — Convert Workflow FormatConvert between ComfyUI UI format and API format workflows/debug/comfy-debug — Diagnose a Failed WorkflowDiagnose why a ComfyUI workflow failed/director/comfy-director — Story-to-Video Production PipelineDirect a short film from a story. Generates scenes, frames, and video clips/gallery/comfy-gallery — Browse Generated OutputsBrowse and inspect generated ComfyUI outputsOther plugins' commands for the same job