Skip to content

Giai đoạn Triển khai (Implementation)

Ghi lại quá trình triển khai code và các quyết định kỹ thuật.

Mục đích

  • Hướng dẫn triển khai theo từng task
  • Ghi lại patterns và conventions
  • Document các quyết định kỹ thuật
  • Track tiến độ

Cách thực hiện

1. Thực thi từ planning

/execute-plan

2. Check implementation

/check-implementation

So sánh code với design document.

Template nội dung

markdown
---
phase: implementation
title: Feature Name Implementation
---

# Triển khai: [Tên Tính năng]

## Trạng thái

| Component | Trạng thái | Notes |
|-----------|------------|-------|
| API | ✅ Done | PR #123 |
| Database | 🔄 In Progress | - |
| Frontend | ⏳ Pending | - |

## Ghi chú triển khai

### Task 1: Setup API

**Quyết định**:
- Dùng Express với TypeScript
- Validation với Zod

**Files thay đổi**:
- `src/routes/feature.ts` - Routes
- `src/services/feature.ts` - Business logic

**Commands**:
\`\`\`bash
npm install zod
\`\`\`

### Task 2: Database schema

**Migration**:
\`\`\`sql
CREATE TABLE features (
  id UUID PRIMARY KEY,
  name VARCHAR(255) NOT NULL
);
\`\`\`

## Patterns sử dụng

- Repository pattern cho data access
- Service layer cho business logic
- DTO cho API responses

## Xử lý lỗi

\`\`\`typescript
try {
  // logic
} catch (error) {
  logger.error('Feature error', { error });
  throw new AppError('Feature failed', 500);
}
\`\`\`

## Vấn đề gặp phải

| Vấn đề | Giải pháp |
|--------|-----------|
| N+1 queries | Dùng eager loading |

Tiếp theo

Giai đoạn Kiểm thử

Internal Use Only