Prompt Engineering 101: How to Get Better Results from Any AI Tool
Prompt Engineering 101: How to Get Better Results from Any AI Tool
The difference between a mediocre AI output and an excellent one usually is not the model -- it is the prompt. Whether you are using ChatGPT, Claude, Gemini, Midjourney, DALL-E, or Stable Diffusion, the way you communicate your request fundamentally shapes what you get back.
Prompt engineering is not a mystical art. It is a set of practical techniques grounded in how these systems process language. This guide covers the principles that work across all major AI tools, with specific examples for both text and image generation.
Why Prompts Matter So Much
Large language models and image generation models respond to statistical patterns in your input. Your prompt is not just a question -- it is a set of constraints that narrows the vast space of possible outputs to the subset you actually want.
If you ask a talented but literal-minded assistant to "write something about dogs," you might get a poem, a research paper, a children's story, or a veterinary report. The request is genuinely ambiguous. AI models face the same problem, except they resolve ambiguity based on statistical likelihood rather than asking for clarification. Better prompts reduce ambiguity.
The Foundation: Structure and Specificity
The Anatomy of a Good Prompt
A well-structured prompt includes some combination of:
- Role or context: Who should the AI be or what perspective should it take?
- Task: What specifically do you want it to do?
- Input data: What material should it work with?
- Output format: How should the result be structured?
- Constraints: What should it avoid, and what are the boundaries?
You do not need all five for every prompt, but including more of them generally produces better results.
Vague vs. Specific
| Vague Prompt | Specific Prompt |
|---|---|
| "Write about climate change" | "Write a 500-word summary of how rising ocean temperatures affect coral reef ecosystems, aimed at high school biology students, using simple language and no jargon" |
| "Make an image of a cat" | "A tabby cat sitting on a windowsill looking out at rain, warm indoor lighting, low angle, photorealistic, shallow depth of field" |
| "Help me with my resume" | "Review the work experience section below and suggest improvements for a senior product manager role at a tech company. Focus on quantifying achievements" |
Every added detail constrains the output toward what you actually want. But there is a balance -- too prescriptive and you leave no room for the model to add value. Match your specificity to how clear your vision is and how critical accuracy is.
Technique 1: Role Setting
Assigning a role shapes the model's tone, vocabulary, depth, and perspective. When you say "You are an experienced pediatric nurse explaining vaccines to a worried parent," the model activates patterns associated with accessible medical knowledge, empathetic tone, and concern-addressing rather than lecturing.
For text models (ChatGPT, Claude, Gemini):
You are a senior tax accountant with 15 years of experience
in small business taxation. Explain the difference between
an S-Corp and an LLC for a freelance graphic designer
earning $120,000 annually. Plain language only.
For image models (Midjourney, DALL-E, Stable Diffusion):
Editorial photograph by a National Geographic photographer,
aerial view of terraced rice paddies in Bali during golden
hour, Hasselblad medium format, rich greens and warm highlights
Mentioning a photographer style or camera type activates aesthetic patterns from training data.
Technique 2: Few-Shot Prompting
Few-shot prompting means providing examples of the input-output pattern you want. Instead of describing the format abstractly, you show it:
Convert product features into customer-facing benefits:
Feature: "256GB SSD storage"
Benefit: "Boot up in seconds and store thousands of photos
without running out of space"
Feature: "IP68 water resistance"
Benefit: "Take calls in the rain or by the pool without
worrying about water damage"
Feature: "12-hour battery life"
Benefit:
The model sees the pattern and continues it. This is more reliable than abstract instructions because the examples establish the exact tone, length, and style you want.
How many examples do you need? Zero-shot works for simple tasks. One or two examples work when you need a specific format or style. Three to five examples help when the pattern is complex or consistency across outputs matters. More than five is rarely needed -- if you need that many, the task may be better suited to fine-tuning.
Technique 3: Chain-of-Thought Prompting
Chain-of-thought (CoT) prompting asks the model to show its reasoning step by step. This dramatically improves performance on tasks requiring logic, math, or multi-step reasoning.
The simplest trigger is adding "Think step by step" to your prompt:
A store has a 25% off sale. A jacket costs $160. There is
a $20 coupon that applies after the discount. Sales tax
is 8%. What is the final price? Think step by step.
The model lays out each calculation sequentially, and each step provides context for the next, reducing logical errors. Without CoT, models frequently make mistakes when operations must happen in a specific order.
For complex analysis, provide a reasoning framework:
Evaluate this startup idea using these steps:
1. Market size estimation
2. Competition analysis
3. Differentiation
4. Revenue model
5. Key risks (top 3)
6. Overall assessment
The idea: [description]
This forces systematic evaluation rather than a surface-level opinion.
Technique 4: Output Format Specification
Telling the model exactly how to structure output prevents reformatting work:
Return a JSON object with: "summary" (string, max 100 words),
"key_points" (array of 3-5 strings), "sentiment" (one of:
"positive", "negative", "neutral"), "confidence" (0 to 1)
ChatGPT, Claude, and Gemini all handle structured formats well -- JSON, markdown tables, numbered lists, and code blocks. Image models do not take format instructions but accept aspect ratio, style, and composition parameters.
Technique 5: Constraints and Negative Instructions
Sometimes the best way to improve output is specifying what you do NOT want.
For text models:
Explain quantum entanglement to a curious 10-year-old.
- Do NOT use the word "particle"
- Do NOT use sock or glove analogies (overused, misleading)
- Do NOT begin with "Great question!" or any filler
- Keep it under 150 words
Common constraints include length limits, vocabulary restrictions, tone boundaries, and factual guardrails ("only cite information from the provided text").
Negative Prompts for Image Generation
Image models support negative prompts -- descriptions of what to exclude:
Stable Diffusion:
Prompt: "Professional headshot, business attire, gray background"
Negative: "cartoon, deformed, blurry, extra fingers, watermark"
Midjourney (using --no):
Professional headshot, business attire, gray background
--no cartoon illustration blurry watermark
| Issue to Avoid | Negative Prompt Terms |
|---|---|
| Distorted anatomy | "deformed, extra limbs, extra fingers, mutated" |
| Low quality | "blurry, pixelated, low resolution, jpeg artifacts" |
| Unwanted text | "text, watermark, signature, logo" |
| Wrong style | "cartoon, anime, 3d render" (when you want photorealism) |
Technique 6: Iterative Refinement
The most important skill is not writing the perfect prompt on the first try -- it is refining iteratively.
The loop:
- Start with a reasonable first prompt.
- Evaluate: what is good, wrong, or missing?
- Identify whether the gap is tone, accuracy, format, or depth.
- Adjust the prompt to address the specific gap.
- Repeat.
Example:
Attempt 1: Write a product description for wireless earbuds. -- Too generic.
Attempt 2: Write a product description for wireless earbuds. Target: commuters. Focus on noise cancellation and battery. Conversational, not salesy. -- Better, but includes features the product lacks.
Attempt 3:
Write a 75-word description for the SoundPro X3 earbuds.
Audience: daily commuters.
Features (only these):
- Active noise cancellation with transparency mode
- 8-hour battery, 32 hours with case
- IPX4 sweat resistance
Tone: conversational, confident, no superlatives. Focus on
solving commuter-specific problems.
This usually produces something usable. Save prompts that work well for recurring tasks in a simple document organized by category.
Technique 7: Context Windows and Long Inputs
When asking a model to work with existing content, paste it directly into the prompt rather than asking the model to recall information from training data:
Below is a customer interview transcript. Identify the top
5 pain points with a direct quote for each.
[paste transcript]
If content exceeds the model's context window, split it into logical sections, process each with consistent prompts, then synthesize.
Context Window Sizes
| Model | Context Window |
|---|---|
| GPT-4o | 128K tokens (~96K words) |
| Claude (Opus/Sonnet) | 200K tokens (~150K words) |
| Gemini 1.5 Pro | 1M+ tokens (~750K words) |
| Midjourney | ~350 words |
| DALL-E 3 | ~4000 characters |
Longer context does not always help. Models can lose focus in very long inputs -- a phenomenon called "lost in the middle." Place the most important instructions at the beginning and end.
Technique 8: Temperature and Parameters
Most tools expose parameters controlling output randomness:
- Low temperature (0.0-0.3): Deterministic, predictable. Good for factual tasks and code.
- Medium temperature (0.4-0.7): Balanced. Good for general writing and analysis.
- High temperature (0.8-1.0+): Creative, diverse. Good for brainstorming.
Other useful parameters include top-p (limits the token probability pool), max tokens (prevents unnecessarily long output), and frequency penalty (discourages repetition).
Templates for Common Tasks
Content Writing
Write a [type] about [topic].
Audience: [who] | Tone: [style] | Length: [count]
Key points: [list]
Avoid: [pitfalls]
Data Analysis
Analyze this data. Provide: (1) key trends, (2) three
outliers with explanations, (3) recommendations.
Use section headers and bullet points. Cite specific numbers.
[paste data]
Image Generation
[Subject], [action/pose], [setting], [lighting],
[camera angle], [style], [color palette], [mood]
--ar [ratio] --style [parameter]
Common Mistakes
Asking multiple questions at once. Models give shallow answers to all rather than deep answers to any. Break compound questions apart or instruct the model to address each one thoroughly.
Assuming context. "Can you update the report?" tells the model nothing. Provide full context every time.
Accepting the first output. Treat AI output as a first draft. Use follow-ups: "Make this more concise," "Add specific examples," "Rewrite the third paragraph more formally."
Over-engineering simple prompts. Add constraints only when you have observed a specific problem. If a simple prompt works, use it.
Conclusion
Prompt engineering is ultimately about clear communication. The same skills that make you good at briefing a colleague make you good at prompting AI: be specific, provide context, show examples when format matters, and iterate when the first attempt falls short.
The techniques here -- role setting, few-shot examples, chain-of-thought, format specification, constraints, negative prompts, and iterative refinement -- work across ChatGPT, Claude, Gemini, Midjourney, DALL-E, Stable Diffusion, and virtually every other AI tool. The syntax varies, but the principles are universal.
Start with the basics and add techniques as needed. The goal is not the cleverest prompt. The goal is useful output, efficiently. Save the advanced techniques for when simple approaches fall short.
Related Articles
How Large Language Models Work: A Non-Technical Guide to the AI Behind ChatGPT, Claude, and Gemini
How AI Generates Images: Diffusion Models Explained
The Science Behind AI Music Generation: How Neural Networks Compose
Ready to try Airbin?
Your AI assistant that remembers you. Find places, edit files, create anything. Get started for free.
Get Started