testing-conventions
/testing-conventions
Writing tests: behavior-describing names, exact-value assertions, snapshot and property tests, independent idempotent tests, anti-patterns such as testing mocks. Use when writing or reviewing tests or diagnosing a flaky one.
- Author
- goldziher ↗
- Repository
- ai-rulez ↗
- Licence
- MIT
- Last repository change
- 27.10.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Writing tests: behavior-describing names, exact-value assertions, snapshot and property tests, independent idempotent tests, anti-patterns such as testing mocks. Use when writing or reviewing tests or diagnosing a flaky one.
Original author description
Writing tests: behavior-describing names, exact-value assertions, snapshot and property tests, independent idempotent tests, anti-patterns such as testing mocks. Use when writing or reviewing tests or diagnosing a flaky one.
How it works
- Naming
- Assertions
- Independence
- Anti-patterns
- Verify the test can fail
SKILL.md preview
--- name: testing-conventions description: "Writing tests: behavior-describing names, exact-value assertions, snapshot and property tests, independent idempotent tests, anti-patterns such as testing mocks. Use when writing or reviewing tests or diagnosing a flaky one." --- ## Naming Name tests to describe behaviour: `should_return_error_when_input_is_empty`, `test_parse_handles_nested_objects`. Use `describe`/`it` blocks for grouping where the language supports them. Follow `given_when_then` or `should_when`. Test names are specifications — a reader should understand the expected behaviour without reading the body. ## Assertions Assert exact expected values, not truthiness (`assert result == 42`, not `assert result`). Use snapshot testing for complex structured output and property-based testing for functions with wide input ranges. Include descriptive failure messages. Always test error paths and edge cases, not just the happy path. Use parameterized tests or fixtures for input variations instead of copy-paste. Do not test that an exception class or function merely exists. ## Independence Tests must be independent and idempotent — runnable in any order, in parallel. No shared mutable state between tests. Use factories or fixtures for setup. Clean up created resources (files, DB rows, env vars) after each test. Never rely on execution order. Mock only the external boundary (network, third-party services, clocks); use real objects for everything else. ## Anti-patterns - Do not test mock behaviour instead of real behaviour. - Do not add test-only methods to production code. - Do not mock what you don't own — wrap it and test the wrapper. - Do not test implementation details — test observable behaviour. - Do not write tests that pass when the code is broken. If a test never fails, it is not testing anything. - When adding tests to existing code, never edit the code under test to make a test pass. If a test can only pass that way, it found a bug: surface it. In a red-green cycle the failing test comes first and the code change is the point. Fixing the test's own scaffolding, mocks or assertions is always in scope. - Do not skip, xfail or weaken a failing test to get green. A skipped test or vacuous pass hides a gap. ## Verify the test can fail After a test passes, break or revert the fix and confirm it fails for the reason you expect. A test file the runner does not collect, or an empty fixture, passes while testing nothing: check that the test actually ran.
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · goldziher/ai-rulez | 90 | MIT |
| ajyadav013/claude-kit | 100 | MIT |
| kunchenguid/no-mistakes | 82 | MIT |
| AnalystTom/robots-no-mistakes | 82 | MIT |
Database snapshot: 13.11.2026 · package version df999b6fcab1 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 1 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 92conventions-testing
Apply when writing or reviewing tests. - 100testing-strategy
Comprehensive testing methodology, test pyramid, deterministic unit tests, and integration testing. Use when designing test suites or debugging flaky tests. - 100test-conventions
Testing conventions for writing tests in any codebase. TRIGGER when: planning tests for new code, writing test infrastructure (mocks, helpers, fixtures), or discussing test strategy for new features. DO NOT TRIGGER when: the task is purely mechanical (running tests, fixing a… - 92conventions-testing
Apply when writing or reviewing tests. - 100testing-patterns
Test structure, fixtures, factories, and mocking conventions. Use when writing or reviewing tests, or files named test_*, *_test, *.test.*, or *.spec.*. - 100testing
Behavioral testing strategy — deciding what to test and how. Use when writing tests, reviewing test quality, or fixing tests that test mocks instead of behavior. Triggers on: 'use testing mode', 'write tests', 'test strategy', 'tests are brittle', 'tests test mocks', 'improve…