Skip to content
Automation
Skill

/prompt-engineering

ComfyUI prompt engineering knowledge covering CLIP text encoding syntax, weight modifiers, model-specific prompting strategies, and best practices

From plugin
comfyui-mcp
88442 skills4 agents11 commands1 MCP

Claude Code

$ npx -y skills add artokun/comfyui-mcp --skill prompt-engineering --agent claude-code

SKILL.md

prompt-engineering.SKILL.md
name: prompt-engineering
description: ComfyUI prompt engineering knowledge covering CLIP text encoding syntax, weight modifiers, model-specific prompting strategies, and best practices
globs:
  - "**/*.json"

ComfyUI Prompt Engineering

CLIP Text Encoding Fundamentals

ComfyUI uses CLIP (Contrastive Language-Image Pre-training) text encoders to convert text prompts into conditioning tensors. The `CLIPTextEncode` node takes a text string and a CLIP model, producing a `CONDITIONING` output for the KSampler.

Token Limit

CLIP processes text in **77-token chunks**. Each word is typically 1-3 tokens. Prompts exceeding 77 tokens are silently truncated unless you use the BREAK token or a multi-clip encoding node.

Weight Syntax

Emphasis (Attention Weights)

Adjust how strongly the model attends to specific words or phrases:

| Syntax | Effect | Equivalent Weight | |--------|--------|-------------------| | `(word:1.3)` | Increase emphasis by 30% | Explicit weight 1.3 | | `(word:0.7)` | Decrease emphasis by 30% | Explicit weight 0.7 | | `(word)` | Slight increase | `(word:1.1)` | | `((word))` | Moderate increase | `(word:1.21)` — 1.1^2 | | `(((word)))` | Strong increase | `(word:1.331)` — 1.1^3 | | `[word]` | Slight decrease | `(word:0.9091)` — 1/1.1 | | `[[word]]` | Moderate decrease | `(word:0.8264)` — 1/1.1^2 |

Weight Rules

  • **Valid range**: 0.0 to 2.0 (going beyond 1.5 often causes artifacts)
  • **Default weight**: 1.0 for unmodified tokens
  • **Nesting stacks multiplicatively**: `((word))` = 1.1 * 1.1 = `(word:1.21)`
  • **Phrases**: `(red sports car:1.3)` applies weight to the entire phrase
  • **Mixing**: `(detailed face:1.4), (blurry background:0.6)`, combined in one prompt

Examples

a (beautiful:1.3) woman with (flowing red hair:1.2), wearing a blue dress, (sharp focus:1.1)
(masterpiece:1.4), (best quality:1.3), a knight in (ornate armor:1.2), standing on a cliff, (dramatic lighting:1.1), cinematic

BREAK Token

The `BREAK` keyword forces CLIP to end the current 77-token chunk and start processing subsequent text in a new chunk. This is critical for long prompts.

When to Use BREAK

  • Prompt exceeds ~60 words (approaching the 77-token limit)
  • You want to separate conceptually distinct parts of the prompt
  • Certain details are being ignored (they may be past the 77-token cutoff)

BREAK Example

masterpiece, best quality, a beautiful Japanese garden with cherry blossoms,
stone lanterns, koi pond, traditional wooden bridge, morning mist
BREAK
highly detailed, 8k uhd, photorealistic, volumetric lighting,
depth of field, golden hour, award-winning photography

Each chunk is encoded independently and then concatenated as conditioning, so all tokens are processed.

Embeddings / Textual Inversions

Embeddings (textual inversions) are pre-trained token sets that encode complex concepts into a single trigger word.

Syntax

embedding:easynegative
embedding:badhandv4
embedding:bad-image-v2-39000

Usage in Prompts

  • Place embedding triggers directly in the prompt text
  • Most commonly used in **negative prompts** to improve quality
  • The embedding `.safetensors` or `.pt` file must be in `models/embeddings/`

Common Negative Embeddings

| Embedding | Best For | Description | |-----------|----------|-------------| | `easynegative` | SD 1.5 | General quality improvement | | `badhandv4` | SD 1.5 | Fixes hand deformities | | `bad-image-v2-39000` | SD 1.5 | Reduces artifacts | | `negativeXL_D` | SDXL | SDXL-specific negative embedding | | `ac_neg1` | SDXL | Alternative SDXL negative |

Example with Embeddings

Positive: `a portrait of a woman, masterpiece, best quality` Negative: `embedding:easynegative, embedding:badhandv4, worst quality, low quality`

Model-Specific Prompting

SD 1.5

**Negative prompt: IMPORTANT. SD 1.5 is sensitive to negatives.**

Positive prompt structure:

