Write Tests
write-tests is the skill for adding or improving tests for behavior, contracts, bugs, or regressions. This page helps you open the real source, notice the pattern, and copy the skill when comparing it with another project.
Source: .claude/skills/write-tests/SKILL.md
What To Notice
- Focuses on behavior and meaningful assertions.
- Prefers small fixtures and avoids overfitting to implementation details.
- Runs relevant tests and reports results clearly.
markdown
---
name: write-tests
description: Use when adding or improving tests — backend unit, integration, API, service, repository, authorization, validation, or regression tests. Focus on behavior, meaningful assertions, and minimal fixtures.
argument-hint: <behavior, contract, bug, or file to test>
---
# Write Tests
## Goal
Add focused, meaningful tests that prove backend behavior or regressions without overfitting to implementation details.
## Process
1. Read `docs/engineering/conventions/testing.md` before writing any tests.
2. Read `docs/specs/` for behavior, acceptance criteria, and regression context when relevant.
3. Identify the behavior, contract, or regression that needs proof from `$ARGUMENTS`.
4. Choose the smallest useful test level: unit, service, repository, controller/API, integration, or authorization.
5. Inspect existing nearby tests and reuse local fixtures, factories, mocks, and helpers.
6. Write behavior-focused assertions — include edge cases and denied/error paths when relevant.
7. Avoid testing private implementation details unless no public behavior can prove the risk.
8. Keep fixtures minimal and deterministic.
9. Run the smallest relevant test first, then affected tests when practical.
## Do Not
- Do not weaken, delete, or skip existing tests to make the suite pass.
- Do not add broad snapshot or brittle implementation tests unless clearly justified.
- Do not mock the behavior being tested.
- Do not introduce test-only abstractions unless they reduce real duplication or match existing patterns.
- Do not claim tests passed if commands were not run.
## Output
**Non-trivial test work:**
- Behavior covered
- Test files changed
- Verification result
- Remaining coverage gaps or risk
**Small additions:** short summary and verification result.