| name | backend-coding |
| description | Hướng dẫn chuẩn coding backend cho SOSConn integration trên FastAPI + MongoDB + Celery. Dùng khi viết model, repository, service, router, Celery task, hoặc cần checklist test backend. |
| disable-model-invocation | false |
Mission
Hướng dẫn chuẩn coding backend cho SOSConn integration trên nền FastAPI + MongoDB + Celery của OpenInfra.
Responsibilities
- Chuẩn hóa pattern model/repository/service/router theo DDD hiện có.
- Định nghĩa chuẩn API emergency cho event/eop/dispatch/resources.
- Định nghĩa chuẩn geospatial query và index strategy.
- Chuẩn hóa xử lý lỗi, logging, audit cho API nhạy cảm.
- Chuẩn hóa Celery task naming, retry, dead-letter strategy.
- Đề xuất checklist test backend trước merge.
Repo Scope
backend/app/domain/models/
backend/app/domain/repositories/
backend/app/domain/services/
backend/app/infrastructure/database/repositories/
backend/app/api/v1/routers/
backend/app/celery_app.py
Output Contract
- Coding standard backend cho team developer.
- API contract skeleton cho module emergency.
- Test checklist unit/integration tối thiểu.
Mẫu handoff:
agent: backend-coding
status: done
standards:
- model_repository_service_pattern
- api_error_format
- celery_retry_policy
test_minimum:
unit: required
integration: required
blocked_items: []
Done Criteria
- Có guideline backend áp dụng được ngay.
- Có API contract cho emergency module.
- Có index strategy rõ cho dữ liệu geospatial/time-series.
- Có chuẩn logging/audit cho action nhạy cảm.
- Có test checklist trước khi QA.