(masterpiece:1.2), (best quality:1.2), subject description, details, style tags

Recommended negative prompt:

worst quality, low quality, normal quality, lowres, watermark, signature,
text, jpeg artifacts, blurry, bad anatomy, bad hands, extra fingers,
missing fingers, extra limbs, deformed, disfigured, mutation, ugly

Key notes:

  • Quality tags like `masterpiece, best quality` make a large difference to output
  • Responds well to danbooru-style tags: `1girl, long hair, blue eyes, school uniform`
  • Embedding-based negatives (`easynegative`) work well
  • Keep prompts concise, since each chunk is limited to 77 tokens

SDXL (1.0 / Turbo / Lightning)

**Negative prompt: Moderate importance. SDXL is less sensitive to negatives than SD 1.5.**

Positive prompt structure:

subject description with natural language, detailed description of scene and style

Recommended negative prompt:

blurry, low quality, deformed, ugly, bad anatomy, disfigured, poorly drawn face,
mutation, mutated, extra limbs, watermark, text

Key notes:

  • SDXL understands natural language better than tag-based prompts
  • Dual CLIP encoders (CLIP-L + CLIP-G). Use `CLIPTextEncodeSDXL` for separate control
  • `CLIPTextEncodeSDXL` has separate `text_g` (global description) and `text_l` (local details) fields
  • Supports longer prompts natively (two 77-token chunks via dual CLIP)
  • Quality tags are less critical but still helpful
  • **SDXL Turbo**: 1-4 steps, CFG 1.0-2.0, minimal negative prompt needed
  • **SDXL Lightning**: 4-8 steps, CFG 1.0-2.0, often works with empty negative

Flux (Flux.1 schnell / dev)

**Negative prompt: NOT USED. Flux operates at CFG=1.0 with no negative conditioning.**

Positive prompt structure:

Detailed natural language description. Flux excels with descriptive sentences
rather than comma-separated tags. Describe the scene as if writing a paragraph.

Key notes:

  • **CFG must be 1.0.** Higher values cause artifacts
  • **No negative prompt.** Connect nothing or empty string to negative conditioning
  • T5-XXL encod
Read more
@artokun
Ships withcomfyui-mcp

<img src="docs/images/demo-poster.jpg" width="760" alt="The Agent panel driving ComfyUI end to end. Click to watch the demo"> The Agent panel driving ComfyUI end to end. It reads what is installed locally, wires the graph, frees VRAM, and runs the render.

88442 skills4 agents1 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
884
Star history of artokun/comfyui-mcp on GitHub, a chart by star-history.com

Other skills on comfyui-mcp.

ai-toolkit-trainer

ai-toolkit-trainer

Train custom LoRAs with ostris AI-Toolkit. Covers WAN 2.2/2.1 (people, styles, video motion) and Z-Image (Turbo & Base, low-VRAM…

@artokun@artokunInstall Skill
anima-base

anima-base

Anime/illustration text-to-image (ANIMA 1.0, ~2B Cosmos DiT). Use for anime, manga, illustrated characters; accepts Danbooru tags…

@artokun@artokunInstall Skill
anima-lora-trainer

anima-lora-trainer

Train a custom anime LoRA on the ANIMA base model with Citron's local Gradio trainer (kohya sd-scripts), <6GB VRAM,…

@artokun@artokunInstall Skill
civitai

civitai

Discover Civitai models with the BUILT-IN download_model action:"search_civitai" and install/generate them locally. Find a…

@artokun@artokunInstall Skill
color-correction

color-correction

Diagnose and fix video/image color OBJECTIVELY with the get_image (action:"analyze_color") tool (scopes/stats such as black/white…

@artokun@artokunInstall Skill
comfyui-core

comfyui-core

Core ComfyUI knowledge covering workflow format, node types, pipeline patterns, and MCP tool usage

@artokun@artokunInstall Skill

More skills from other plugins.

agent-builder

agent-builder

Load immediately after an Agent intent, before the first agent_builder_* call. Governs how you create, configure, test, and…

n8n11d209k
@n8n-io@n8n-ioInstall Skill
browser-use

browser-use

Direct browser control via CDP for web interaction: automation, scraping, testing, screenshots, and site/app work. Also covers…

@browser-use@browser-useInstall Skill
agent-browser

agent-browser

Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling…

@vercel-labs-2@vercel-labs-2Install Skill
add-anydoc

add-anydoc

Add local office-document-to-Markdown conversion to NanoClaw agent containers with the pinned Firecrawl AnyDoc CLI. Use when…

@nanocoai@nanocoaiInstall Skill

Questions about prompt-engineering.

Which coding agents can use prompt-engineering?
prompt-engineering installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.