{"skill":{"slug":"comfyui-agent-skill-mie","displayName":"comfyui-agent-skill-mie","summary":"Agent skill for running registered ComfyUI workflows through a stable CLI. Supports image, video, music, and speech generation on a local or trusted self-hos...","description":"---\r\nname: comfyui-agent-skill-mie\r\ndescription: >\r\n  Agent skill for running registered ComfyUI workflows through a stable CLI.\r\n  Supports image, video, music, and speech generation on a local or trusted self-hosted\r\n  ComfyUI server (default http://127.0.0.1:8188). Registered workflows only.\r\n---\r\n\r\n# comfyui-agent-skill-mie\r\n\r\n## Purpose\r\n\r\nRun registered ComfyUI workflows through a stable Agent-facing CLI, with prompt enhancement, fail-fast errors, and structured JSON results.\r\n\r\n\r\nUse this skill when the user asks to:\r\n\r\n- Generate an image from text.\r\n- Generate a new image inspired by a reference image.\r\n- Edit an input image while preserving some structure or subject details.\r\n- Generate text-to-video or image-to-video MP4 output.\r\n- Generate music / instrumental / song-style MP3 output.\r\n- Synthesize spoken voice audio with Qwen3-TTS.\r\n- Check whether a ComfyUI server is available.\r\n\r\nDo not use this skill when the user only wants prompt writing, brainstorming, or discussion without actual generation. Do not use it when the ComfyUI server is unavailable.\r\n\r\n## Hard Rules\r\n\r\n- Source mode: run CLI commands from the skill root (the directory containing `SKILL.md` and `scripts/`).\r\n- Tool-install mode: `comfyui-agent-skill-mie` / `comfyui-skill` can be run from any directory.\r\n- Source mode: use `uv run --no-sync python -m comfyui` (or `uv run --no-sync comfyui-skill`) for runtime calls.\r\n- Tool-install mode: use `comfyui-skill` (or `comfyui-agent-skill-mie`) directly; do not wrap with `uv run`.\r\n- Use registered workflows only. Do not run arbitrary unreviewed ComfyUI workflow JSON.\r\n- If server health fails, stop generation and return/handle `SERVER_UNAVAILABLE`; do not search disk for ComfyUI installs or guess ports.\r\n- Do not create or edit `config.local.json` unless the user explicitly wants a persistent server URL. For one-off runs, use `--server` or `COMFYUI_URL`.\r\n- For `reference_to_image`, inspect the reference image with Agent vision and create a prompt. Do not upload that reference image to ComfyUI.\r\n- For `image_to_image` and `image_to_video`, upload the provided local image with `--image`.\r\n- Analyzer-generated workflow configs require human review before activation.\r\n\r\n## Setup\r\n\r\nRecommended install (tool-install mode):\r\n\r\n```bash\r\npipx install comfyui-agent-skill-mie\r\n```\r\n\r\n- Install package: `comfyui-agent-skill-mie`\r\n- Main command: `comfyui-agent-skill-mie`\r\n- Short alias: `comfyui-skill`\r\n\r\nPrerequisites:\r\n\r\n- ComfyUI server with `GET /system_stats` available.\r\n- Python 3.10+.\r\n- Source mode only: `uv`.\r\n- Required ComfyUI models/custom nodes for the selected workflow.\r\n\r\nNetworking note:\r\n\r\n- Default local examples use `http://127.0.0.1:8188` for same-environment setups.\r\n- If the agent runs inside WSL/container/sandbox while ComfyUI runs on the host OS, `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`).\r\n\r\nInitial setup from the skill root:\r\n\r\n```bash\r\nuv sync\r\nuv run --no-sync python -m comfyui --help\r\n```\r\n\r\nTool-install mode:\r\n\r\n```bash\r\ncomfyui-agent-skill-mie --help\r\ncomfyui-agent-skill-mie check\r\ncomfyui-skill --help\r\ncomfyui-skill check\r\n```\r\n\r\n## Quick Workflow Choice\r\n\r\nMinimal decision tree:\r\n\r\n- User gives text only → `generate -p \"...\"` (defaults to `z_image_turbo`)\r\n- User gives a reference image and wants a new similar image → vision → `reference_to_image` prompt → run `z_image_turbo`\r\n- User gives an input image and wants edits → `generate --workflow klein_edit --image input_image=... -p \"...\"`\r\n- User wants TTS / voice audio → `generate --workflow qwen3_tts --speech-text \"...\" --instruct \"...\"`\r\n- User wants video → `ltx_23_t2v_distill` (text→video) or `ltx_23_i2v_distilled` (image→video)\r\n\r\n| User intent | Workflow / mode | Required command shape |\r\n|-------------|-----------------|------------------------|\r\n| Text to image | `z_image_turbo` default | `generate -p \"prompt\"` |\r\n| Qwen Image 2512 | `qwen_image_2512_4step` | `generate --workflow qwen_image_2512_4step -p \"prompt\"` |\r\n| Similar image from reference | Agent vision + T2I | Read reference image, create English prompt, then T2I |\r\n| Edit image | `klein_edit` | `generate --workflow klein_edit --image input_image=photo.png -p \"edit prompt\"` |\r\n| Text to video | `ltx_23_t2v_distill` | `generate --workflow ltx_23_t2v_distill -p \"shot prompt\"` |\r\n| Image to video | `ltx_23_i2v_distilled` | `generate --workflow ltx_23_i2v_distilled --image input_image=photo.png -p \"motion prompt\"` |\r\n| Text to music | `ace_step_15_music` | `generate --workflow ace_step_15_music -p \"music tags\"` |\r\n| Text to speech | `qwen3_tts` | `generate --workflow qwen3_tts --speech-text \"...\" --instruct \"...\"` |\r\n\r\nFor workflow-specific size rules, capability boundaries, and examples, read [references/workflows.md](references/workflows.md).\r\n\r\n## Core Commands\r\n\r\nEnvironment doctor (check server + preflight registered workflows):\r\n\r\nTool-install mode:\r\n\r\n```bash\r\ncomfyui-skill doctor\r\n```\r\n\r\nSource mode:\r\n\r\n```bash\r\nuv run --no-sync python -m comfyui doctor\r\n```\r\n\r\nIf 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).\r\n\r\nHealth check:\r\n\r\n```bash\r\nuv run --no-sync python -m comfyui check\r\n```\r\n\r\nTool-install mode:\r\n\r\n```bash\r\ncomfyui-skill check\r\n```\r\n\r\nGenerate an image:\r\n\r\n```bash\r\nuv run --no-sync python -m comfyui generate -p \"a cute cat sitting on a windowsill at golden hour\"\r\n```\r\n\r\nTool-install mode:\r\n\r\n```bash\r\ncomfyui-skill generate -p \"a cute cat sitting on a windowsill at golden hour\"\r\n```\r\n\r\nGenerate with a specific workflow and server:\r\n\r\n```bash\r\nuv run --no-sync python -m comfyui generate --workflow z_image_turbo --server http://192.168.1.100:8188 -p \"a landscape\"\r\n```\r\n\r\nSave a persistent server URL only when the user asks for it:\r\n\r\n```bash\r\nuv run --no-sync python -m comfyui save-server http://192.168.1.100:8188\r\n```\r\n\r\nPreflight a workflow before a long run:\r\n\r\n```bash\r\nuv run --no-sync python -m comfyui generate --workflow qwen_image_2512_4step --preflight\r\n```\r\n\r\nShow progress for long jobs:\r\n\r\n```bash\r\nuv run --no-sync python -m comfyui generate --workflow ltx_23_t2v_distill -p \"cinematic waves at sunset, slow pan\" --progress\r\n```\r\n\r\nFull CLI options, output path behavior, async submit/poll, and error code details are in [references/cli.md](references/cli.md).\r\n\r\n## Prompt Enhancement\r\n\r\nBefore generation, convert the user's intent into the right workflow inputs.\r\n\r\n| Type | Read this file | Use when |\r\n|------|----------------|----------|\r\n| `character` | [references/prompt_enhancement/character.md](references/prompt_enhancement/character.md) | Portrait, person, character, figure photo |\r\n| `reference_to_image` | [references/prompt_enhancement/reference_to_image.md](references/prompt_enhancement/reference_to_image.md) | User provides a reference image and wants a new similar image |\r\n| `image_to_image` | [references/prompt_enhancement/image_to_image.md](references/prompt_enhancement/image_to_image.md) | User provides an input image and wants to edit it |\r\n| `text_to_speech` | [references/prompt_enhancement/text_to_speech.md](references/prompt_enhancement/text_to_speech.md) | User gives a short voice description and needs full Qwen3-TTS instruction |\r\n\r\nReference-to-image flow:\r\n\r\n1. Ensure a usable reference image exists; otherwise return Agent error `NO_REFERENCE_IMAGE`.\r\n2. Ensure this runtime can inspect images; otherwise return Agent error `VISION_UNAVAILABLE`.\r\n3. Read the reference prompt enhancement file and create one English prompt.\r\n4. Call T2I generation with that prompt. Do not pass the reference image to ComfyUI.\r\n\r\nImage-to-image flow:\r\n\r\n1. Ensure a local image path is available.\r\n2. Read the image edit prompt enhancement file.\r\n3. Call `klein_edit` with `--image input_image=path`.\r\n\r\nText-to-speech flow:\r\n\r\n1. Split user intent into spoken content and voice/style instruction.\r\n2. Read the TTS prompt enhancement file.\r\n3. Call `qwen3_tts` with `--speech-text` and `--instruct`; do not use positional prompt.\r\n\r\n## Fail-Fast and Recovery\r\n\r\nCLI failures are structured JSON on stdout. Agent-only pre-check failures for reference images should also be JSON.\r\n\r\nAgent-only error shape:\r\n\r\n```json\r\n{\r\n  \"source\": \"agent\",\r\n  \"success\": false,\r\n  \"error\": {\"code\": \"VISION_UNAVAILABLE\", \"message\": \"Cannot read reference image in this runtime.\"}\r\n}\r\n```\r\n\r\nRequired fail-fast behavior:\r\n\r\n- Missing prompt: return/handle `EMPTY_PROMPT`.\r\n- Unregistered workflow: return/handle `WORKFLOW_NOT_REGISTERED`.\r\n- Server unavailable: return/handle `SERVER_UNAVAILABLE` and ask whether ComfyUI is running locally or on another machine.\r\n- Missing reference image before `reference_to_image`: return Agent error `NO_REFERENCE_IMAGE`; do not call CLI.\r\n- No vision for `reference_to_image`: return Agent error `VISION_UNAVAILABLE`; do not call CLI.\r\n- Missing image for image workflows: return/handle `NO_INPUT_IMAGE` or `INPUT_IMAGE_NOT_FOUND`.\r\n- Missing custom nodes/models during preflight: return/handle `PREFLIGHT_MISSING_NODES` or `PREFLIGHT_MISSING_MODELS`.\r\n\r\nWhen the user provides a remote ComfyUI address, save it only if they want persistence:\r\n\r\n```bash\r\nuv run --no-sync python -m comfyui save-server http://<address>:<port>\r\n```\r\n\r\nOtherwise retry the original command with `--server http://<address>:<port>`.\r\n\r\n## Output Handling\r\n\r\nAfter successful generation, present the result to the user. Do not silently parse JSON and stop.\r\n\r\n- For images, display the file when the runtime supports local image display; otherwise provide the absolute/local path from `outputs[].path`.\r\n- For MP3/MP4, provide the path or use the runtime's media display/playback capability when available.\r\n- Prefer omitting `--output`; the CLI writes to a per-job directory under `results/` and returns exact paths in JSON.\r\n- For `--count > 1`, parse the wrapper object and present each result.\r\n\r\nSee [references/cli.md](references/cli.md) for JSON schemas and output directory rules.\r\n\r\n## References\r\n\r\n- [references/workflows.md](references/workflows.md) — workflow selection, capabilities, size rules, examples.\r\n- [references/cli.md](references/cli.md) — CLI contract, async jobs, output paths, JSON schemas, error codes.\r\n- `references/prompt_enhancement/` — prompt enhancement instructions.\r\n","topics":["Music"],"tags":{"latest":"1.0.0"},"stats":{"comments":0,"downloads":413,"installsAllTime":15,"installsCurrent":0,"stars":1,"versions":1},"createdAt":1777871448879,"updatedAt":1778492842520},"latestVersion":{"version":"1.0.0","createdAt":1777871448879,"changelog":"comfyui-agent-skill-mie 1.0.0\n\n- Initial release of the skill for running registered ComfyUI workflows via a stable CLI.\n- Supports image, video, music, and speech generation using a local or trusted self-hosted ComfyUI server.\n- Includes prompt enhancement, fail-fast error handling, and structured JSON results.\n- Enforces strict usage of registered workflows only; arbitrary workflow JSON is not supported.\n- Provides clear hard rules, recommended install steps, core commands, and workflow selection guidance in documentation.","license":"MIT-0"},"metadata":null,"owner":{"handle":"miemieeeee","userId":"s17bjt4vyzemhdhzxx8t1g8vbn863bba","displayName":"黎黎原上咩","image":"https://avatars.githubusercontent.com/u/62429387?v=4"},"moderation":null}