Quest 2.1: Fix the Vague Prompt

🟢 Easy 15 minutes Block 2: Prompt Engineering

🎯 Goal

เปลี่ยน vague prompt ให้เป็น specific prompt ที่ได้ผลลัพธ์ดี


📋 Instructions

  1. วิเคราะห์ bad prompt:
    Make a function that handles users
  2. หาว่าขาดอะไร:
    • "handle" หมายถึงอะไร?
    • user data 有什么?
    • validation ต้องการอะไร?
    • return อะไร?
  3. เขียน improved prompt:
    Create a function called createUser that:
    - Takes { name: string, email: string }
    - Validates email format
    - Returns { success, id, name, email }
  4. ใช้ prompt กับ AI tool
  5. ทดสอบ generated code

🎮 Code Playground


✅ Verification

node test.js

💡 Tips

A good prompt includes:

  1. Function name and purpose
  2. Input parameters with types
  3. Output format
  4. Validation rules
  5. Error handling