Agent SDK sử dụng Claude để tự động tạo MGS Core V2 API query parameters thông qua skill mongorest-query.
npm install- Tạo file prompt.md với yêu cầu query của bạn:
# MGS Query Request
Tôi cần query để lấy danh sách users active...
Hãy sử dụng skill mongorest-query để tạo endpoint.- Chạy agent:
node index.js- Kết quả sẽ được lưu vào
output/query-result.md
.
├── index.js # Main agent SDK
├── prompt.md # Input prompt (yêu cầu query)
├── output/
│ └── query-result.md # Output result
└── .claude/
└── skills/
└── mongorest-query/ # Skill definition
Tôi cần query để lấy danh sách users active, kèm theo posts.
- Collection: users
- Filter: status = active
- Join: posts (title, content)
- Sort: theo createdAt mới nhất
- Limit: 20
Hãy sử dụng skill mongorest-query.Tìm products có tên chứa "laptop", category là electronics, giá từ 500-2000.
- Fields: name, price, category, stock
- Sort: theo giá tăng dần
Hãy sử dụng skill mongorest-query.Lấy users là admin HOẶC moderator, đang active, không bị banned.
- Fields: id, name, email, role
- Sort: theo tên
Hãy sử dụng skill mongorest-query.File output/query-result.md sẽ chứa:
- Timestamp
- Prompt gốc
- Endpoint đầy đủ
- Giải thích chi tiết
- Lưu ý và tối ưu (nếu có)
- ✅ Đọc prompt từ file markdown
- ✅ Tự động gọi skill mongorest-query
- ✅ Validate và tối ưu query
- ✅ Giải thích chi tiết từng phần
- ✅ Ghi kết quả ra file .md
- ✅ Console log real-time
- ✅ Error handling
- Node.js >= 18
- @anthropic-ai/claude-agent-sdk
- Skill mongorest-query được cấu hình trong
.claude/skills/
❌ File prompt.md không tồn tại!
💡 Vui lòng tạo file prompt.md với yêu cầu query của bạn.
→ Tạo file prompt.md trong thư mục gốc
→ Kiểm tra đường dẫn .claude/skills/mongorest-query/skill.md tồn tại
MIT
