write-testslisted
Install: claude install-skill davidleberknight/footbag-platform
# Write Tests
## When to use this skill
- Adding a new route or service method and want tests alongside or before implementation
- Checking whether existing coverage is sufficient for a feature
- Verifying a bug fix is captured by a regression test
- Doing a focused coverage pass after a feature lands
Tests can be written at any point. See `tests/CLAUDE.md` for conventions.
## Step 1: Confirm scope
Read the open issues in the maintainers' private tracker (`gh issue list -R "$FOOTBAG_PRIVATE_REPO" --state open`; if unwired, note it in one line and rely on the human's instruction). Confirm the feature being tested is in scope. Do not write tests for out-of-scope behavior.
## Step 2: Determine test layer
**Unit tests** (`tests/unit/`) for exported pure functions with no DB dependency:
- `slugify()` from `slugify.ts`
- `personHref()` from `personLink.ts`
- `groupPlayerResults()` from `playerShaping.ts`
- `ServiceError` classes and `isServiceError()` from `serviceErrors.ts`
Non-exported pure functions are tested indirectly through integration tests. Do not modify production code exports just for testing.
**Integration tests** (`tests/integration/`) for everything involving routes, DB, auth, or rendered HTML:
- Route contracts (status codes, redirects, rendered content)
- Auth gates and ownership enforcement
- Privacy boundaries (purged members excluded, honors-gated profiles, show_competitive_results)
- Session edge cases (tampered cookies, malformed payloads)
- Validatio