propertieslisted
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)` |