Nodes to pormpt variables, hidden words, snippets to sub prompts process
Package profile
README
README.md — ComfyUI-prompt-utilsLicense: MIT ComfyUI
A for advanced prompt engineering in ComfyUI — designed for dataset creation, LoRA training, batch generation, and controlled variation.
Sources
4 sourcesSource excerpts
1 excerptSource context: Repo fmartinellidev/ComfyUI-fp8Studio_util_pack
✅ Extract & inject variables (seed=123, model=epicrealism)
✅ Manage multi-prompt batches (001_smile\n...\n---\n002_serious)
✅ Hide & swap variations with [[smile;laugh;neutral]]
✅ Fully composable — nodes work independently or chained
💡 No external dependencies — pure Python, works with any model (SDXL, Flux, Wan, LoRA, etc.).
In your ComfyUI/custom_nodes folder:
git clone https://github.com/fmartinellidev/ComfyUI-prompt-utils.git
Or download as ZIP and extract into ComfyUI/custom_nodes/ComfyUI-prompt-utils.
Restart ComfyUI.
| Node | Purpose |
|---|---|
| Prompt Snippet Extractor | Split multi-prompt text into indexed snippets |
| Prompt Variable Extractor | Parse key='value' or key="value" from text |
| Prompt Variable Substitutor | Replace {key} placeholders with values |
| Prompt Hidden Processor | Swap [[option1;option2]] with a selected variation |
All nodes are independent — use one or chain them all!
Prompt Snippet ExtractorSplits a multi-prompt document (e.g. for dataset generation) into indexed snippets.
| Input | Type | Required | Default | Description |
|---|---|---|---|---|
prompt_list | STRING | ✅ | (example) | Multi-snippet text (delimited by --- or custom) |
snippet_index | INT | ✅ | 0 | Which snippet to extract (0-based) |
split_char | STRING | ✅ | "---" | Delimiter between snippets |
first_word_is_filename | BOOLEAN | ✅ | True | Treat first word as filename source |
| Output | Type | Description |
|---|---|---|
prompt | STRING | Full snippet (e.g. "001_smile_front\nA gentle smile...") |
prompt_text | STRING | Snippet without first word (e.g. "A gentle smile...") |
filename_to_label | STRING | Cleaned label (e.g. "smile front") |
filename | STRING | First word (e.g. "001_smile_front") |
Input (prompt_list):
001_smile_front
A gentle smile, facing camera
---
002_laugh_dynamic
Laughing joyfully, head tilted
With snippet_index=0, first_word_is_filename=True, ignore_start_number_label=True:
| Output | Value |
|---|---|
prompt | "001_smile_front\nA gentle smile, facing camera" |
prompt_text | "A gentle smile, facing camera" |
filename_to_label | "smile front" |
filename | "001_smile_front" |
Prompt Variable ExtractorExtracts key='value' or key="value" pairs from text (e.g. metadata, config).
| Input | Type | Required | Default | Description |
|---|---|---|---|---|
text | STRING | ✅ | "" | Input text containing variables |
prefix | STRING | ✅ | "#" | Prefix before keys (e.g. #seed=123) |
delimiter_char | STRING | ✅ | "=" | Char between key and value |
| Output | Type | Description |
|---|---|---|
output_text | STRING | Text with variables removed |
variables_json | STRING | JSON of extracted variables (e.g. {"seed": "123"}) |
Input (text):
#seed=1234 #model="epicrealismxl" A portrait, studio lighting
Outputs:
output_text: "A portrait, studio lighting"variables_json: {"seed": "1234", "model": "epicrealismxl"}Nodes in this pack
4 nodesVerified Aug 4
ignore_start_number_labelBOOLEAN |
| ✅ |
True |
Strip leading numbers (e.g. 001_ → "") |