/code-habits:one-test-one-thingfrom code-habits
Use when writing or reviewing a unit/integration test — enforces a clear scenario-shaped name (no `_and_`), Arrange/Act/Assert structure with visible separation, and one logical behaviour per test. A failing test name should describe exactly what regressed without opening the file. Multiple scenarios become multiple tests, not one test with branches or `_and_` in the name.
Ships in code-habits. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
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.
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.
<unit>_<condition>_<expected>. If you wrote _and_, split the test.// arrange / // act / // assert comments — either works, just make the three phases readable at a glance.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.The "and" smell (live case):
// 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_known_group() { ... }
#[test]
fn group_len_returns_zero_for_unknown_group() { ... }
Packed-scenarios smell (live case): created_group_flag_is_true_only_for_first_order_in_a_new_group exercised three states (new group, same group, different group) in one method — split into three named tests, one per scenario.
AAA shape on a small Rust test:
#[test]
fn group_len_returns_zero_for_unknown_group() {
// arrange
let store = GroupStore::new();
// act
let len = store.group_len(&GroupId::from(42));
// assert
assert_eq!(len, 0);
}
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub amitkot/claude-code-tools --plugin code-habitsOther plugins' skills for the same job
7 skills in this plugin
/comment-non-obvious-stepsUse when writing or editing code that contains repeated-looking calls on different structures, bitmask/bit-fiddling, ordering-sensitive sequences, or multi-step state mutations across data structures — adds a short inline comment per step explaining WHY each step is distinct, so a reader doesn't stop and ask "wait, why are there three of these?". Does not apply to trivial code with self-explanatory identifiers./deliverable-on-diskUse when about to mark a task as complete, done, finished, or shipped — verifies the deliverable actually exists as a file on disk, in a commit, or as a posted artefact. Blocks claiming completion based on chat output alone./