---
trigger: model_decision
description: When you start working on a scenario, new methods or classes - do it unless user told you to do otherwise.
---

Tests prove behavior. You **cannot claim** a scenario, class, or method is implemented until tests pass.

- New code structure: follow `.windsurf/rules/do-skeletons-first.md` (docstrings, types, stubs).
- Write tests **before** implementation. Do not write tests whose only purpose is to hit `NotImplementedError`—write assertions that **should pass** once real behavior exists.
- Cover **success** (returns) **and** **failure** (`raises`, errors, edge cases) for each unit of behavior.
- If implementation contradicts docstring, ask the user which wins.
- Use `docs/features/` to align scenarios with tests.
- Order: method-level → API → integration. For integration, follow `.windsurf/rules/do-not-mock-in-integration-tests.md`.
- Red–green: make the test fail, then implement until green.
- Use pytest; avoid mocks unless unavoidable.

**Layout (never put tests in repo root):**

| Kind | Path |
|------|------|
| Unit | `tests/unit/` |
| Integration | `tests/integration/` |
| API | `tests/api/` |
| E2E | `tests/e2e/` |
| Service | `tests/services/` |
