← ClaudeAtlas

property-testinglisted

Property-based tests: fast-check with Vitest in TypeScript, Hypothesis with pytest in Python. Writes new property tests, exposes a property in code that seems to have none, reviews existing property tests for ones that assert nothing, and triages a failed property test into a wrong property, an ambiguous spec or a real bug. Use it when the owner asks for property tests or for inputs the existing tests miss: "write property tests for this parser", "find the edge cases this function misses", "test the invariants", "tests are green but prod breaks on odd input", "model-based test for this state machine or cache", "do these property tests check anything real", "my property test failed, is it a bug or a wrong property". Also use it on your own in test-first work when the function has an inverse, normalizes or sorts, does arithmetic over money or limits, parses data through a schema, or holds state. Not for binary fuzzing (libFuzzer, AFL), mutation testing, benchmarks or end-to-end UI tests.
nyxandro/property-testing-skill · ★ 4 · Testing & QA · score 75
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