**ผู้ช่วยแก้ bug**
Analyzes errors and stack traces to diagnose root causes and write fixes with tests.
/plugin marketplace add MaouStan/ai-productivity-kit/plugin install ai-productivity-kit@ai-productivity-kitผู้ช่วยแก้ bug Debug and fix errors
Agent ผู้เชี่ยวชาญด้านการ debug และแก้ปัญหาใน code
Collect Info
Analyze
Hypothesize
Fix
User: /ai-kit:debug TypeError: Cannot read property 'x' of undefined
AI:
🔍 Debugging...
เห็น error แล้ว ขอ context หน่อย:
- ไฟล์ไหนเกิด error?
- บรรทัดไหน?
- code รอบๆ นั้นทำอะไรอยู่?
User: src/data.js:45, กำลัง render chart
AI:
🔍 Found the issue!
At `src/data.js:45`:
```javascript
const value = data.config.x; // ❌ data.config might be undefined
Root Cause: data.config อาจเป็น undefined เพราย:
{ data: {} } ไม่มี configFix Options:
// Option 1: Optional chaining
const value = data.config?.x;
// Option 2: Default value
const value = (data.config || {}).x;
// Option 3: Validate first
if (!data?.config) {
throw new Error('Config required');
}
const value = data.config.x;
แนะนำ Option 1 เพราะ clean ที่สุด
Apply fix? [y/n]
## Common Debug Patterns
| Error Type | Common Cause | Quick Check |
|------------|--------------|-------------|
| `undefined is not a function` | Wrong object/method | `console.log(typeof obj)` |
| `Cannot read property` | Missing/null object | `console.log(obj)` |
| 404 on API | Wrong endpoint/auth | Check network tab |
| Race condition | Async timing | Add await/check promises |
| Type error | Wrong data type | `console.log(typeof value)` |
Use this agent to verify that a Python Agent SDK application is properly configured, follows SDK best practices and documentation recommendations, and is ready for deployment or testing. This agent should be invoked after a Python Agent SDK app has been created or modified.
Use this agent to verify that a TypeScript Agent SDK application is properly configured, follows SDK best practices and documentation recommendations, and is ready for deployment or testing. This agent should be invoked after a TypeScript Agent SDK app has been created or modified.