Nodes/comfyui-prompt-skill/提示词优化 (带 skill 调 LLM)
ComfyUI Node

提示词优化 (带 skill 调 LLM)

Your FLUX.2 Prompt Is the Problem — This Node Sends It to an LLM and Hands You Back the Rewrite

By DarthVanDerLimdr·Created 15 days ago·Updated 14 days ago· 0
提示词优化 (带 skill 调 LLM)
  • 模型输入
  • 参考图
  • 优化后提示词
  • 报告
  • 文件路径
◄提示词►
◄目标模型▾►
◄优化模式标准优化►
◄生成后控制fixed►
◄思考强度关闭►
◄你的意图►
◄文件名标签prompt►
◄接口地址https://api.deepseek.com/v1►
◄API_KEY►
◄文字模型deepseek-chat►
◄视觉模型deepseek-flash►

If you've spent an evening reading FLUX.2 [dev]'s official prompting notes, you already know the problem: the rules are long, they're specific, and half of them contradict what you learned on SDXL. photorealistic is now a liability. The negative prompt box is decoration. Camera and lens names do more work than any quality word ever did. And FLUX.2's encoder is a Mistral-3 vision-language model reading your text as an instruction, which is why your 2023 tag soup produces soup.

PromptOptimizerSkill (displayed in the ComfyUI menu as 提示词优化 (带 skill 调 LLM)) is the "stop memorizing this" node. Drop it between your text and your sampler, and it calls an OpenAI-compatible LLM with a prompt-engineering spec attached, hands you back a rewritten prompt as a STRING, and gets out of the way.

The spec file is the whole trick

The name of the pack gives it away: skill. Before it calls anything, it loads a folder named flux2-dev-prompt-engineering off disk and reads the SKILL.md inside into the system prompt. That file is the actual product; the LLM is just the machine that applies it. The repo ships the FLUX.2 one inside skills/, first in the search order, so cloning the pack is enough to have the spec live.

The Qwen equivalent (qwen-image-2-1-prompter) is not bundled - it's someone else's work - so if you point the node at qwen-image-2-1 without dropping that folder into ~/.agents/skills/, you get a 找不到 skill 目录 error listing every path it searched. Want your own FLUX.2 spec instead? Put it in one of the other search locations and delete the bundled folder. Skill files are re-read every run, so editing the markdown costs you nothing but a re-queue.

Inputs that matter

The ones you'll actually set: 提示词 (your draft, or wire a STRING in), 目标模型 (自动判断 / flux2-dev / qwen-image-2-1), 优化模式 (标准优化, 保守改写, 大幅重构, 重新优化, or the dry-run 仅输出将要发送的内容), and 你的意图 - the plain-language "what I'm going for" field. That last one matters more than the draft. A model given only your six-word prompt will invent a scene; give it intent plus a rough draft and it has something to respect.

思考强度 (off to high) passes a reasoning-effort level to the endpoint - only useful on a reasoning model, and off by default for a reason: tokens.

生成后控制 is deliberately a clone of the sampler's control, and the tooltip is the whole deal: "fixed = don't reroll the prompt (cheap); randomize = reroll a new prompt every run." In practice it rerolls on the transition, not on every queue. Switch to randomize and the next run buys you a fresh prompt; leave it on randomize and subsequent runs reuse that one.

Then the plumbing: 接口地址, API_KEY, 文字模型, 视觉模型, an optional 模型输入 (a MODEL link - the node reads the loader's filename without executing it, so no VRAM), and 参考图, which grows a socket each time you connect one, up to ten. Connect any image and it switches to the vision model to look at it first.

Outputs

Three strings: 优化后提示词 goes into your text encode. 报告 is the model's working notes - read it once in a Show Text node, then ignore it. 文件路径 points at the saved txt under ComfyUI/output/workflow_llm/, where the cache lives too.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/DarthVanDerLimdr/comfyui-prompt-skill.git

Restart ComfyUI. The project metadata declares requests, but the shipped code calls the API through stdlib urllib - so realistically nothing installs and nothing needs to.

For the key, either paste it into the node's API_KEY field or drop it in ComfyUI/output/workflow_llm/config.json, which the node creates on first run; leave the field blank and it falls back to that file. Docker people can override with WORKFLOW_LLM_BASE_URL / WORKFLOW_LLM_API_KEY / WORKFLOW_LLM_MODEL.

Where people get burned

Your key gets baked into the workflow JSON. The author's own tooltip warns about it: whatever you type into API_KEY is saved with the graph. Leave it empty and share freely.

"没连模型" / it refuses to auto-detect. With no MODEL link and 目标模型 left on 自动判断 it stops rather than guessing - in a two-model workflow the loader it finds may not be the one you're sampling with. Set the dropdown.

Endpoint and model name mismatched. Paste an Ark endpoint with deepseek-chat and it fails on the spot with the names that endpoint actually takes. Every provider switch means three edits: address, key, model.

It looks like nothing changed. The node always executes (IS_CHANGED returns NaN on purpose), and spending is decided by its own hash cache, not ComfyUI's. Same prompt, same intent, same images → same output, zero tokens. To force a fresh call, set 优化模式 to 重新优化.

You're paying to find out what would be sent. Set 优化模式 to 仅输出将要发送的内容 and it writes the full request body to a txt, plus your reference images as jpg, without touching the network. Do that before your first paid run.

One honest note: it rewrites, it doesn't conjure. Describe the wrong scene and you get a beautifully compliant prompt about the wrong scene.

Category提示词工具

Inputs (13)

NameTypeDefaultDescription
提示词STRING—
目标模型COMBO3 options: 自动判断, flux2-dev, qwen-image-2-1
优化模式COMBO标准优化5 options: 标准优化, 保守改写, 大幅重构, 重新优化, 仅输出将要发送的内容
生成后控制COMBOfixedfixed=不重抽提示词(省钱);randomize=每次重抽一次新提示词
思考强度COMBO关闭4 options: 关闭, 低, 中, 高
你的意图STRING—
文件名标签STRINGprompt—
接口地址STRINGhttps://api.deepseek.com/v1—
API_KEYSTRING留空 = 用 config.json 里的 key。这里填了会存进工作流文件,分享时注意。
文字模型COMBOdeepseek-chat2 options: deepseek · deepseek-chat, deepseek · deepseek-reasoner
视觉模型COMBOdeepseek-flash2 options: deepseek · deepseek-flash, deepseek · deepseek-chat
模型输入optMODEL—
参考图optCOMFY_AUTOGROW_V3参考图,接一张长一个点,最多 10 张。留空跳过;接了任意一张会自动切视觉模型。

Outputs (3)

NameTypeDescription
优化后提示词STRING—
报告STRING—
文件路径STRING—