Prompt Engineering for Code (Code ရေးဖို့ AI ကို ခိုင်းနည်း)
Code Prompting Formula
Section titled “Code Prompting Formula”Code ကောင်းကောင်းရဖို့ ဒီ (၄) ချက် ပါအောင် ပြောပါ။
- Role: “You are a Senior React Developer.” (ကျွမ်းကျင်သူ တစ်ယောက်လို ဖြေခိုင်းတာ)
- Context: “I am building a dashboard for a hospital.” (ဘာလုပ်နေလဲ ပြောပြတာ)
- Task: “Create a patient registration form.” (ဘာလုပ်ခိုင်းတာလဲ)
- Constraints: “Use TypeScript, Shadcn UI, and React Hook Form.” (ဘာတွေ သုံးရမယ်၊ မသုံးရဘူး ကန့်သတ်တာ)
Example
Section titled “Example”❌ Bad Prompt: “Write a function to sort numbers.”
✅ Good Prompt: “Write a TypeScript function to sort an array of objects by a specific key. The function should be generic. Handle edge cases like empty arrays.”
Tips for Coding
Section titled “Tips for Coding”- Be Specific: Library ဘာသုံးမလဲ တိတိကျကျ ပြောပါ။
- Provide Examples: ကိုယ်လိုချင်တဲ့ Code ပုံစံ (One-shot prompting) ကို နမူနာ ပြပါ။
- Iterate: တစ်ခါတည်းနဲ့ အမှန် မရနိုင်ပါဘူး။ “ဒီနေရာလေး ပြင်ပေးပါ” ဆိုပြီး ဆက်ပြောပါ။