A marketing team ran an A/B test on two prompts to generate product descriptions for the same item — a portable solar charger. Prompt A: "Write a product description for a solar charger." Prompt B: "Write a 120-word product description for a 20,000 mAh solar charger targeting outdoor hikers aged 25–45. Lead with the fastest-charging scenario. Mention IP67 water resistance and dual USB-C output. Tone: confident, no exclamation marks." Prompt B outperformed Prompt A in click-through rate by 34% in a 2-week trial. The only variable was prompt specificity.
Large language models are probability machines. A vague prompt averages over thousands of possible interpretations. A specific prompt narrows the distribution to a small region of relevant outputs. The prompt generator here applies structural patterns that consistently produce narrower, higher-quality distributions.
The Six Elements of a High-Quality Prompt
| Element | What it does | Example |
|---|---|---|
| Role | Sets the persona/expertise level | "You are a senior Python developer specializing in async code" |
| Task | Clear action verb + deliverable | "Write a decorator that retries failed HTTP calls" |
| Context | Background that changes the answer | "The codebase uses httpx 0.27, Python 3.12" |
| Constraints | What to exclude or limit | "No external libraries beyond httpx. Max 40 lines." |
| Format | Output structure | "Return only the decorator code, no explanation" |
| Examples | Reference output (few-shot) | "Here is a similar decorator we use: [code]" |
Prompt Patterns by Use Case
- Image generation (Midjourney/DALL-E):Subject → style → lighting → camera → mood. Order matters — earlier tokens have higher weight. "Moroccan medina, watercolor illustration, golden hour light, overhead drone view, peaceful" outperforms rearranging those words.
- Code generation:Language + version + library versions + what it must NOT do. The "must not" constraint prevents the most common failure modes (wrong library version, unwanted dependencies).
- Writing/editing: Audience + reading level + word count + what emotion to leave the reader with. Without the emotional target, outputs are technically correct but flat.
- Analysis/research:Specify the output format first (table, bullet list, prose) — the model's reasoning adapts to fit the format constraint rather than the format being bolted on at the end.
What the Generator Cannot Do
The prompt generator creates structure — it cannot supply domain knowledge you haven't provided. If you don't specify the target model (GPT-4o, Claude 3, Gemini 1.5), the generated prompt may use formatting conventions that work on one model and confuse another. Chain-of-thought instructions ("think step by step") improve reasoning on models above ~70B parameters but add noise on smaller models. The generator applies these patterns conservatively by default.
