Prompt Engineering: How to Get Great Answers from AI
The same AI gives brilliant or useless answers depending on how you ask. Learn prompt engineering — being specific, adding context, roles, examples and step-by-step reasoning — with clear before-and-after prompts.
Here's something you'll notice fast: two people can ask ChatGPT the "same" question and get wildly different results — one gets a vague paragraph, the other gets exactly what they needed. The difference isn't the AI; it's the prompt. In Lesson 20 you learned an LLM predicts the next token based on your input, so your input steers everything. Prompt engineering is the skill of asking well — and it's arguably the highest-return AI skill you can learn today. No coding required.
What a prompt really is
A prompt is just your instruction to the model. Because the LLM continues from what you give it, a clear, detailed prompt narrows it toward the answer you want, while a vague one leaves it guessing. You're not "programming" — you're communicating, the way you would to a very fast, very well-read assistant who takes you completely literally.
The anatomy of a great prompt
Most strong prompts contain four ingredients. You don't always need all four, but keeping them in mind instantly upgrades your asking.
Technique 1: Be specific
Vague in, vague out. Tell the model exactly what you want — topic, length, audience, angle.
"Write about marketing."
"Write a 150-word Instagram caption for a small coffee shop's new winter menu, friendly and warm, with 3 relevant hashtags."
Technique 2: Give context
The model knows nothing about your situation unless you tell it. A sentence of background changes the whole answer.
"Is this a good idea?"
"I'm a final-year student with 6 months and no budget. Is building a personal portfolio website a good idea to get a first developer job? Give pros, cons and a simpler alternative."
Technique 3: Assign a role
Telling the model who to be shifts its tone, depth and vocabulary. "Act as a…" is one of the most powerful two-word upgrades you can make.
"Act as a patient interview coach. Ask me one common data-analyst interview question, wait for my answer, then give feedback."
Technique 4: Show examples (few-shot)
If you want a specific style or pattern, show one or two examples rather than describing it. This is called few-shot prompting, and it's remarkably effective.
"Turn product names into taglines. Example: 'SolarMug' → 'Coffee that charges your day.' Now do: 'QuietDesk' →"
Technique 5: Ask for step-by-step reasoning
For anything involving logic, math or planning, adding "think step by step" pushes the model to work through the problem instead of blurting a guess — often turning a wrong answer into a right one. (This is the everyday version of chain-of-thought prompting.)
"A shirt costs ₹800 after a 20% discount. What was the original price? Think step by step, then give the final answer."
Technique 6: Specify the output format
Want a table? A JSON object? A bullet list of exactly five items? Ask for it explicitly and you'll get something you can use directly.
"List 5 beginner Python project ideas as a table with columns: Project, Skill practised, Difficulty (1–5)."
Iterate — it's a conversation, not a slot machine
Your first prompt rarely needs to be perfect. Treat the reply as a draft and refine: "shorter," "more formal," "add a real-world example," "now rewrite it for a 10-year-old." Because the model remembers the conversation (its context window from Lesson 20), each nudge builds on the last. Great results usually come from the third or fourth message, not the first.
Common mistakes to avoid
| Mistake | Fix |
|---|---|
| Too vague | Add specifics: audience, length, tone, format. |
| Asking for 10 things at once | Break it into steps; build up across messages. |
| Trusting facts blindly | Verify — remember hallucinations (Lesson 20). |
| Giving up after one try | Iterate; tell it what to change. |
Putting it all together
Here's a prompt that stacks role, task, context and format into one clear request — the kind that reliably gets a genuinely useful answer:
"You are a friendly career mentor. I'm a 2nd-year commerce student curious about data analytics but I know no coding. Suggest a realistic 3-month learning plan. Format it as a week-by-week table with columns: Weeks, Focus, Free resource. Keep it encouraging and under 250 words."
The golden rule: the AI can't read your mind — it can only read your prompt. The clearer your ask, the better your answer.
Prompt engineering is the skill that made AI genuinely useful in my day rather than a novelty — once I started writing prompts with a role, clear task and a format I actually wanted, the quality jump was night and day, and I stopped blaming the tool for lazy questions. I'd suggest saving 3–4 prompts that work well for you as reusable templates; that small habit compounds fast.
Key takeaways
- Prompt engineering = communicating clearly with an AI; it's the highest-ROI, no-code AI skill.
- Strong prompts often combine Role + Task + Context + Format.
- Be specific, give context, assign a role, and show examples (few-shot) for a target style.
- Add "think step by step" for logic problems, and specify the exact output format you want.
- Iterate — refine across messages, and always verify important facts.
Continue the series: ← Lesson 20: Large Language Models (LLMs) · Next: Lesson 22 — RAG: Giving AI Your Own Data (and Fewer Hallucinations) →
Frequently Asked Questions
What is prompt engineering?
Prompt engineering is the skill of writing clear, well-structured instructions for an AI so it gives you the answer you actually want. Because a large language model continues from your input, a specific, detailed prompt produces far better results than a vague one — and it requires no coding.
What makes a good prompt?
Good prompts usually combine four elements: a role (who the AI should act as), a task (what to do), context (your situation and audience), and a format (how the answer should look). Being specific about length, tone and output format makes the biggest difference.
What is few-shot prompting?
Few-shot prompting means giving the AI one or two examples of the pattern or style you want, instead of only describing it. Showing an example like 'SolarMug -> Coffee that charges your day' teaches the model the format far more reliably than explaining it in words.
Why does adding 'think step by step' help?
For logic, math or planning tasks, asking the model to think step by step makes it work through the problem in stages rather than guessing an immediate answer. This chain-of-thought approach often turns an incorrect quick answer into a correct, well-reasoned one.