one-test-one-thinglisted
Install: claude install-skill amitkot/claude-code-tools
# One test, one thing — name it for the scenario, structure it AAA
Each test exercises one logical behaviour, is named after the exact scenario and expected outcome, and is laid out Arrange / Act / Assert. If the name needs `_and_`, it's two tests.
## Why
A test name is the failure message in CI. When `test_x_and_y` goes red, you can't tell which behaviour broke without opening the file — and the test itself often half-passes through one branch and half-asserts the other, hiding regressions. One scenario per test means the name pins the regression, the AAA shape makes the intent scannable, and a future reader fixes the right thing instead of patching whichever assert tripped first.
## How to apply
- **Name = scenario + expected outcome.** `<unit>_<condition>_<expected>`. If you wrote `_and_`, split the test.
- **AAA visible.** Pick blank-line separation OR `// arrange` / `// act` / `// assert` comments — either works, just make the three phases readable at a glance.
- **One thing.** One logical behaviour per test. Multiple `assert!` calls are fine when they all check the same behaviour from different angles (e.g. asserting `result.foo` and `result.bar` after one call). Multiple distinct scenarios → multiple tests.
## Examples
The "and" smell (live case):
```rust
// BEFORE — one test, two scenarios, "and" in the name
#[test]
fn group_len_returns_expected_size_and_zero_for_unknown_group() { ... }
// AFTER — split into two
#[test]
fn group_len_returns_member_count_for_k