property-testinglisted
Install: claude install-skill nyxandro/property-testing-skill
# Property-based tests
An example test checks the inputs someone thought of. A property test states what must hold
for every input, lets the library generate hundreds of inputs it would take a person weeks to
think of, and when one breaks the statement, shrinks it to the smallest case that still breaks
it: not a list of three hundred elements but `[0]` with `n = 2`. That minimal case points at
the bug directly.
Property tests complement example tests, they do not replace them. One property test per
function that has a clear property; everything else stays example-based. Do not convert
existing example tests, do not add properties to glue code. Code with no property gets example
tests, and saying so is a valid outcome.
A green property test is not a proof. It says the generator found no counterexample in the
runs it made, over the domain you described; it does not say none exists. Its strength is
exactly the honesty of the generator. Report it that way: "no counterexample in a hundred
runs over inputs of this shape", never "correct for all inputs".
The method is the same in every language. The first part of this skill is the method; the two
sections at the end are the tooling for TypeScript and for Python. Read the method, then the
section for the project's language.
## When it fits
The shape of the function tells you both whether a property test is worth it and which
property to state.
| Shape of the function | Property to state |
| --- | --- |
| Has an inverse: serial