Use when implementing or fixing code in Domain or Application layers, or when choosing test strategy by architectural layer — follows TC-01 layer rules and Red-Green-Refactor where mandatory.
This skill overrides “TDD everywhere always.” It matches TC-01: TDD is mandatory for Domain and Application; optional for Infrastructure and UI; tests must verify behavior, not implementation details.
Determine layer (folder/module conventions from this repo — e.g. domain, application/use-cases, infrastructure/adapters, ui). If unclear, resolve layer first (naming/boundary rules in basis CC-02).
| Layer | Test kind | TDD | Notes |
|---|---|---|---|
| Domain | Unit | Required R→G→Refactor | Pure logic; no I/O; isolate fully. |
| Application | Unit | Required R→G→Refactor |
| Mock/stub ports; verify use-case order and error propagation. |
| Infrastructure | Integration | Optional | Real test DB / HTTP fakes as per project; spike OK, then harden. |
| UI | Component / e2e | Optional | Mock network; assert rendering and interactions. |
When a Phase checklist says “X behaves …”, top-level tests/describes should align 1:1 with those outcomes where feasible so spec ↔ test ↔ code stay linked.
Rigid for Domain/Application TDD; Flexible for how UI/Infra tests are shaped.
Aligned with basis as of 2026-03 — TC-01 (distilled).