property-based-testing skill
✓ OfficialWrites, reviews, and debugs property-based tests using tools like Hypothesis and fast-check to verify rules across entire input domains.
- GitHub stars
- 8,136
- Files
- 9
- Last commit
- Nov 11, 2026
- License
- CC-BY-SA-4.0
- Allowed tools
- —
What does the property-based-testing skill do?
property-based-testing is an agent skill. Writes, reviews, and debugs property-based tests using tools like Hypothesis and fast-check to verify rules across entire input domains.
Summary generated from the skill's SKILL.md.
About the property-based-testing skill
Developers who need to verify rules across entire input domains rather than relying on hand-picked examples can use this skill to write, review, and debug property-based tests. It is designed for code with algebraic shapes, such as functions involving inverses, invariants, or oracles. An agent should load this tool when tasked with testing serialization pairs, parsers, validators, or smart-contract state invariants.
The skill supports various specialized libraries including Hypothesis, fast-check, proptest, jqwik, rapid, and Echidna or Medusa for Solidity. It helps identify whether a test is a tautology or suffers from vacuity, and assists in interpreting failures when a generator has shrunk a counterexample. This is not intended for binary fuzzing, mutation testing, static analysis, or end-to-end UI testing.
What an agent can do with it
- 1Verify serialization logicCreate roundtrip tests to ensure that decoding an encoded value returns the original input.
- 2Test smart contract invariantsCheck that specific properties hold true before and after any state transformation in Solidity.
- 3Debug failed property testsAnalyze a shrunk counterexample to determine if the failure indicates a genuine bug or a poorly defined property.
- 4Audit existing test suitesReview current property tests to judge if they are asserting anything real or merely restating the implementation.
Written from the skill's SKILL.md. Every use case is checked against a quote from it.
How to install the property-based-testing skill
Each command copies the skill folder into the client's skills directory. Restart the client or start a new session to load it.Install the property-based-testing skill in Plugin
/plugin marketplace add trailofbits/skills /plugin install property-based-testing@trailofbits
Install the property-based-testing skill in Claude Code
~/.claude/skills/property-based-testing/SKILL.md
$ npx degit trailofbits/skills/plugins/property-based-testing/skills/property-based-testing ~/.claude/skills/property-based-testingInstall the property-based-testing skill in Claude Code (project)
.claude/skills/property-based-testing/SKILL.md
$ npx degit trailofbits/skills/plugins/property-based-testing/skills/property-based-testing .claude/skills/property-based-testingInstall the property-based-testing skill in Codex
~/.agents/skills/property-based-testing/SKILL.md
$ npx degit trailofbits/skills/plugins/property-based-testing/skills/property-based-testing ~/.agents/skills/property-based-testingInstall the property-based-testing skill in Gemini CLI
~/.gemini/skills/property-based-testing/SKILL.md
$ npx degit trailofbits/skills/plugins/property-based-testing/skills/property-based-testing ~/.gemini/skills/property-based-testingInstall the property-based-testing skill in Claude.ai
npx degit trailofbits/skills/plugins/property-based-testing/skills/property-based-testing property-based-testing && zip -r property-based-testing.zip property-based-testing # claude.ai → Customize → Skills → + → Create skill → Upload a skill → property-based-testing.zip
Automated checks
Ran Nov 15, 2026Full report →Not verified yet. A skill needs a score of 80, no serious finding, and enough data for us to check. How checks work · What to fix for more points
- Source repository linked and reachabletrailofbits/skills/plugins/property-based-testing/skills/property-based-testing is public and reachablegithub.com/trailofbits/skills/tree/HEAD/plugins/property-bas ↗Pass
- Open source license (OSI)CC-BY-SA-4.0 is not OSI-approvedspdx.org/licenses/CC-BY-SA-4.0.html ↗Finding
- Commit or release in the last yearLast commit 2026-11-11github.com/trailofbits/skills/commits ↗Pass
- No download-and-run or credential theft in scriptsNo scripts in the skill folderPass
- No hidden instructions in SKILL.mdNo override phrases, safeguard switches, credential requests or hidden charactersgithub.com/trailofbits/skills/blob/HEAD/plugins/property-bas ↗Pass
- Pre-approved tools are scopedNo pre-approved tools; the agent asks before using onegithub.com/trailofbits/skills/blob/HEAD/plugins/property-bas ↗Pass
- SKILL.md follows the Agent Skills formatValid name and description; says when to use it; 69 linesgithub.com/trailofbits/skills/blob/HEAD/plugins/property-bas ↗Pass
SKILL.md
View on GitHubProperty-Based Testing
An example test asserts one point. A property asserts a rule over the whole input domain and lets the generator hunt for the counterexample. That trade is worth making when the code has an algebraic shape — an inverse, an invariant, an oracle — and not otherwise. Code with no such shape gets example tests; saying so is a valid outcome.
Check first whether the shape is missing or merely buried. A calculation wrapped in I/O, a string built by concatenation, an in-place mutation — each has a property and no seam to assert it through. See references/refactoring.md before concluding there is nothing to assert.
Property catalog
| Property | Formula | Where it applies |
|---|---|---|
| Roundtrip | decode(encode(x)) == x |
Serialization, conversion pairs |
| Inverse | f(g(x)) == x |
encrypt/decrypt, compress/decompress |
| Oracle | new(x) == reference(x) |
Optimization, refactoring, reimplementation |
| Idempotence | f(f(x)) == f(x) |
Normalization, formatting, sorting |
| Invariant | Holds before and after | Any transformation, contract state |
| Easy to verify | is_sorted(sort(x)) |
Complex algorithms with cheap checkers |
| Commutativity | f(a, b) == f(b, a) |
Binary and set operations |
| Associativity | f(f(a,b), c) == f(a, f(b,c)) |
Combining operations |
| Identity | f(x, e) == x |
Operations with a neutral element |
Strength ordering, weakest to strongest:
no crash → type preservation → invariant → idempotence → roundtrip / oracle.
Assert the strongest property the code supports. "No crash" alone rarely justifies the dependency — if that is all you can find, either a small rearrangement exposes something stronger, or the honest report is that this code is a poor PBT candidate. Rule out the first before settling for the second.
The two ways a property test asserts nothing
- Tautology.
assert add(a, b) == a + brestates the implementation; no bug they share can fail it. Pick a property that constrains the function without recomputing it. Note the exception:f(x) == f(x)is a genuine determinism property whenfis not obviously pure — serializers over dicts or sets, hashing, anything reading the clock. - Vacuity.
assume()that filters out nearly every input passes without exercising anything, and self-contradictoryassume()passes having run zero cases. Push constraints into the strategy so the generator produces valid inputs directly.
Where to look next
Load the one that matches the task in front of you:
| Task | File |
|---|---|
| Writing new tests, designing strategies | references/generating.md |
| The code has no property to assert yet | references/refactoring.md |
| Reviewing existing property tests | references/reviewing.md |
| A property test just failed | references/interpreting-failures.md |
| Library choice, Echidna and Medusa | references/libraries.md |
Introducing PBT to a project that lacks it
If the project already uses a PBT library, just write the tests in it. If it does not, adding one is a dependency decision that belongs to the user — offer it once with the specific property you would write, and take the answer either way.
Files in this skill
9property-based-testing skill questions
How do I install the property-based-testing skill in Claude Code?
Run npx degit trailofbits/skills/plugins/property-based-testing/skills/property-based-testing ~/.claude/skills/property-based-testing. Claude Code loads skills from ~/.claude/skills (all projects) or .claude/skills (one project) and uses a skill when its description matches the task.
Which clients can use the property-based-testing skill?
Any client that reads the Agent Skills format: Claude Code, Codex, Gemini CLI and claude.ai (upload as a ZIP). Scripts in the skill run only where the client allows code execution.
When should I use property-based testing instead of example-based testing?
Use it whenever tests should cover a whole input domain instead of a hand-picked list of examples, such as for serialization pairs, parsers, or smart-contract state invariants.
Why might a property test fail to assert anything meaningful?
A test might be a tautology, which simply restates the implementation, or it might suffer from vacuity, where constraints filter out almost all valid inputs.