---
name: new-product-dev-guide
description: New product TDD development work standard. Use when dev_leader determines the requirement is a brand new product with no existing codebase.
---

# New Product TDD Development Guide

Complete all development deliverables step by step. **Each phase MUST be confirmed by the user before proceeding to the next.**

## Working Principles

- Pause after each phase and wait for user confirmation before continuing
- All implementation decisions MUST strictly follow the PRD documents; any deviation is an error
- Follow the minimum viable principle: if not necessary, do not add
- TDD is non-negotiable: tests MUST be written before implementation code

---

## Phase 0 — Read PRD Documents

Before writing any code, `@dev_leader` MUST read the PRD documents in the following order:

1. `PRD/1-Strategy/Product-Strategy-Design.md` — understand product definition, core business flow, and constraints
2. `PRD/1-Strategy/*-Persona.md` — understand user types and their needs
3. `PRD/1-Strategy/User-Story-Map/` — understand user journeys per user type
4. `PRD/2-Scope/Iteration-Roadmap.md` — identify version scope for this development cycle
5. `PRD/2-Scope/Business-Flow.md` — understand operation flows
6. `PRD/2-Scope/Feature-List.md` — enumerate features and their precise interaction logic
7. `PRD/3-Structure/*-Requirements.md` — understand each entity's requirements
8. `PRD/4-Presentation/UI-Structure.md` and `PRD/4-Presentation/UI-Prototype/` — understand UI layout and page designs (if applicable)

After reading, `@dev_leader` summarizes:
- The target version scope
- The full feature list for this cycle
- Whether frontend work, backend work, or both are required

**Confirm with user before proceeding.**

---

## Phase 1 — Technical Design

`@dev_leader` produces a technical design based on PRD:

1. **Tech Stack Decision**: Propose the technology stack. If multiple options exist, present trade-offs and ask the user to choose.
2. **Architecture Overview**: Describe the high-level module structure (text or Mermaid diagram).
3. **Task Breakdown**: Split the feature list into independent development tasks. For each task, specify:
   - Task ID and description
   - Assigned to: `@frontend_dev` or `@backend_dev`
   - PRD references (which Feature-List items and Entity-Requirements it covers)
   - Acceptance criteria (directly derived from the Feature-List interaction logic)

**Confirm with user before proceeding.**

---

## Phase 2 — TDD Implementation (per task)

For each task, the assigned agent (`@frontend_dev` or `@backend_dev`) follows the TDD cycle:

### 2.1 Red — Write Failing Tests
- Write test cases based on the acceptance criteria from Phase 1
- Tests MUST cover: main path, edge cases, and failure/error cases
- Run the tests to confirm they fail (no implementation exists yet)

### 2.2 Green — Minimal Implementation
- Write the minimum code required to make all tests pass
- Do not add features beyond what the tests require

### 2.3 Refactor — Clean Up
- Improve code structure, naming, and clarity
- Ensure all tests remain green after refactoring
- Remove duplication; enforce separation of concerns

**Report completion to `@dev_leader` after each task.**

---

## Phase 3 — Code Review

After each task (or a logical group of tasks) is complete:

1. `@dev_leader` routes the code to `@code_reviewer`.
2. `@code_reviewer` performs review using the standard checklist and returns a report.
3. **If PASS**: `@dev_leader` marks the task as accepted and proceeds to the next task.
4. **If NEEDS REVISION**: The assigned developer addresses each finding and returns to Phase 2.2 for the affected units. Repeat until PASS.

---

## Phase 4 — Integration & Delivery

After all tasks for the target version are PASS:

1. `@dev_leader` verifies that the full feature list from Phase 1 is covered.
2. Run all tests together to confirm no regressions.
3. `@dev_leader` summarizes the delivery to the user:
   - Features implemented (mapped to Feature-List items)
   - Test coverage summary
   - Any deviations from PRD (must be explicitly noted and justified)

**Confirm delivery with user.**
