comfyui
Node-based graphical interface for Stable Diffusion workflows. Build complex image generation pipelines by connecting nodes visually. Supports custom nodes, ControlNet, LoRA, upscaling, and advanced workflows with full control over the diffusion process.
What this skill does
# ComfyUI
## Installation
```bash
# install.sh — Clone and set up ComfyUI
git clone https://github.com/comfyanonymous/ComfyUI.git
cd ComfyUI
# Install dependencies (NVIDIA GPU)
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu121
pip install -r requirements.txt
# Start the server
python main.py --listen 0.0.0.0 --port 8188
# Visit http://localhost:8188
```
## Model Setup
```bash
# setup_models.sh — Download and place models in the correct directories
cd ComfyUI
# SDXL base model
wget -P models/checkpoints/ \
"https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors"
# VAE
wget -P models/vae/ \
"https://huggingface.co/stabilityai/sdxl-vae/resolve/main/sdxl_vae.safetensors"
# LoRA adapters go in models/loras/
# ControlNet models go in models/controlnet/
# Upscale models go in models/upscale_models/
```
## API: Queue a Workflow
```python
# queue_prompt.py — Submit a workflow to ComfyUI via the API
import json
import requests
import uuid
COMFYUI_URL = "http://localhost:8188"
# Basic txt2img workflow
workflow = {
"3": {
"class_type": "KSampler",
"inputs": {
"seed": 42,
"steps": 25,
"cfg": 7.5,
"sampler_name": "euler_ancestral",
"scheduler": "normal",
"denoise": 1.0,
"model": ["4", 0],
"positive": ["6", 0],
"negative": ["7", 0],
"latent_image": ["5", 0],
},
},
"4": {
"class_type": "CheckpointLoaderSimple",
"inputs": {"ckpt_name": "sd_xl_base_1.0.safetensors"},
},
"5": {
"class_type": "EmptyLatentImage",
"inputs": {"width": 1024, "height": 1024, "batch_size": 1},
},
"6": {
"class_type": "CLIPTextEncode",
"inputs": {
"text": "A majestic mountain landscape at golden hour, photorealistic, 8k",
"clip": ["4", 1],
},
},
"7": {
"class_type": "CLIPTextEncode",
"inputs": {
"text": "blurry, low quality, distorted",
"clip": ["4", 1],
},
},
"8": {
"class_type": "VAEDecode",
"inputs": {"samples": ["3", 0], "vae": ["4", 2]},
},
"9": {
"class_type": "SaveImage",
"inputs": {"filename_prefix": "comfyui_output", "images": ["8", 0]},
},
}
client_id = str(uuid.uuid4())
response = requests.post(
f"{COMFYUI_URL}/prompt",
json={"prompt": workflow, "client_id": client_id},
)
print(f"Queued: {response.json()}")
```
## API: Get Results and Download Images
```python
# get_results.py — Poll for completion and download generated images
import requests
import time
import urllib.request
COMFYUI_URL = "http://localhost:8188"
def wait_for_completion(prompt_id: str) -> dict:
while True:
response = requests.get(f"{COMFYUI_URL}/history/{prompt_id}")
history = response.json()
if prompt_id in history:
return history[prompt_id]
time.sleep(1)
def download_images(history: dict, output_dir: str = "./outputs"):
import os
os.makedirs(output_dir, exist_ok=True)
for node_id, node_output in history["outputs"].items():
if "images" in node_output:
for image in node_output["images"]:
url = f"{COMFYUI_URL}/view?filename={image['filename']}&subfolder={image.get('subfolder', '')}&type={image['type']}"
filepath = os.path.join(output_dir, image["filename"])
urllib.request.urlretrieve(url, filepath)
print(f"Saved: {filepath}")
# Usage after queuing a prompt
prompt_id = "your-prompt-id"
history = wait_for_completion(prompt_id)
download_images(history)
```
## Custom Nodes (ComfyUI Manager)
```bash
# install_manager.sh — Install ComfyUI Manager for easy custom node management
cd ComfyUI/custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Manager.git
# Restart ComfyUI — Manager button appears in the UI
# Popular custom node packs:
# - ComfyUI-Impact-Pack: Detection, segmentation, inpainting
# - ComfyUI-AnimateDiff: Animation from static images
# - ComfyUI-IPAdapter: Image prompt adapter for style transfer
# - rgthree-comfy: Workflow organization utilities
```
## ControlNet Workflow
```python
# controlnet_workflow.py — Generate images guided by ControlNet (edge detection, depth, pose)
controlnet_nodes = {
"10": {
"class_type": "ControlNetLoader",
"inputs": {"control_net_name": "control_v11p_sd15_canny.pth"},
},
"11": {
"class_type": "LoadImage",
"inputs": {"image": "input_image.png"},
},
"12": {
"class_type": "CannyEdgePreprocessor",
"inputs": {"image": ["11", 0], "low_threshold": 100, "high_threshold": 200},
},
"13": {
"class_type": "ControlNetApply",
"inputs": {
"conditioning": ["6", 0],
"control_net": ["10", 0],
"image": ["12", 0],
"strength": 0.8,
},
},
}
# Connect node "13" output to KSampler positive conditioning instead of "6"
```
## Docker Deployment
```yaml
# docker-compose.yml — Run ComfyUI in Docker with GPU support
version: "3.8"
services:
comfyui:
image: ghcr.io/ai-dock/comfyui:latest
ports:
- "8188:8188"
volumes:
- ./models:/workspace/ComfyUI/models
- ./output:/workspace/ComfyUI/output
- ./custom_nodes:/workspace/ComfyUI/custom_nodes
deploy:
resources:
reservations:
devices:
- capabilities: [gpu]
```
## Key Concepts
- **Nodes and links**: Visual programming — connect output slots to input slots to build pipelines
- **Workflows**: Saved as JSON files — shareable, version-controllable, API-submittable
- **Custom nodes**: Extend functionality via Python — community ecosystem via ComfyUI Manager
- **Checkpoints**: Model files (`.safetensors`) placed in `models/checkpoints/`
- **LoRA**: Lightweight fine-tuned adapters loaded alongside base models
- **ControlNet**: Guide generation with structural inputs (edges, depth, pose)
- **API-first**: Full HTTP API for queuing prompts and retrieving results programmatically
Related in Image & Video
watch
IncludedWatch a video (URL or local path). Downloads with yt-dlp, extracts auto-scaled frames with ffmpeg, pulls the transcript from captions (or Whisper API fallback), and hands the result to Claude so it can answer questions about what's in the video.
physical-ai-defect-image-generation
IncludedUse when the user wants to orchestrate defect image generation, run associated setup, or handle outputs on OSMO. The Day 0 path handles cold-start with USD-to-ROI, image-edit augmentation, and AnomalyGen to create initial PCBA datasets. The Day 1 path performs inference and labeling on real images. This skill helps with first-time asset setup, creation of finetuning checkpoints, and configuring deployment. Trigger keywords: defect image generation, dig workflow, dig pipeline, defect image detection workflow, aoi pipeline, aoi anomalygen, usd2roi anomalygen, day 0 pcba, day 1 pcba, day 1 real-photo alignment, day 1 manual roi, metal surface anomaly, glass defect, anomalygen finetune, setup_pcb, setup_metal, setup_glass, setup_pretrained, dig setup, dig datasets, dig pretrained checkpoint, dig image-edit endpoint.
accelint-react-best-practices
IncludedReact performance optimization and best practices. ALWAYS use this skill when working with any React code - writing components, hooks, JSX; refactoring; optimizing re-renders, memoization, state management; reviewing for performance; fixing hydration mismatches; debugging infinite re-renders, stale closures, input focus loss, animations restarting; preventing remounting; implementing transitions, lazy initialization, effect dependencies. Even simple React tasks benefit from these patterns. Covers React 19+ (useEffectEvent, Activity, ref props). Triggers - useEffect, useState, useMemo, useCallback, memo, inline components, nested components, components inside components, re-render, performance, hydration, SSR, Next.js, useDeferredValue, combined hooks.
elevenlabs-agents
IncludedBuild conversational AI voice agents with ElevenLabs Platform using React, JavaScript, React Native, or Swift SDKs. Configure agents, tools (client/server/MCP), RAG knowledge bases, multi-voice, and Scribe real-time STT. Use when: building voice chat interfaces, implementing AI phone agents with Twilio, configuring agent workflows or tools, adding RAG knowledge bases, testing with CLI "agents as code", or troubleshooting deprecated @11labs packages, Android audio cutoff, CSP violations, dynamic variables, or WebRTC config. Keywords: ElevenLabs Agents, ElevenLabs voice agents, AI voice agents, conversational AI, @elevenlabs/react, @elevenlabs/client, @elevenlabs/react-native, @elevenlabs/elevenlabs-js, @elevenlabs/agents-cli, elevenlabs SDK, voice AI, TTS, text-to-speech, ASR, speech recognition, turn-taking model, WebRTC voice, WebSocket voice, ElevenLabs conversation, agent system prompt, agent tools, agent knowledge base, RAG voice agents, multi-voice agents, pronunciation dictionary, voice speed control, elevenlabs scribe, @11labs deprecated, Android audio cutoff, CSP violation elevenlabs, dynamic variables elevenlabs, case-sensitive tool names, webhook authentication
humanizer
IncludedHumanize AI-generated text by detecting and removing patterns typical of LLM output. Rewrites text to sound natural, specific, and human. Uses 28 pattern detectors, 560+ AI vocabulary terms across 3 tiers, and statistical analysis (burstiness, type-token ratio, readability) for comprehensive detection. Use when asked to humanize text, de-AI writing, make content sound more natural/human, review writing for AI patterns, score text for AI detection, or improve AI-generated drafts. Covers content, language, style, communication, and filler categories.
generating-mermaid-diagrams
IncludedSalesforce architecture diagrams using Mermaid with ASCII fallback. Use this skill when generating text-based diagrams for Salesforce architecture, OAuth flows, ERDs, integration sequences, or Agentforce structure. TRIGGER when: user says "diagram", "visualize", "ERD", or asks for sequence diagrams, flowcharts, class diagrams, or architecture visualizations in Mermaid. DO NOT TRIGGER when: user wants PNG/SVG image output (use generating-visual-diagrams), or asks about non-Salesforce systems.