Prompting 102: task, context, output, constraintsPrompting 102: task, context, output, constraints
เรียนโครง prompt 4 ส่วนที่ช่วยให้คำตอบ AI ชัดขึ้น เดาน้อยลง และนำไปใช้ในงานประจำวันได้จริงLearn the four-part prompt structure that makes AI responses less vague and more useful for everyday work.
A weak prompt usually hides the real assignment in your head.
You know the deadline, audience, tone, risk, and desired output. The AI does not.
The easiest fix is a four-part prompt:
Task
Context
Output
Constraints
Task
The task is the verb. It tells AI what kind of work to do.
Good task words:
- rewrite
- summarize
- compare
- explain
- translate
- draft
- critique
- extract
- classify
- plan
Weak:
Help me with this.
Better:
Summarize this meeting note into action items.
Better still:
Summarize this meeting note into action items for the project owner.
Context
Context is the information that changes the answer.
Ask yourself:
- Who is this for?
- What happened before this?
- What does the reader already know?
- What does the AI need to avoid?
- What would make the answer wrong?
Example:
Context:
- This is for a client who already approved the budget.
- The project is delayed by one week because the design assets arrived late.
- We want to stay accountable without blaming the client.
Good context is not everything you know. It is the information that helps the model choose correctly.
Output
Output tells the model what shape to produce.
Be concrete:
Output:
- Thai email
- 100-150 words
- subject line + body
- polite but direct tone
Without output instructions, the model chooses its own format. That might be a paragraph, a table, a list, or a lecture.
Constraints
Constraints are boundaries.
Examples:
Constraints:
- Do not mention price.
- Do not promise a delivery date.
- Keep the original meaning.
- Use plain Thai, not corporate jargon.
- If information is missing, ask before writing.
Constraints are where many prompts become professional. They prevent the model from being helpful in the wrong direction.
The four-part template
Copy this:
Task:
[what work should AI do?]
Context:
[who, situation, goal, background]
Output:
[format, language, length, tone]
Constraints:
[must keep, must avoid, ask if missing]
Example: rough to useful
Rough:
Make this sound better.
Useful:
Task:
Rewrite this message for a customer.
Context:
The customer asked why the invoice is higher than expected. The extra cost comes from two approved add-ons.
Output:
Thai message, 3 short paragraphs, polite and clear.
Constraints:
Do not sound defensive. Do not offer a discount. Mention that the add-ons were approved on May 3.
Text:
[paste message]
Practice
Take one real AI request you made recently. Rewrite it into the four-part template.
Then check:
- Does the task start with a clear verb?
- Did you include only useful context?
- Is the output shape visible?
- Did you add at least one boundary?
References
- Google Gemini Prompt Design Strategies recommends clear instructions, constraints, prefixes, and breaking complex prompts into components.
- OpenAI Prompt Engineering describes how instructions, examples, and context can be separated for clearer model behavior.
- Microsoft Foundry Prompt Engineering Techniques recommends clear syntax and task decomposition.
prompt ที่อ่อนมักซ่อนงานจริงไว้ในหัวของเรา
เรารู้ deadline, audience, tone, risk และ output ที่อยากได้ แต่ AI ไม่รู้
วิธีแก้ที่ง่ายที่สุดคือ prompt 4 ส่วน:
Task
Context
Output
Constraints
Task
Task คือกริยา บอก AI ว่าต้องทำงานแบบไหน
คำที่ใช้เริ่ม task ได้ดี:
- rewrite
- summarize
- compare
- explain
- translate
- draft
- critique
- extract
- classify
- plan
อ่อน:
ช่วยดูอันนี้ให้หน่อย
ดีขึ้น:
Summarize this meeting note into action items.
ดีกว่านั้น:
Summarize this meeting note into action items for the project owner.
Context
Context คือข้อมูลที่ทำให้คำตอบเปลี่ยน
ลองถามตัวเอง:
- งานนี้ทำให้ใคร?
- ก่อนหน้านี้เกิดอะไรขึ้น?
- คนอ่านรู้อะไรอยู่แล้ว?
- AI ต้องหลีกเลี่ยงอะไร?
- อะไรจะทำให้คำตอบผิด?
ตัวอย่าง:
Context:
- This is for a client who already approved the budget.
- The project is delayed by one week because the design assets arrived late.
- We want to stay accountable without blaming the client.
context ที่ดีไม่ใช่ทุกอย่างที่เรารู้ แต่คือข้อมูลที่ช่วยให้ model เลือกคำตอบได้ถูกขึ้น
Output
Output บอก model ว่าต้องส่งงานออกมาในรูปแบบไหน
เขียนให้จับต้องได้:
Output:
- Thai email
- 100-150 words
- subject line + body
- polite but direct tone
ถ้าไม่บอก output model จะเลือกรูปแบบเอง อาจเป็น paragraph, table, list หรือคำอธิบายยาวๆ ก็ได้
Constraints
Constraints คือขอบเขต
ตัวอย่าง:
Constraints:
- Do not mention price.
- Do not promise a delivery date.
- Keep the original meaning.
- Use plain Thai, not corporate jargon.
- If information is missing, ask before writing.
ตรงนี้คือส่วนที่ทำให้ prompt ดูเป็นมืออาชีพ เพราะมันป้องกันไม่ให้ AI ช่วยผิดทาง
template 4 ส่วน
คัดลอกโครงนี้:
Task:
[อยากให้ AI ทำงานอะไร?]
Context:
[ใคร, สถานการณ์, เป้าหมาย, พื้นหลัง]
Output:
[format, language, length, tone]
Constraints:
[ต้องเก็บไว้, ต้องหลีกเลี่ยง, ถ้าข้อมูลไม่พอให้ถาม]
ตัวอย่างจากกว้างไปชัด
กว้าง:
ช่วยทำให้อันนี้ดูดีขึ้น
ชัด:
Task:
Rewrite this message for a customer.
Context:
The customer asked why the invoice is higher than expected. The extra cost comes from two approved add-ons.
Output:
Thai message, 3 short paragraphs, polite and clear.
Constraints:
Do not sound defensive. Do not offer a discount. Mention that the add-ons were approved on May 3.
Text:
[paste message]
แบบฝึก
เลือก request จริงที่คุณเคยถาม AI เมื่อไม่นานนี้ แล้ว rewrite เป็นโครง 4 ส่วน
ตรวจด้วยคำถามนี้:
- task เริ่มด้วยกริยาที่ชัดไหม?
- context ที่ใส่จำเป็นจริงไหม?
- เห็นรูปแบบ output ชัดไหม?
- มี boundary อย่างน้อยหนึ่งข้อไหม?
แหล่งอ้างอิง
- Google Gemini Prompt Design Strategies แนะนำ clear instructions, constraints, prefixes และการแยก prompt ซับซ้อนเป็นส่วนๆ
- OpenAI Prompt Engineering อธิบายการแยก instructions, examples และ context เพื่อให้ model ทำงานชัดขึ้น
- Microsoft Foundry Prompt Engineering Techniques แนะนำ clear syntax และ task decomposition
เข้าสู่ระบบเพื่อบันทึกความคืบหน้าSign in to track your progress
เข้าสู่ระบบSign in→