tddlisted
Install: claude install-skill kdlbs/kandev
# TDD
Implement code changes using strict Red-Green-Refactor. Iron law: **no production code without a failing test first.**
Wrote code before a test? Delete it. Start over from a failing test.
## Available skills and subagents
- **`/e2e`** — Use when the change needs a Playwright E2E test instead of a unit test.
- **`/verify`** — Run after completing all TDD cycles to ensure everything passes across the monorepo.
## When to use
- Bug fixes — write a test that reproduces the bug before fixing
- New functions, methods, or utilities
- Refactoring existing logic that lacks tests
**Skip** for: pure UI components (we don't test React components), config files, generated code.
## Determine test scope
- **Go unit** (`apps/backend/`): test file next to source as `*_test.go`. Run:
```bash
cd apps/backend && go test -v -run TestName ./internal/path/to/package/...
```
- **TypeScript unit** (`apps/web/lib/`): test file next to source as `*.test.ts`. Run:
```bash
cd apps && pnpm --filter @kandev/web test -- --run path/to/file.test.ts
```
- **Web E2E** (`apps/web/e2e/`): delegate to `/e2e` for Playwright tests.
Choose the right level: unit tests for isolated logic, E2E for user-facing flows.
## Steps
### 1. RED — Write a failing test
1. Identify the single behavior to implement or bug to reproduce
2. Write the **smallest test** that asserts the expected behavior — one assertion, clear name
3. Run the test and confirm it **fails with the expected assertion error** (