Module 2.1: Anatomy of a Good Prompt

YOUR PROGRESS — GENERATIVE AI: ZERO TO JOB-READY ← Course home
4 of 20 modules complete
GENERATIVE AI: ZERO TO JOB-READY  ›  UNIT 2  ›  MODULE 1 OF 4

Anatomy of a Good Prompt

⏱ 14 min read 📝 Assignment inside Hands-on examples

Welcome to Unit 2. In Unit 1 you built a mental model of what GenAI is and where it fails. Now you start using it effectively.

This module teaches the single most important practical skill in this course: how to write a prompt that actually gets what you want. Most people who are disappointed with AI outputs are not using a bad tool — they are writing bad prompts. The model is only as good as the instructions you give it.

By the end of this module you will be able to break any task down into a structured prompt that produces consistent, high-quality output from any tool.


Why most prompts fail

Before learning what makes a good prompt, look at what makes a bad one.

✗ WHAT MOST PEOPLE TYPE
write a report on machine learning
✓ WHAT ACTUALLY WORKS
You are a technical writer creating study material for final-year BTech students in India.

Write a 400-word overview of supervised machine learning. Cover: what it is, how training works, and 2 real-world applications relevant to Indian industry (e.g. banking fraud detection, crop yield prediction).

Use simple language. No jargon without explanation. End with 3 bullet points summarising the key ideas.

The bad prompt is not wrong — it is just empty. The model has no idea who you are, what level of detail you need, what format you want, or what context matters. So it produces a generic, mediocre response.

The good prompt gives the model everything it needs to produce exactly what you want on the first try.

The core principle: A prompt is a specification, not a question. The more precisely you define the output, the better the output will be. In 2026, prompt engineering is not about writing longer prompts — it is about writing clearer specs.

The six components of a well-structured prompt

Every effective prompt is built from some combination of these six components. You do not need all six every time — but knowing each one lets you diagnose why a prompt is failing and fix it.

1
Role  optional but powerful
Tell the model who it is. This sets the tone, vocabulary, and depth of the response. A response from "a senior software engineer" will read very differently from "a patient teacher explaining to a beginner."
"You are a senior Python developer reviewing code for a fintech startup." "You are a placement counsellor at an Indian engineering college." "You are a concise technical writer who avoids jargon."
2
Task  required
The clear, specific instruction — what you want the model to do. Use action verbs: write, summarise, explain, compare, list, debug, translate, review. Vague tasks produce vague outputs.
✗ "tell me about neural networks" ✓ "Explain how a neural network learns, step by step, using a simple analogy" ✓ "Summarise this job description in 3 bullet points highlighting required skills"
3
Context  highly recommended
Background information the model needs to give you a relevant answer. Without context, the model guesses your situation. With context, it can tailor the response precisely to your needs.
"I am a 3rd-year ECE student applying for a software internship at Infosys." "This code is part of a Django REST API serving 10,000 users per day." "The audience is non-technical HR managers at Indian manufacturing companies."
4
Format  recommended
Specify how you want the output structured. Without this, the model picks a format — which may not suit your use case. This is one of the fastest ways to improve prompt output quality.
"Respond in bullet points, maximum 5 points." "Format as a table with columns: Tool | Best for | Free tier | India pricing" "Write in plain paragraphs. No bullet points. Under 300 words." "Output only the corrected code. No explanation."
5
Examples  optional but high-impact
Show the model what a good output looks like. This is called few-shot prompting (covered in Module 2.2) and is one of the highest-ROI prompt techniques available. Even one example dramatically improves output consistency.
"Here is an example of the tone I want: Example: 'Pandas makes data manipulation intuitive — think of it as Excel, but scriptable.' Now explain NumPy in the same style."
6
Constraints  optional
Boundaries and exclusions — what to avoid, length limits, what not to include. Constraints are how you prevent the model from going off in a direction you do not want. In 2026, writing clear constraints is as important as writing clear instructions.
"Do not use technical jargon." "Keep the response under 150 words." "Do not suggest paid tools — only free options." "Do not repeat points already covered in the introduction."

Seeing all six in action

Here is the same task — asking for help preparing for a job interview — written as a weak prompt, then rebuilt using all six components.

✗ WEAK PROMPT
help me prepare for a TCS interview

What is wrong with this? The model does not know your background, the role you are applying for, what stage of interview preparation you are at, how much time you have, or what format of help you want. The output will be a generic list that could apply to anyone applying anywhere.

✓ STRUCTURED PROMPT — all 6 components
You are an experienced placement mentor at a top Indian engineering college. [ROLE]

I have a TCS NQT technical interview in 5 days. [CONTEXT] I am a final-year CSE student. I am comfortable with Python and data structures but weak on DBMS and OS concepts.

Create a 5-day preparation plan. [TASK]

Format it as a day-by-day table: Day | Topics | Resources (free only) | Practice tasks. [FORMAT]

Keep each day’s plan achievable in 3 hours. [CONSTRAINT] Do not include topics like networking or compiler design — those are not in TCS NQT scope. [CONSTRAINT]

The second prompt will produce a personalised, structured, immediately usable preparation plan — not a generic bullet list. The difference in output quality will be dramatic, and it took about 60 seconds longer to write.


The most common prompt mistakes — and how to fix them

