The Anatomy of a Well-Structured Prompt
গতকাল শিখেছো prompt একটা software — version হয়, measure হয়। আজ শিখবে prompt-এর ভেতরের গঠন: ৬টা অংশের anatomy, system/user/assistant role, delimiter style, placement rule, আর persona — এক বাক্যেই output বদলে দেওয়ার সবচেয়ে সস্তা lever।
- •একটা well-structured prompt-এর ৬টা অংশ চিনতে পারা: role, context, instructions, examples, input, output format। যেকোনো production prompt দেখে অংশগুলো নিজে label করতে পারা।
- •System prompt, user message, assistant message — তিনটার পার্থক্য আর কেন system হলো "persistent contract" — সেটা বলতে পারা।
- •তিন ধরনের delimiter চেনা — XML tags, triple quotes, markdown headers — আর কোন context-এ কোনটা ব্যবহার হয় বলতে পারা।
- •Placement rule মনে রাখা: long-context prompt-এ query/instructions বসবে শেষে (measured: up to 30% better)।
- •এক বাক্যে একটা persona prompt লিখতে পারা যা output-এর tone বা focus বদলে দেয়।
- •Day 5-এর English vocabulary (~১৫টা term) মুখে আসা — system prompt, user message, role, persona, delimiter, placement, context, instructions, output format — team meeting/PR review-এ confident ব্যবহারের জন্য।
- •Day 4 শেষ — "prompts as software" বসে গেছে। Test case, assertion, eval — এই vocabulary চেনা।
- •Day 3-এর attention concept মনে আছে — সেটাই আজকের "placement matters"-এর intuition।
- •ChatGPT/Claude-এ multi-turn conversation করার অভিজ্ঞতা থাকলে ভালো।
The Big Picture
একটা prompt আসলে ৬টা অংশের একটা contract — সেই anatomy দিয়ে শুরু।
Day 4-এ prompt-কে দেখেছো software হিসেবে — version হয়, test হয়, measure হয়। কিন্তু prompt-টা আসলে গঠন করবে কীভাবে? আজকের lesson-এর মূল কথা এক লাইনে: একটা ভালো prompt আসলে ৬টা অংশের একটা contract। Role, context, instructions, examples, input, output format — এই ৬টা label একবার চিনে গেলে যেকোনো production prompt পড়ে সাথে সাথে অংশগুলো আলাদা করে দেখাতে পারবে। আর Day 3-এর attention concept আজ কাজে লাগবে — prompt-এ information কোথায় বসছে, সেটাও output-এ পরিমাপযোগ্য পার্থক্য করে।
The six-part anatomyevery prompt's skeleton
প্রতিটা well-structured prompt-এ ৬টা logical section: Role (model কে), Context (background), Instructions (কী করবে), Examples (ভালো output কেমন), Input (এই turn-এর data), Output format (উত্তরের shape)। সব prompt-এ সব ৬টা লাগে না — কিন্তু label-গুলো universal। মনে করো রাফির complaint-bot: role = "support triage assistant", instructions = "ঠিক একটা label দাও", input = {{complaint}}, output format = enum label। একবার anatomy চিনলে যেকোনো production prompt-কে এভাবে ভেঙে ফেলতে পারবে।
এই vocabulary না থাকলে তুমি "আমার prompt কাজ করছে না" বলতে পারবে, কিন্তু কোথায় সমস্যা সেটা specify করতে পারবে না। Anatomy চিনলে বলতে পারবে "instructions clear কিন্তু output format unspecified" — সেটা actionable।
নিচে একটা production-ready structured prompt — কোড-review করার জন্য লেখা। প্রতিটা অংশের chip চেপে দেখো, কোন অংশ কী কাজ করছে।
Anatomy তো গেল prompt-এর ভেতরের গঠন। কিন্তু API call-এ prompt আসলে কীভাবে পাঠানো হয়? সেখানে আরেকটা layer আছে — system, user, আর assistant, এই তিনটা message role। পরের অংশে সেটা, তারপর role prompting, delimiter, placement, আর বাকি সব।
Core Concepts
System/user থেকে prompt template পর্যন্ত — ৮টা ধারণা।
System vs userthe contract and the ask
System prompt = persistent contract — role, constraints, style। পুরো conversation জুড়ে stable থাকে। User message = এই turn-এ user যা চাইছে — প্রতিবার বদলায়। Assistant message = model-এর reply, history-তে যোগ হয়। অফিসে ভাবো: boss শুরুতে একবার বলে দিল "তুমি আমার support team-এর হয়ে polite reply লিখবে" (system) — তারপর প্রতিটা নতুন complaint হলো একেকটা user message। Multi-turn chat = এই messages-এর stack; API call-এ তিনটাই messages array-তে যায়।
Module 2-এর প্রায় প্রতি lesson এই separation ধরে নেয়। AI coding agent workflow (Day 16-19), tool use (Day 15, 21), agent loop (Day 34) — সবগুলো system/user/assistant flow-এর উপর বসে।
Role promptingthe one-line lever
System prompt-এর প্রথম sentence — model এখন কে। "You are a senior backend engineer." এক বাক্যে tone, expertise level, vocabulary, focus — সব shift। Prompt-engineering best-practice সরাসরি বলে: even a single sentence makes a difference। কোনো magic phrase লাগে না — clear description দাও। রাফি "You are a customer-support triage assistant" বসালেই bot-এর reply আরও on-task হয়।
এটা lowest-effort, highest-leverage change। ৩-৪ শব্দের একটা role line output-এর audience-fit বিশাল বদলে দেয়। সহজ win — সবসময় try করো।
Delimiterssection markers
Section-গুলো আলাদা করার marker। ৩টা common family: XML tags (`<context>...</context>` — nested/structured style), triple quotes (`"""..."""` — simple quoted style), markdown headers (`## Context` — section-header style, project-instruction file-এ common)। সবগুলো structurally সমান — শুধু convention আলাদা। রাফি complaint-টা `<complaint>...</complaint>` দিয়ে wrap করলে model আর গুলিয়ে ফেলে না "এটা কি data না instruction?"। কোনটা use করবে: project/team-এর convention follow করো।
Delimiter ছাড়া লম্বা prompt = "এটা data না instruction?" — model confused। Delimiter দিলে unambiguous। Nested, multi-section prompt-এ XML সবচেয়ে robust choice।
Placement mattersrecency wins
লম্বা prompt-এ instruction কোথায় বসছে — সেটা output quality-তে মাপা-যায়-এমন পার্থক্য করে। একটা প্রকাশিত measurement: query/instructions prompt-এর শেষে রাখলে long-context multi-document task-এ up to 30% improvement। কারণ attention। Model recent token-এ বেশি জোর দেয় (Day 3)। তাই নিয়ম: লম্বা context আগে, query/instructions শেষে। রাফি ১০টা policy document + তারপর প্রশ্ন — প্রশ্নটা একদম নিচে রাখলে ভালো উত্তর।
Free 30% improvement — শুধু prompt-এর order ঠিক করে। RAG, long-document QA, multi-doc analysis — সব Module 4 task-এ এই নিয়ম critical। AI engineer-এর রোজকার instinct।
Clear and directthe golden rule
একটা useful framing: model-কে ভাবো একজন brilliant কিন্তু নতুন কর্মী হিসেবে, যে তোমার office-এর নিয়ম-কানুন কিছুই জানে না। Vague prompt = vague output। Specific + explicit হও। Golden rule: prompt-টা এমন একজন colleague-কে দেখাও যার minimal context আছে — সে confused হলে model-ও হবে। ভদ্র-polite ভাষা না — actionable specificity চাই।
Bengali speaker হিসেবে আমরা English-এ প্রায়ই over-polite লিখি ("Could you please possibly...")। Production prompt-এ এটা উল্টো hurt করে। Direct imperative চাই: "Do X. Output as JSON." — সংক্ষিপ্ত, clear।
Add contextexplain motivation
Instructions-এর সাথে কেন (motivation) যোগ করা শক্তিশালী। "Format in markdown" — generic markdown পাবে। "Format in markdown because we'll render in a GitHub README" — GitHub-friendly markdown পাবে (task list, emoji shortcut)। কেন বললে model একটা target পায়। freelance client-কে যেমন বলো "এই style-টা কারণ এটা তাদের brand" — তেমন।
Why যোগ করা prompt-কে একটু longer করে — কিন্তু smarter করে। Token cost সামান্য, output quality gain বড়।
Step-by-stepordered procedures
যখন order matter করে — "Step 1, Step 2, Step 3" দিয়ে number করো। Model এটাকে sequence হিসেবে নেয়, paragraph হিসেবে না। এটা established clarity tactic — অনেক prompt-engineering guide-এই recommend করা হয়। (এটা CoT chain-of-thought থেকে আলাদা — সেটা Day 13।)
Multi-step task-এ order ছাড়া model নিজে order বেছে নেয় — সবসময় সঠিক না। Step-by-step deterministic execution force করে।
Prompt template{{variable}} slots
Variable slot-যুক্ত prompt — `{{user_question}}`, `{{document}}`, `{{date}}`। Runtime-এ variable বসে, structure unchanged। Production-এর প্রতিটা prompt একটা template। রাফির `Categorize {{complaint}}` — সেটাও একটা template, যেটা Day 4-এ git-এ commit হয়েছিল। Eval config, prompt-management library, বা API-র messages array — সবই template-এর implementation।
Day 4-এর version control + Day 5-এর structure মিলে template = এটাই git-এ commit হয়। Day 8-এ তুমি প্রথম production template লিখবে।
৩টা ছোট change, প্রতিদিনের prompt-এ কাজে লাগবে — (১) vague না, specific-explicit লেখো; (২) instruction-এর সাথে "কেন" যোগ করো, model একটা target পায়; (৩) multi-step task হলে Step 1, Step 2 করে number করো। তিনটাই আজকের lesson-এর সরাসরি ফল।
Try It Yourself
পড়া বন্ধ — এবার নিজের হাতে।
৪টা interactive demo — message role stack থেকে persona swap পর্যন্ত।
একটা role line লিখেই output-এর tone আমূল বদলে দেওয়া যায় — নিচে একই প্রশ্নে ৩টা ভিন্ন persona try করে দেখো।
এবার delimiter — একই prompt, ৩টা ভিন্ন structural marker দিয়ে লেখা। কোনটা কখন ব্যবহার করবে, ট্যাব বদলে দেখো।
শেষ demo — placement। একই instruction, শুধু prompt-এর কোথায় বসছে সেটাই বদলে দিলে output quality-তে কী পার্থক্য হয় — নিজেই টগল করে দেখো।
Check Your Understanding
ভুল হলে সমস্যা নেই — প্রতিটার ব্যাখ্যা আছে।
System prompt আর user message মূলত একই — শুধু label আলাদা
XML tags পুরোনো — modern prompt-এ এগুলো লাগে না
Prompt-এ instruction কোথায় বসছে — সেটা আসলে matter করে না
Persona / role prompting roleplay-জাতীয় ফালতু জিনিস
Prompt যত polite + flowery, output তত ভালো
Model-কে "কেন" বলা মানে token নষ্ট
Step-by-step instructions শুধু prompt ভারী করে
System prompt আর user message-এর core পার্থক্য কী?
ভুল হলেও সমস্যা নেই — প্রতিটা option-এর সাথে ব্যাখ্যা আছে।
প্রকাশিত measurement অনুযায়ী long-context multi-document task-এ query কোথায় বসালে সেরা result?
ভুল হলেও সমস্যা নেই — প্রতিটা option-এর সাথে ব্যাখ্যা আছে।
Multi-section, nested-data prompt-এ কোন delimiter style সবচেয়ে robust (widely recommended) পছন্দ?
ভুল হলেও সমস্যা নেই — প্রতিটা option-এর সাথে ব্যাখ্যা আছে।
Prompt engineering-এর "golden rule" — prompt যথেষ্ট clear কিনা যাচাইয়ের?
ভুল হলেও সমস্যা নেই — প্রতিটা option-এর সাথে ব্যাখ্যা আছে।
একটা well-structured prompt-এর ৬টা logical part কোনগুলো?
ভুল হলেও সমস্যা নেই — প্রতিটা option-এর সাথে ব্যাখ্যা আছে।
নিচের কোনটা সেরা persona / role prompt example?
ভুল হলেও সমস্যা নেই — প্রতিটা option-এর সাথে ব্যাখ্যা আছে।
Prove It To Yourself
চারটা ধারণা মনে রাখো। নিজের ভাষায় লেখো। Day 5 শেষ।
চারটা ধারণা মনে রাখো — একটা prompt-এর ৬টা অংশ থাকে: role, context, instructions, examples, input, output format; সবগুলো সবসময় লাগে না, কিন্তু label-গুলো universal। System prompt persistent contract, user message current ask — behavior/style system-এ যায়, per-turn data user-এ। লম্বা prompt-এ query/instructions শেষে রাখলে measurable improvement — recency-ই জেতে, শুধু prompt-এর order ঠিক করেই। আর persona-ই সবচেয়ে সস্তা বড় win — এক sentence, "You are X" — tone/expertise/focus সব shift।
আজকের শব্দগুলো — system prompt, user message, assistant message, role, persona, delimiter, XML tag, placement, context, instructions, output format, clear and direct, step-by-step — এখন থেকে English-ই থাকবে; team meeting, PR review, docs-এ এভাবেই দেখবে। কাল কেউ "delimiter" বললে তুমি জানো সেটা কী। পুরো তালিকা নিচের glossary-তে।
শব্দার্থ — পরে ফিরে দেখার জন্য
একনজরে সব key term। কোনো শব্দ ভুলে গেলে এখানে এসে খুঁজে নিও।
- Act as
- Persona declare করার common English phrasing — "Act as a senior reviewer।" Prompt-engineering example-এ frequent।
- Assistant message
- Model-এর reply — multi-turn history-তে যোগ হয়। API-তে role: "assistant"।
- Chain of thought (preview)
- Model-কে "think step by step" বলে reasoning বের করতে বলা — Day 13-এর topic, এখানে শুধু term-টা জানিয়ে রাখা।
- Chat completion
- API endpoint যা messages array নেয় (system + user + assistant history) — modern LLM API-র standard।
- Clear and direct
- Prompt-engineering-এর জনপ্রিয় phrase — vague polite-এর বদলে specific actionable ভাষা। "Do X. Output Y."
- Context
- Model-কে দেওয়া background — situation, constraints, history। সাধারণত delimiter দিয়ে wrap করা একটা section।
- Delimiter
- Section আলাদা করার marker — XML tag, triple quote, markdown header — তিনটাই common।
- Few-shot (preview)
- Prompt-এ ২-৫টা example দেওয়া — model দেখে pattern follow করে। Day 9-এর topic।
- Golden rule
- Clarity check: minimal-context colleague confused হলে model-ও হবে।
- Input
- এই turn-এ model কীসের উপর কাজ করছে — raw data, variable-এ inject হয়।
- Instructions
- Model কী করবে — actionable, প্রায়ই numbered। Prompt-এর core।
- Markdown header
- ## Header — coding agent-এর project-instruction file-এ standard structural marker।
- Output format
- উত্তর কী shape-এ — JSON, markdown, bullet list, plain prose। Downstream automation-এর জন্য crucial।
- Persona
- Role-এর কাছাকাছি — character বা style emphasis। "You are a friendly teacher"-এর মতো।
- Placement
- Prompt-এ information কোথায় বসছে — top vs bottom। লম্বা context-এ placement output quality মাপা-যায়-ভাবে বদলায়।
- Prompt template
- Variable slot-যুক্ত prompt — `{{variable}}` syntax। Runtime-এ value inject।
- Role
- Model এখন কে — সাধারণত system prompt-এর first sentence। "You are X।"
- Step-by-step
- Numbered sequential instructions — order-matter-করা task-এ। CoT-এর সাথে গুলিয়ে ফেলো না।
- System prompt
- Persistent contract — পুরো conversation জুড়ে stable। Role, constraints, style এখানে।
- Triple quotes
- """ delimiter — practitioner guide-এ প্রচলিত একটা pattern, Python-friendly দেখায়।
- User message
- এই turn-এ user-এর আসল ask। প্রতিবার বদলায়।
- XML tag
- `<context>...</context>` style — জটিল/nested prompt-এর জন্য সবচেয়ে robust structural marker, অনেক modern model এই pattern ভালো parse করে।
Sources consulted to author this lesson. Citation style is informal — follow the links if you want to dig deeper.
- Prompting best practices — Anthropic (2025)
- Prompt engineering — Write clear instructions — OpenAI (2024)
- Cursor Rules and AGENTS.md Examples — Cursor / community (2025)
- Prompt Engineering — Lilian Weng (2023)
- Annotated prompt engineering — Simon Willison (2024)
দুই বাক্যে নিজের ভাষায় লেখো
নিজের ভাষায় দুই বাক্যে লেখো — একটা prompt-এর ৬টা অংশ কী কী, আর দীর্ঘ context-ওয়ালা prompt-এ instruction/query কোথায় বসালে সবচেয়ে ভালো result পাওয়া যায়।