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
74842 skills4 agents11 commands1 MCP
Install
$ npx -y skills add artokun/comfyui-mcp --skill prompt-engineering --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/prompt-engineering

Context preview

The summary Claude sees to decide when to auto-load this skill.

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

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
Ships withcomfyui-mcp

This project is no longer maintained. ComfyUI now ships official agent and MCP tooling — Comfy Agent and Comfy MCP — built and supported by the Comfy-Org team with deeper integration than a community project can match.

Get the whole plugin

Other skills on comfyui-mcp.