# Implementation Plan Template

This is the technical counterpart to a PRD. It answers HOW to build what the PRD describes.

---

```markdown
# Implementation Plan: [Module/Feature Name]

> **Source PRD:** prd-xxx
> **Created:** YYYY-MM-DD
> **Author:** Claude + [User]
> **Status:** Draft | In Progress | Done

---

## 1. Technical Overview

### Architecture
- High-level architecture description
- How this module fits into the existing system

### Tech Stack
| Layer | Technology | Notes |
|-------|-----------|-------|
| Frontend | ... | ... |
| Backend | ... | ... |
| Database | ... | ... |
| External Services | ... | ... |

---

## 2. Visual Overview

Pick the appropriate format based on the module type. Can include multiple diagrams if needed.

### For backend/API: Flow Diagram (Mermaid)

```mermaid
flowchart LR
    Client -->|POST /api/resource| Controller
    Controller --> Service
    Service --> ExternalAPI
    Service --> Database
    Database -->|result| Service
    Service -->|response| Controller
```

### For web/frontend: UI Wireframe (ASCII)

Use ASCII/text-based wireframe to sketch key screens. Quick visual reference for developers.

### 2.1 [Screen Name]
```
+----------------------------------------------------------+
|  Header / Navbar                                         |
+-------------+--------------------------------------------+
|             |                                            |
|  Sidebar    |   Main Content Area                        |
|  (30%)      |   (70%)                                    |
|             |                                            |
|  - Item 1   |   +----------------------------------+     |
|  - Item 2   |   |                                  |     |
|  - Item 3   |   |        Component A               |     |
|             |   |                                  |     |
|             |   +----------------------------------+     |
|             |                                            |
+-------------+--------------------------------------------+
|  Footer                                                  |
+----------------------------------------------------------+
```
- **Description:** What this screen does
- **Maps to:** FR-XXX
- **Key interactions:** Click X → happens Y

### 2.2 [Screen Name]
```
(another wireframe)
```

---

## 3. Data Models

### 2.1 [Entity Name]

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| id | string (UUID) | Yes | Primary key |
| ... | ... | ... | ... |

### 2.2 Relationships
- Entity A → Entity B: one-to-many

---

## 4. API Contracts

### 3.1 [Endpoint Name]

- **Method:** POST/GET/PUT/DELETE
- **URL:** `/api/...`
- **Maps to:** FR-XXX

**Request:**
```json
{
  "field": "value"
}
```

**Response (200):**
```json
{
  "field": "value"
}
```

**Error Responses:**
| Status | Description |
|--------|-------------|
| 400 | ... |
| 404 | ... |

---

## 5. File Structure

```
module/
├── file1.ts       # Description
├── file2.ts       # Description
└── ...
```

---

## 6. Implementation Tasks

### Phase 1 - MVP (maps to PRD Phase 1)

| # | Task | Maps to | Depends on | Complexity | Description |
|---|------|---------|------------|------------|-------------|
| 1 | ... | FR-001 | - | S/M/L/XL | What to build and how |
| 2 | ... | FR-002 | Task 1 | S/M/L/XL | ... |
| 3 | ... | FR-003 | Task 1, 2 | S/M/L/XL | ... |

### Phase 2 - Enhancement (maps to PRD Phase 2)

| # | Task | Maps to | Depends on | Complexity | Description |
|---|------|---------|------------|------------|-------------|
| 4 | ... | FR-004 | Phase 1 | S/M/L/XL | ... |

---

## 7. Dependencies & Setup

### Libraries to install
| Package | Version | Purpose |
|---------|---------|---------|
| ... | ... | ... |

### Environment variables
| Variable | Description | Required |
|----------|-------------|----------|
| ... | ... | Yes/No |

### External services
| Service | Purpose | Setup needed |
|---------|---------|-------------|
| ... | ... | ... |

---

## 8. Testing Strategy

| Type | Scope | Tools |
|------|-------|-------|
| Unit | ... | ... |
| Integration | ... | ... |
| E2E | ... | ... |

---

## 9. Open Questions

- [ ] Question 1 (blocks Task X)
- [ ] Question 2 (nice to clarify)
```
