Decode AI Responses: Từ Suggestion Đến Action
AI không phải lúc nào cũng đúng. Skill quan trọng là đánh giá quality của AI suggestions và guide AI đến solution đúng khi nó sai.
Anatomy of AI Error Response
Khi bạn paste error, AI thường trả về format:
1. 🔍 ANALYSIS: Giải thích nguyên nhân
2. 💡 SOLUTION: Code fix đề xuất
3. 📝 EXPLANATION: Tại sao fix này work
4. ⚠️ PREVENTION: Cách tránh trong tương lai
Evaluating AI Analysis
Green Flags (Có thể trust):
- Analysis trỏ đúng vào line number trong error
- Explanation matches với code logic
- Solution minimal và targeted
- Đề cập đến root cause, không chỉ symptom
Red Flags (Cần verify):
- Analysis quá generic ("có thể do nhiều nguyên nhân")
- Solution thay đổi nhiều code không liên quan
- Explanation dùng terms không khớp với codebase
- AI nói "tôi không thể xem file" (context issue)
Conversation Patterns Hiệu Quả
Pattern 1: Drill Down
You: [Paste error + initial context]
AI: [Generic solution]
You: "Cụ thể hơn: lỗi ở line 15,
data.products là undefined.
Data được fetch từ @file api/products.ts.
Check flow từ fetch đến render."
AI: [More specific solution]
Pattern 2: Reject and Redirect
You: [Bug report]
AI: [Wrong solution - adds optional chaining everywhere]
You: "Giải pháp này chỉ hide error, không fix root cause.
Tôi cần data luôn có, không phải handle undefined.
Check tại sao API trả về undefined."
AI: [Better solution focusing on data source]
Pattern 3: Confirm Understanding
You: [Bug report]
AI: [Solution + explanation]
You: "Tóm lại: lỗi xảy ra vì useEffect chạy trước
data fetch hoàn thành, đúng không?
Solution là add loading state?"
AI: [Confirms or corrects understanding]
Command Phrases Để Guide AI
Khi AI sai:
- "Không đúng, vấn đề thực sự là..."
- "Giải pháp này không work vì..."
- "Thử approach khác: ..."
- "Focus vào [specific area], không phải [wrong area]"
Khi cần more details:
- "Giải thích chi tiết hơn tại sao điều này xảy ra"
- "Show me step-by-step execution flow"
- "What are the edge cases this doesn might fail?"
Khi cần simpler solution:
- "Có cách đơn giản hơn không?"
- "Giảm complexity, keep it minimal"
- "Chỉ fix exact problem, không refactor"
Khi cần production-ready:
- "Add proper error handling"
- "Consider edge cases: empty array, null, network error"
- "Make it type-safe, không any"
Multi-Turn Debugging Strategy
Turn 1: Report bug + context
Turn 2: Clarify based on AI analysis
Turn 3: Refine solution direction
Turn 4: Request final implementation
Turn 5: Ask for test cases
Khi AI Stuck Trong Loop
Đôi khi AI keeps suggesting same wrong fix:
Solution: New chat + better initial prompt
[Start fresh chat]
"Vấn đề cụ thể: [exact problem statement]
Đã thử: [what was tried]
Không hiệu quả vì: [why it failed]
Constraints: [important requirements]
Suggest alternative approach."
Pro Tips
- Trust but verify: Run code, dont just read
- Learn from fixes: Each debug session = learning opportunity
- Save patterns: Document common error patterns
- Know when to Google: AI không phải always have latest answers
💡 Key Skill: Debugging với AI là collaborative. Bạn guide, AI executes. Neither works alone.
Bài Tập
Tạo một conversation nơi bạn intentionally reject AI's first suggestion và guide nó đến better solution.
