Same template every run. The dice decide the outfit, the setting, and the light.
One template, hundreds of different renders, zero manual editing between them
Render one: change the dress color, hit generate. Render two: change the setting, hit generate. Render three: swap the lighting word, hit generate. An hour later there are fourteen images, eleven manual edits, and two typos that quietly ruined a batch. Prompt editing by hand is the least creative part of this hobby, and it's the one part a machine is genuinely better at.
A prompt library solved the storage problem: reusable blocks, organized, ready to paste. This guide solves the next problem, which is that pasting is still a human job. Dynamic prompts and wildcards let one written template produce endless controlled variations on its own, so a batch of forty renders explores forty different combinations of outfit, setting, and mood while you do something better with your evening.
For AUTOMATIC1111 users the canonical tool is the sd-dynamic-prompts extension by adieyal, which its own repository describes as an expressive template language for random or combinatorial prompt generation, with wildcard support built in. Install it like any other webui extension and your prompt box quietly learns a new grammar. A separate ComfyUI version exists as its own project, but ComfyUI users have an even easier path covered below.
The core syntax is a set of options inside curly braces, separated by pipes: {option1|option2|option3}. Each generation picks one at random. The repository's own example shows how fast this compounds:
A {house|apartment|lodge|cottage} in {summer|winter|autumn|spring}
Two small groups, sixteen possible prompts. Swap in your own blocks, say {red silk dress|black leather jacket|white summer blouse} against {golden hour rooftop|neon-lit alley|rainy cafe window}, and nine distinct scenes come out of one line of text. There's also a counted form: prefixing a group with 2$$, as in {2$$artist1|artist2|artist3}, selects two entries from the group instead of one, which is exactly how you blend two artist or style influences per render without hand-picking the pairs.
Variant groups get unreadable past five or six options. That's what wildcards are for. Write __seasons__ in a prompt and the extension opens the file seasons.txt from its wildcards directory, which defaults to extensions/sd-dynamic-prompts/wildcards, and substitutes one line from it at random. The file format could not be simpler: a plain text file, one option per line. The repository's example, I love __seasons__ better than __seasons__, also demonstrates the useful detail that the same wildcard used twice rolls independently each time.
This is where the prompt library stops being a filing cabinet and becomes a machine. A hair.txt, an outfits.txt, a lighting.txt, and a locations.txt, each a dozen lines long, turn a single one-sentence template into tens of thousands of possible prompts. Building those files is a one-time cost, and if you already keep labelled blocks the way the library guide suggests, the files practically write themselves: one block per line, done.
{love|hate} {NYC|Chicago} generates all four combinations. Random mode is for wandering; combinatorial mode is for systematic comparisons, like rendering the identical character through every entry in a lighting file to see which one the checkpoint actually handles well. Watch the multiplication, though: three wildcard files of twenty lines each is 8,000 images in combinatorial mode, and the queue will happily try.
The extension also ships a Magic Prompt feature, which runs your prompt through a small language model, the best known being Gustavosta's MagicPrompt, trained on collections of real prompts, and spices it up with extra descriptive phrases. It's the least controllable tool in the box, and that's the point: it's for the flat-inspiration days when every prompt you write comes out shaped the same. Treat its output as a suggestion generator, keep what works, and don't let it bury the subject you actually wanted.
ComfyUI users don't need to go without. The widely installed ComfyUI-Impact-Pack by ltdrdata includes ImpactWildcardProcessor, a node that processes both wildcard syntaxes covered above: __wildcard-name__ file lookups and {a|b|c} inline variants. Wire it in front of a CLIP text encode and the text that reaches the encoder is rolled fresh according to your template.
Two of its details matter in daily use. First, the node has a populate mode, which re-rolls the wildcards on every execution, and a fixed mode, which freezes the last generated text so a favorite roll can be re-run or fine-tuned without the dice taking it away. Second, wildcard files live in the pack's wildcards/ or custom_wildcards/ folders, taking plain .txt files or .yaml collections, and the custom path is reconfigurable in the impact-pack.ini file the pack creates after its first run. Community-built wildcard YAML packs, widely shared on sites like CivitAI, drop straight into those folders, which is the fastest way to try the technique before writing files of your own.
The pack's related ImpactWildcardEncode node goes one step further and can load LoRAs from inside the prompt text using the <lora:name:0.7:1.2> syntax, meaning a wildcard file can carry not just wording but which style LoRA a given line should pull in with it. A single outfit file where each line pairs a description with its matching LoRA is a genuinely powerful thing.
The obvious worry: this whole site keeps preaching structured, disciplined prompts, and now the advice is to gamble? The two ideas are teammates, not rivals. The structure is what makes randomness safe. Keep the character block, the quality tags, and the composition rules as fixed literal text in the template, and confine the dice to the slots that are supposed to vary: wardrobe, backdrop, lighting, mood. The template stays disciplined; the variety happens only where it was invited.
A practical starter recipe: take your current best prompt, replace exactly three phrases with either a variant group or a wildcard, queue twenty renders in random mode, and walk away. Coming back to twenty genuinely different takes on one idea, some of which you would never have typed on purpose, is the moment this technique sells itself. The happy accidents are the product. The dice just work cheaper than you do.