MistakeWhat happensFix
No task verb"Machine learning in healthcare" — the model does not know if you want a summary, a tutorial, a list of companies, or an essayAlways start with an action verb: explain, write, list, compare, debug, summarise, translate
No audience specifiedThe model defaults to a generic educated adult — too advanced for beginners, too basic for expertsAdd "for a [role/level]" — "for a 2nd-year BTech student" or "for a non-technical manager"
No format requestedThe model picks a format — often long flowing paragraphs when you wanted bullet points, or vice versaAdd explicit format: "respond in a table", "use bullet points", "write in plain paragraphs under 200 words"
Asking multiple questions at once"Explain ML, list Python libraries, and tell me how to get a job in AI" — the model rushes all three and does none wellOne task per prompt. Break multi-part work into sequential prompts in the same conversation
No context about purpose"Write an email about the project delay" — the model invents details: who delayed what, for whom, at what severity levelPaste in the relevant context: "The email is to my project manager at Wipro. The delay is 3 days due to a dependency on the API team."
Accepting the first outputFirst outputs are often good but not great. Most people stop here and miss 30–40% quality improvementFollow up with refinement prompts: "Make it more concise", "Add a specific Indian banking example", "Rewrite the introduction — it is too formal"

Tool-specific tips for Indian users

Different tools respond slightly differently to the same prompt structure. Here is what to know:

ChatGPT responds well to numbered instructions and crisp numeric constraints ("3 bullets", "under 50 words"). It infers intent well even from shorter prompts — you can often start with a medium-detail prompt and refine in follow-ups.

Claude works best with contract-style instructions — explicit goals, clear output format, and tone cues. It tends to over-explain unless you set a length constraint. Add "be concise" or "keep under 300 words" explicitly.

Gemini prefers shorter, more direct prompts than the other two. Place specific questions at the end of your prompt, after any context. Google's own prompt guidelines recommend always including at least one example for complex tasks.

The prompt improvement loop

Writing a good prompt is rarely a one-shot activity — it is an iterative loop. Here is the workflow that experienced prompt engineers use:

Prompt improvement loop: Write a draft prompt, review the output, identify what is missing or wrong, refine the prompt, repeat until satisfied1. Writedraft promptwith 6 components2. Reviewread the outputcritically3. Diagnosewhat componentis missing?4. Refineadd or clarifymissing component5. Done?yes → use outputno → back to 3

Most prompts need 2–3 iterations to reach high quality. This is not a failure — it is the normal workflow. Each iteration teaches you something about what the model needs from you, and over time your first-draft prompts improve because you have internalised what “missing components” look like.


A practical template to start with

Until writing structured prompts feels natural, use this template for any task:

STARTER TEMPLATE — copy and fill in the blanks
You are a [ROLE].

I need you to [TASK — action verb + what].

Context: [WHO YOU ARE + WHAT THIS IS FOR].

Format: [HOW YOU WANT THE OUTPUT].

Constraints: [WHAT TO AVOID OR LIMIT].

[Optional: Here is an example of the style/format I want: …]

You will not need this template forever — after 20–30 prompts, structuring this way becomes instinctive. But use it consciously for the next week and your output quality will improve immediately.


The three things to remember

KEY TAKEAWAYS — MODULE 2.1
  1. A prompt is a specification, not a question — the more precisely you define role, task, context, format, examples, and constraints, the better the output. Vague prompts produce vague results.
  2. The six components are your diagnostic toolkit — when a prompt gives a bad output, check which component is missing. Adding the missing piece is almost always faster than rewriting the prompt from scratch.
  3. Refinement is the workflow, not a fallback — professional prompt engineers iterate 2–3 times per task. Accepting the first output and blaming the tool is the most common mistake beginners make.

Assignment 2.1 — Rewrite 3 Weak Prompts Using the 6 Components

This is the core skill-building exercise for Unit 2. Each rewrite should take 5–10 minutes.

  1. Take these three weak prompts and rewrite each one using the six-component structure:
    • explain data structures
    • write a LinkedIn post about my project
    • how do I get a job in AI
  2. For each rewrite, explicitly label which components you used — Role, Task, Context, Format, Examples, Constraints. Not all six are required, but you should consciously choose which ones to include and why.
  3. Test your rewritten prompts in ChatGPT, Claude, or Gemini (free tier). Compare the output quality to what the weak prompt would produce.
  4. Add your rewrites to your AI Learning Journal (started in Assignment 1.4). Note which components made the biggest difference to the output quality.

There are no perfect answers — the goal is to practise conscious prompt construction. You will use these same techniques throughout Units 2, 3, and 4.

Sources and references
ClaimSource
Six prompt components frameworkLakera Prompt Engineering Guide 2026; promptbuilder.cc 2026
"Prompt engineering is writing clearer specs" (2026 framing)promptbuilder.cc Prompt Engineering Best Practices 2026
ChatGPT crisp numeric constraints; Claude over-explains without constraints; Gemini prefers shorter direct promptsLakera Prompt Engineering Guide 2026; Thomas Wiegold blog February 2026
Few-shot remains one of highest-ROI techniques; try zero-shot before few-shotThomas Wiegold Prompt Engineering Best Practices 2026
Google recommends placing specific questions after context; few-shot preferred over zero-shot for GeminiGoogle Gemini prompt engineering whitepaper, cited in Thomas Wiegold 2026