Quest 2.1: Fix the Vague Prompt
🟢 Easy 15 minutes Block 2: Prompt Engineering
🎯 Goal
เปลี่ยน vague prompt ให้เป็น specific prompt ที่ได้ผลลัพธ์ดี
📋 Instructions
- วิเคราะห์ bad prompt:
Make a function that handles users - หาว่าขาดอะไร:
- "handle" หมายถึงอะไร?
- user data 有什么?
- validation ต้องการอะไร?
- return อะไร?
- เขียน improved prompt:
Create a function called createUser that: - Takes { name: string, email: string } - Validates email format - Returns { success, id, name, email } - ใช้ prompt กับ AI tool
- ทดสอบ generated code
🎮 Code Playground
✅ Verification
node test.js 💡 Tips
A good prompt includes:
- Function name and purpose
- Input parameters with types
- Output format
- Validation rules
- Error handling