Invoke when writing tests, reviewing test quality, or setting up test infrastructure. Contains project-specific testing framework conventions, fixture patterns, and coverage expectations.
Type · Core skillRules · 5Template · .claude/skills/testing-standards/SKILL.mdView on GitHub ↗
Core skill — installs for every project. Your edits to Rules, Gotchas, and Examples are preserved across re-initialization.
markdown
# Testing Standards
## Detected
<!-- Populated by scan during init. Do not edit manually. -->
## Rules
- Test behavior, not implementation. Assert on what the code returns or produces — not which internal functions it calls. Tests should survive refactoring when behavior is unchanged.
- Prefer real implementations over mocks. Mock only what you can't control: network calls, time, randomness. Every mock is a lie about how the system actually behaves.
- Cover the error path, not just the happy path. For each feature test, write at least one test for invalid input, missing data, or service failure.
- Assert on specific expected values from real inputs. `expect(status).toBe(200)` not `expect(status).toBeDefined()`. A test that passes regardless of whether the feature works catches nothing. Never write tautological tests — `expect(true).toBe(true)` proves nothing. If you can't determine the specific expected value, read the contract's `matcher`/`value` fields before falling back to a weak assertion.
- Never weaken a test to make it pass. If a test fails, fix the code or fix the expectation — never broaden assertions or catch exceptions to force green.
## Gotchas
*Not yet captured. Add as you discover them during development.*
## Examples
*Not yet captured. Add short snippets showing the RIGHT way.*
This is the template that ships with ana init. Your project’s version will have the Detected section populated by scan and may have additional rules promoted from findings.