AI Tooling — stack an toàn & hiệu quả cao
Công cụ / repo được chấp thuận cho WELIFE. Ưu tiên bản chính thức, license rõ, cộng đồng lớn.
Cursor (đã cài trong repo)
| Thành phần | Path | Công dụng |
|---|---|---|
| Rules (always) | .cursor/rules/*.mdc |
WP gate, safety, quality, DOC-MAP, boundaries |
| Rules (scoped) | api-nestjs, swagger-contract, mobile-rn, image-to-ui |
Theo path |
| Skill | .cursor/skills/welife-mandatory/ |
Gate mọi feature |
| Skill | .cursor/skills/image-to-ui/ |
Mockup → RN |
| AGENTS.md | root | Context agent |
| Tokens | mobile/src/theme/tokens.ts |
Design system |
| Extensions | .vscode/extensions.json |
ESLint, Prettier, Expo, Docker, SQL… |
| Settings | .vscode/settings.json |
Format on save, Todo Tree WP/AC |
| Tasks | .vscode/tasks.json |
api/mobile/infra/swagger |
| REST | api/http/welife.http |
Thunder/REST Client |
| Docs | docs/00–06 |
Ma trận + rules |
Chi tiết cài extension: 06-AI-RULES-EXTENSIONS.md
MCP (Cursor Plugins)
| Server | Dùng khi | Ghi chú |
|---|---|---|
Figma (plugin-figma-figma) |
User gửi link Figma | Cần Auth trong Cursor Settings → MCP |
| Notion | Spec / task | Optional |
| Datadog | Observability | Optional, sau production |
Figma: Settings → MCP → Authenticate Figma. Sau đó dùng skill design-to-code khi có URL Figma.
Stack FE được phép (Expo / RN)
| Package | Lý do | An toàn |
|---|---|---|
expo + Expo Router |
Official, OTA, docs tốt cho AI | ✅ |
react-navigation |
Chuẩn navigation | ✅ |
react-native-maps |
Map theo mockup | ✅ (API key env) |
expo-secure-store |
Lưu JWT | ✅ |
zustand hoặc TanStack Query |
State / cache API | ✅ |
zod |
Validate response | ✅ |
@gorhom/bottom-sheet |
Bottom sheet map | ✅ |
Tránh: repo UI “AI dump” không maintain, obfuscator lạ, package npm < 1k download / không có license.
Stack BE được phép
| Package | Lý do |
|---|---|
@nestjs/* official |
Module, Swagger, JWT |
class-validator + class-transformer |
DTO |
| Prisma hoặc TypeORM + PostgreSQL/PostGIS | DB |
ioredis / BullMQ |
OTP, queue |
helmet, throttler |
Hardening |
Tránh: copy-paste auth JWT tự chế; lưu password plain; log OTP production.
Workflow ảnh → UI (khuyến nghị)
Mockup JPG/PDF ──Read──► Audit sections
│
├── tokens.ts (màu/spacing)
├── image-to-ui skill
└── Screen RN + stub API
Nếu có Figma URL → authenticate MCP Figma → get_design_context → code (chính xác hơn JPG).
Repo / template tham chiếu (học pattern, không fork mù)
- nestjs/nest — cấu trúc module
- expo/expo — template blank-typescript
- react-navigation/react-navigation
- colinhacks/zod
Checklist an toàn PR do AI tạo
- Không có secret trong diff
- API có Swagger + DTO
- FE không chứa business logic tiền/matching
- UI đối chiếu mockup (ảnh đã Read)
-
.env.examplecập nhật nếu thêm biến