Prompt Engineering & Working With AI
You've learned how LLMs process language. Now it's time to learn how to talk to them effectively. The quality of what you get out of an AI depends heavily on the quality of what you put in.
After this lesson, you'll be able to:
- ✓ Apply zero-shot, few-shot, and chain-of-thought prompting techniques
- ✓ Understand how system prompts shape AI behavior
- ✓ Use temperature settings to control output creativity
What is Prompt Engineering?
Prompt engineering is the practice of crafting effective inputs (prompts) to get the best outputs from an LLM. It's not about tricking the AI — it's about communicating clearly so the model understands exactly what you need.
Think of it this way: if you asked a new coworker to "write something about our product," you'd get a very different result than if you said "write a 200-word product description for our homepage, targeting small business owners, in a friendly but professional tone." The same applies to AI.
Key Techniques
Temperature: Controlling Creativity
Temperature is a number (usually between 0 and 2) you set when you send a request to a model. It controls how predictable or random the output feels. The name is borrowed from physics — low temperature = frozen and orderly, high temperature = chaotic — and the same metaphor applies here: low values keep the output safe and repeatable, high values let the model take more risks with word choice.
Where do you actually set it? You won't find a temperature slider inside ChatGPT or Claude's chat apps — those companies pick a value for you. You'll see it when you use a developer "playground" tool (like OpenAI's Playground or Anthropic's Console) or when you call the model from code.
Temperature is a continuous slider, not a switch. The two cards below show the two ends of the dial; most real-world use sits somewhere in between.
Low Temperature (close to 0)
Great for factual tasks, code generation, and consistent answers. The model picks the most likely word every time.
High Temperature (~0.8–1.5)
Great for brainstorming, creative writing, and exploring diverse ideas. The model is more willing to pick words that aren't the top choice.
The accepted range varies by provider — OpenAI accepts 0 to 2, Anthropic 0 to 1. Pushed toward the upper end, the output starts to feel incoherent rather than creative.
Real-World Example: Prompt Engineering in Practice
Developers working with AI coding agents often keep a project-level file (commonly named CLAUDE.md) that acts as a persistent system prompt. It describes what the project is, what design rules to follow, and what tone to use — so every session starts with the right context instead of re-explaining everything from scratch.
The payoff is consistency: the AI produces code that matches the project's style because the rules are always in front of it. It's prompt engineering applied to a real workflow, not a one-off prompt trick.
Be specific. Instead of "write about dogs," try "write a 150-word paragraph about why golden retrievers make great family pets."
Provide context. Tell the model who the audience is, what the purpose is, and any constraints. The more context, the better the output.
Give examples. If you want a specific format or style, show the model what good output looks like (few-shot prompting).
Specify the format you want. Say "respond as a bulleted list," "use markdown," or "return JSON" — don't leave the format to chance.
Iterate and refine. Your first prompt rarely produces the perfect result. Treat it as a conversation — give feedback, adjust your prompt, and try again. Prompt engineering is an iterative process.
Key Takeaway
How you communicate with AI determines what you get back. Zero-shot, few-shot, and chain-of-thought are your core techniques. System prompts set the rules. Temperature controls creativity. Prompt engineering is an iterative skill, not a one-time trick.
Try This (Optional)
Take a recent prompt you've sent to ChatGPT or Claude and identify which technique it used (zero-shot, few-shot, chain-of-thought, or none of the above). Then rewrite it using a different technique and notice what shifts about the response — tone, structure, accuracy, or all three.
Knowledge Check
You want an AI to write a professional email, so you show it 3 examples of good professional emails first, then ask it to write one. What technique is this?
When would you use a low temperature setting (close to 0)?