maintainable-tests
maintainable-tests
Write, edit, refactor, and review tests so a developer returning months later can understand the behavior, the edge cases, and the reason each important test exists.
Passive Trigger
Load this skill in the background whenever the task involves automated tests, examples used as tests, fixtures, mocks, stubs, fakes, test data builders, regression coverage, characterization tests, flaky tests, or production-code changes made to improve testability. Keep it lightweight for small edits: apply the core rules silently, then mention only the test-design decisions that affect the final implementation.
Decision Tree
What are you doing?
-
Adding tests for new behavior: Read
references/principles.mdandreferences/naming-and-intent.md. Name each test after the user-visible rule or domain invariant, then use concrete examples that teach the behavior. -
Fixing a bug or adding regression coverage: Read
references/legacy-and-characterization.md. The test should explain the broken scenario, expected behavior, and why this coverage remains valuable after the fix.