comfyui – skill Khác cho agent AI
Tạo ảnh, video và âm thanh qua các workflow khuếch tán (diffusion).
Cài skill comfyui bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/comfyui-3af14.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /comfyui – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/comfyui-3af14.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $comfyui – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/comfyui-3af14.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /comfyui – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/comfyui-3af14.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /comfyui – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
ComfyUI
Generate images, video, audio, and 3D content through ComfyUI using the
official comfy-cli for setup/lifecycle and direct REST/WebSocket API
for workflow execution.
What's in this skill
Reference docs (references/):
official-cli.md— everycomfy ...command, with flagsrest-api.md— REST + WebSocket endpoints (local + cloud), payload schemasworkflow-format.md— API-format JSON, common node types, param mappingtemplate-integrity.md— convertingcomfyui-workflow-templatesfrom
editor format to API format: Reroute bypass, dotted dynamic-input keys
(values.a, resize_type.width), Cloud quirks (302 redirect, 1 concurrent
free-tier job, 1080p VRAM ceiling), Discord-compatible ffmpeg stitch.
Authored by [@purzbeats](https://github.com/purzbeats). Load this whenever
you're starting from an official template.
Scripts (scripts/):
| Script | Purpose |
|--------|---------|
| _common.py | Shared HTTP, cloud routing, node catalogs (don't run directly) |
| hardware_check.py | Probe GPU/VRAM/disk → recommend local vs Comfy Cloud |
| comfyui_setup.sh | Hardware check + comfy-cli + ComfyUI install + launch + verify |
| extract_schema.py | Read a workflow → list controllable params + model deps |
| check_deps.py | Check workflow against running server → list missing nodes/models |
| auto_fix_deps.py | Run check_deps then comfy node install / comfy model download |
| run_workflow.py | Inject params, submit, monitor, download outputs (HTTP or WS) |
| run_batch.py | Submit a workflow N times with sweeps, parallel up to your tier |
| ws_monitor.py | Real-time WebSocket viewer for executing jobs (live progress) |
| health_check.py | Verification checklist runner — comfy-cli + server + models + smoke test |
| fetch_logs.py | Pull traceback / status messages for a given prompt_id |
Example workflows (workflows/): SD 1.5, SDXL, Flux Dev, SDXL img2img,
SDXL inpaint, ESRGAN upscale, AnimateDiff video, Wan T2V. See
workflows/README.md.
When to Use
- User asks to generate images with Stable Diffusion, SDXL, Flux, SD3, etc.
- User wants to run a specific ComfyUI workflow file
- User wants to chain generative steps (txt2img → upscale → face restore)
- User needs ControlNet, inpainting, img2img, or other advanced pipelines
- User asks to manage ComfyUI queue, check models, or install custom nodes
- User wants video/audio/3D generation via AnimateDiff, Hunyuan, Wan, AudioCraft, etc.
Architecture: Two Layers
┌─────────────────────────────────────────────────────┐
│ Layer 1: comfy-cli (official lifecycle tool) │
│ Setup, server lifecycle, custom nodes, models │
│ → comfy install / launch / stop / node / model │
└─────────────────────────┬───────────────────────────┘
│
┌─────────────────────────▼───────────────────────────┐
│ Layer 2: REST/WebSocket API + skill scripts │
│ Workflow execution, param injection, monitoring │
│ POST /api/prompt, GET /api/view, WS /ws │
│ → run_workflow.py, run_batch.py, ws_monitor.py │
└─────────────────────────────────────────────────────┘Why two layers? The official CLI is excellent for installation and server
management but has minimal workflow execution support. The REST/WS API fills
that gap — the scripts handle param injection, execution monitoring, and
output download that the CLI doesn't do.
Quick Start
Detect environment
# What's available?
command -v comfy >/dev/null 2>&1 && echo "comfy-cli: installed"
curl -s http://127.0.0.1:8188/system_stats 2>/dev/null && echo "server: running"
# Can this machine run ComfyUI locally? (GPU/VRAM/disk check)
python scripts/hardware_check.pyIf nothing is installed, see Setup & Onboarding below — but always run the
hardware check first.
One-line health check
python scripts/health_check.py
# → JSON: comfy_cli on PATH? server reachable? at least one checkpoint? smoke-test passes?Core Workflow
Step 1: Get a workflow JSON in API format
Workflows must be in API format (each node has class_type). They come from:
- ComfyUI web UI → Workflow → Export (API) (newer UI) or
the legacy "Save (API Format)" button (older UI)
- This skill's
workflows/directory (ready-to-run examples) - Community downloads (civitai, Reddit, Discord) — usually editor format,
must be loaded into ComfyUI then re-exported
Editor format (top-level nodes and links arrays) is **not directly
executable**. The scripts detect this and tell you to re-export.
Step 2: See what's controllable
python scripts/extract_schema.py workflow_api.json --summary-only
# → {"parameter_count": 12, "has_negative_prompt": true, "has_seed": true, ...}
python scripts/extract_schema.py workflow_api.json
# → full schema with parameters, model deps, embedding refsStep 3: Run with parameters
# Local (defaults to http://127.0.0.1:8188)
python scripts/run_workflow.py \
--workflow workflow_api.json \
--args '{"prompt": "a beautiful sunset over mountains", "seed": -1, "steps": 30}' \
--output-dir ./outputs
# Cloud (export API key once; uses correct /api routing automatically)
export COMFY_CLOUD_API_KEY="comfyui-..."
python scripts/run_workflow.py \
--workflow workflow_api.json \
--args '{"prompt": "..."}' \
--host https://cloud.comfy.org \
--output-dir ./outputs
# Real-time progress via WebSocket (requires `pip install websocket-client`)
python scripts/run_workflow.py \
--workflow flux_dev.json \
--args '{"prompt": "..."}' \
--ws
# img2img / inpaint: pass --input-image to upload + reference automatically
python scripts/run_workflow.py \
--workflow sdxl_img2img.json \
--input-image image=./photo.png \
--args '{"prompt": "make it watercolor", "denoise": 0.6}'
# Batch / sweep: 8 random seeds, parallel up to cloud tier limit
python scripts/run_batch.py \
--workflow sdxl.json \
--args '{"prompt": "abstract"}' \
--count 8 --randomize-seed --parallel 3 \
--output-dir ./outputs/batch-1 for seed (or omitting it with --randomize-seed) generates a fresh
random seed per run.
Step 4: Present results
The scripts emit JSON to stdout describing every output file:
{
"status": "success",
"prompt_id": "abc-123",
"outputs": [
{"file": "./outputs/sdxl_00001_.png", "node_id": "9",
"type": "image", "filename": "sdxl_00001_.png"}
]
}Decision Tree
| User says | Tool | Command |
|-----------|------|---------|
| Lifecycle (use comfy-cli) | | |
| "install ComfyUI" | comfy-cli | bash scripts/comfyui_setup.sh |
| "start ComfyUI" | comfy-cli | comfy launch --background |
| "stop ComfyUI" | comfy-cli | comfy stop |
| "install X node" | comfy-cli | comfy node install <name> |
| "download X model" | comfy-cli | comfy model download --url <url> --relative-path models/checkpoints |
| "list installed models" | comfy-cli | comfy model list |
| "list installed nodes" | comfy-cli | comfy node show installed |
| Execution (use scripts) | | |
| "is everything ready?" | script | health_check.py (optionally with --workflow X --smoke-test) |
| "what can I change in this workflow?" | script | extract_schema.py W.json |
| "check if W's deps are met" | script | check_deps.py W.json |
| "fix missing deps" | script | auto_fix_deps.py W.json |
| "generate an image" | script | run_workflow.py --workflow W --args '{...}' |
| "use this image" (img2img) | script | run_workflow.py --input-image image=./x.png ... |
| "8 variations with random seeds" | script | run_batch.py --count 8 --randomize-seed ... |
| "show me live progress" | script | ws_monitor.py --prompt-id <id> |
| "fetch the error from job X" | script | fetch_logs.py <prompt_id> |
| Direct REST | | |
| "what's in the queue?" | REST | curl http://HOST:8188/queue (local) or --host https://cloud.comfy.org |
| "cancel that" | REST | curl -X POST http://HOST:8188/interrupt |
| "free GPU memory" | REST | curl -X POST http://HOST:8188/free |
Setup & Onboarding
When a user asks to set up ComfyUI, **the FIRST thing to do is ask whether
they want Comfy Cloud (hosted, zero install, API key) or Local (install
ComfyUI on their machine)**. Don't start running install commands or hardware
checks until they've answered.
Official docs: https://docs.comfy.org/installation
CLI docs: https://docs.comfy.org/comfy-cli/getting-started
Cloud docs: https://docs.comfy.org/get_started/cloud
Cloud API: https://docs.comfy.org/development/cloud/overview
Step 0: Ask Local vs Cloud (ALWAYS FIRST)
Suggested script:
> "Do you want to run ComfyUI locally on your machine, or use Comfy Cloud?
>
> - Comfy Cloud — hosted on RTX 6000 Pro GPUs, all common models pre-installed,
> zero setup. Requires an API key (paid subscription required to actually run
> workflows; free tier is read-only). Best if you don't have a
… (nội dung đầy đủ có trong gói tải về)
Skill liên quan
- capacity-planner – Dùng khi một lãnh đạo vận hành (Giám đốc CX, Trưởng bộ phận Hỗ trợ, VP Ops, Trưởng…
- capture – Thu thập và tổ chức các ý tưởng lộn xộn thành một hệ thống có cấu trúc, có thể hành…
- embedding-strategies – Chọn và tối ưu hóa mô hình embedding cho tìm kiếm ngữ nghĩa và ứng dụng RAG. Dùng khi…
- employment-contract-templates – Soạn hợp đồng lao động, thư mời làm việc và tài liệu chính sách nhân sự theo các thông…
- ceo-advisor – Hướng dẫn lãnh đạo điều hành để ra quyết định chiến lược, phát triển tổ chức và quản lý…
- cfo-advisor – Tư vấn tài chính cho startup và công ty đang mở rộng. Lập mô hình tài chính, phân tích…
- creative-ideation – Tạo ý tưởng theo các phương pháp có tên từ thực hành sáng tạo.
- eval-harness-first – Xây dựng bộ đánh giá (evaluation harness) làm điều kiện cho mọi lần fine-tuning — golden…