← ClaudeAtlas

propertieslisted

This skill should be used when tests need to be stronger rather than more numerous — when the user says "write property tests", "property-based testing", "use hypothesis", "what should I be testing here", "my tests pass but bugs still get through", "write better tests for this", "what's always true about this function", or when a mutation-testing survivor needs a test that kills a whole family of bugs rather than one example. Provides the property pattern catalog and a tool that measures whether a property actually catches anything.
lkc-studio/claude-plugins · ★ 1 · Code & Development · score 69
Install: claude install-skill lkc-studio/claude-plugins
# Properties: tests that assert what is always true An example test checks one input. A property test states something true of *all* inputs and lets a generator hunt for a counterexample. The tool is not the hard part. `hypothesis` is mature, installed everywhere, and takes one decorator. The hard part is the blank page after it: > *What is actually true about this function, for every input?* Most people freeze there, write `@given(st.integers())` with a trivial assertion, and conclude property testing is overrated. It is not — they were missing a catalog. There is a known, small set of property shapes that covers most real code, and applying it is mechanical once known. ## Step 1: find the property by working the catalog Do not stare at the function hoping for inspiration. Go through the patterns and ask which apply. Usually two or three do. | Pattern | Shape | Applies when | | --- | --- | --- | | **Round trip** | `decode(encode(x)) == x` | Anything with an inverse: serialise, compress, parse/print, encrypt | | **Oracle** | `fast(x) == slow(x)` | A slow, obviously-correct version exists — or the stdlib already does it | | **Invariant** | `is_sorted(sort(xs))`, `len(f(xs)) == len(xs)` | Something is preserved or guaranteed regardless of input | | **Idempotence** | `f(f(x)) == f(x)` | Normalise, dedupe, sort, sanitise, clamp | | **Commutativity** | `f(a, b) == f(b, a)` | Order should not matter — merges, unions, set operations | | **Metamorphic** | `f(bigger) >= f(x)` |