Context Management 104: examples และ constraintsContext Management 104: examples and constraints
ใช้ examples, non-examples, acceptance criteria และ constraints เพื่อให้ output ของ AI ตรงกับงานจริงที่ต้องการUse examples, non-examples, acceptance criteria, and constraints to make AI output match the work you actually need.
Examples are some of the strongest context you can give AI.
A rule says what you want. An example shows what you mean.
Why examples work
Compare these two instructions:
Write in a clear, practical style.
and:
Use this style:
- short paragraphs
- direct explanations
- concrete examples
- no hype
- Thai terms can keep common English words like task, context, output
Example:
[paste a short sample]
The second version is easier to follow because the model sees the pattern.
Use one good example first
Start with one strong example instead of ten weak examples.
A good example should be:
- close to the task
- short enough to inspect
- clean enough to copy patterns from
- labeled with what makes it good
Example:
Good example:
[paste example]
Why it is good:
- opens with the decision
- uses beginner language
- includes one exercise
- avoids selling the paid course
The explanation matters. It tells the model what to imitate.
Add a non-example
A non-example shows what to avoid.
Do not write like this:
[paste weak example]
Why this is wrong:
- too abstract
- uses buzzwords
- no concrete practice
- implies a certificate that the free workshop does not include
Non-examples are useful when the model keeps drifting into a pattern you dislike.
Constraints are boundaries
Constraints tell the model what must stay true.
Good constraints:
Constraints:
- Thai is the default language.
- Keep product name as "Mervia Academy".
- Do not promise instructor access.
- Use /workshops/{slug}/ route examples.
- Keep each section under 120 words.
Weak constraints:
Make it good.
Make it premium.
Make it modern.
If a constraint is subjective, make it observable.
Instead of:
Make it beginner-friendly.
use:
Beginner-friendly means:
- explain new terms the first time they appear
- avoid assuming coding knowledge
- include one copy-paste template
- end with one practice task
Acceptance criteria
Acceptance criteria are checks for the final output.
Acceptance criteria:
- Includes English and Thai sections.
- Has one practical template.
- Includes one exercise.
- Does not mention paid access.
- Ends with the next lesson link.
This helps both the model and the human reviewer.
Put examples after the task brief
A useful order is:
Task brief
Sources
Examples
Non-examples
Constraints
Output format
Acceptance criteria
Do not hide the task after long examples. The model should know the job before reading patterns.
Practice: build an example pack
Choose a task you often give AI.
Create this context block:
Task:
Good example:
Why this example is good:
Non-example:
Why this example is wrong:
Constraints:
Acceptance criteria:
Then ask AI to produce one new output and explain which parts of the example it followed.
Next: Context Management 105 - compress and refresh context.
example คือ context ที่แรงมากสำหรับ AI
rule บอกว่าคุณต้องการอะไร example แสดงให้เห็นว่าหมายถึงอะไร
ทำไม example ได้ผล
เปรียบเทียบสองคำสั่งนี้:
เขียนให้ชัด practical
กับ:
ใช้ style นี้:
- paragraph สั้น
- อธิบายตรง
- มีตัวอย่าง concrete
- ไม่ hype
- Thai term สามารถคง English words ที่ใช้บ่อย เช่น task, context, output
Example:
[paste sample สั้น]
แบบที่สองทำตามง่ายกว่า เพราะ model เห็น pattern
เริ่มจาก example ดีๆ หนึ่งอัน
เริ่มด้วย strong example หนึ่งอัน ดีกว่า example อ่อนสิบอัน
example ที่ดีควร:
- ใกล้กับ task
- สั้นพอให้ตรวจได้
- สะอาดพอให้ copy pattern
- มี label ว่าดีตรงไหน
ตัวอย่าง:
Good example:
[paste example]
Why it is good:
- เปิดด้วย decision
- ใช้ภาษา beginner
- มี exercise หนึ่งอัน
- ไม่ขาย paid course
คำอธิบายสำคัญ เพราะบอก model ว่าควร imitate ส่วนไหน
เพิ่ม non-example
non-example แสดงสิ่งที่ไม่ต้องการ
Do not write like this:
[paste weak example]
Why this is wrong:
- abstract เกินไป
- ใช้ buzzword
- ไม่มี practice ที่ concrete
- imply เรื่อง certificate ที่ free workshop ไม่มี
non-example มีประโยชน์เมื่อ model ชอบหลุดไป pattern ที่คุณไม่ต้องการ
Constraints คือ boundary
constraints บอก model ว่าอะไรต้องเป็นจริงเสมอ
constraints ที่ดี:
Constraints:
- Thai is the default language.
- ใช้ชื่อ product ว่า "Mervia Academy".
- ห้าม promise instructor access.
- ใช้ตัวอย่าง route /workshops/{slug}/.
- แต่ละ section ไม่เกิน 120 words.
constraints ที่อ่อน:
Make it good.
Make it premium.
Make it modern.
ถ้า constraint เป็น subjective ให้ทำให้ observable
แทนที่จะเขียน:
Make it beginner-friendly.
ให้ใช้:
Beginner-friendly means:
- explain term ใหม่ครั้งแรกที่ใช้
- อย่า assume ว่ารู้ coding
- มี template ที่ copy-paste ได้หนึ่งอัน
- จบด้วย practice task หนึ่งอัน
Acceptance criteria
acceptance criteria คือ checklist สำหรับ output สุดท้าย
Acceptance criteria:
- มี English และ Thai sections.
- มี template practical หนึ่งอัน.
- มี exercise หนึ่งอัน.
- ไม่พูดถึง paid access.
- จบด้วย link ไป lesson ถัดไป.
ช่วยทั้ง model และคน review
วาง example หลัง task brief
ลำดับที่ใช้ได้ดีคือ:
Task brief
Sources
Examples
Non-examples
Constraints
Output format
Acceptance criteria
อย่าซ่อน task ไว้หลัง example ยาวๆ model ควรรู้งานก่อนอ่าน pattern
แบบฝึกหัด: สร้าง example pack
เลือก task ที่คุณให้ AI บ่อย
สร้าง context block นี้:
Task:
Good example:
Why this example is good:
Non-example:
Why this example is wrong:
Constraints:
Acceptance criteria:
จากนั้นให้ AI สร้าง output ใหม่หนึ่งชิ้น และอธิบายว่าส่วนไหนของ example ถูกนำไปใช้
เข้าสู่ระบบเพื่อบันทึกความคืบหน้าSign in to track your progress
เข้าสู่ระบบSign in→