property-based-testing

Generates property-based and fuzz tests for functions with checkable invariants across five language ecosystems.

Updated May 21, 2026
One-click install
npx skills add https://github.com/CagesThrottleUs/private-ai-harness --skill property-based-testing-cagesthrottleus
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: property-based-testing
Source: https://github.com/CagesThrottleUs/private-ai-harness/tree/main/skills/property-based-testing
Command: npx skills add https://github.com/CagesThrottleUs/private-ai-harness --skill property-based-testing-cagesthrottleus

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Example-based unit tests only catch inputs the author thought to write, leaving bugs in parsers, serializers, and normalization logic undiscovered. This Skill generates property-based tests that check invariants across thousands of generated inputs and shrink failures to minimal counterexamples. ## Core Features & Use Cases - Invariant-Driven Test Generation: Writes property tests for round-trip, idempotence, invariant preservation, algebraic law, and metamorphic relation shapes during TDD's white-box pass. - Multi-Language Tool Detection: Detects the project manifest (pyproject.toml, package.json, pom.xml, Cargo.toml, go.mod) and selects Hypothesis, fast-check, jqwik, proptest, or Go's native fuzzing accordingly. - Vacuous Property Detection: Catches anti-patterns like always-true assertions and properties that re-derive the implementation, integrating with test-quality-reviewer's 3i check. - Use Case: While test-driving a new encode/decode pair, invoke this Skill to generate a Hypothesis round-trip property; when it fails, commit the shrunk counterexample as a permanent regression test. ## Quick Start Use the property-based-testing skill to write property tests for my parse and serialize functions in this Python project.

Frequently Asked Questions about property-based-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write property-based tests in Python?

Use Hypothesis with the @given decorator and strategies like st.lists(st.integers()) to generate inputs, then assert an invariant such as round-trip equality or idempotence. Install it with pip install hypothesis and let the library generate and shrink failing cases.

What is the difference between property-based testing and example-based unit tests?

Example-based tests check specific inputs the author thought of, while property-based tests check an invariant across thousands of generated inputs and shrink failures to minimal counterexamples. Projects like SQLite, Redis, and curl credit fuzz-style testing for finding most of their real bugs.

Which property-based testing library should I use for my language?

Use Hypothesis for Python, fast-check for TypeScript/JavaScript, jqwik for Java, proptest for Rust, and Go's native testing/quick or go test -fuzz for Go 1.18+. The Skill detects the right tool from your project manifest.

When should I not use property-based testing?

Skip it when correctness is inherently example-based, such as fixed lookup tables or specific business rules with no general law. Forcing a property onto such code produces vacuous invariants that pass regardless of implementation.

What is a vacuous property in property-based testing?

A vacuous property is always true regardless of implementation, like asserting only that the result is a string, or one that re-derives the expected value by calling the function under test again. Verify the property fails against a deliberately broken implementation before trusting it.

When should I escalate from property-based testing to formal verification?

Escalate when the invariant guards a critical core such as crypto, auth, monetary arithmetic, or consensus, and the language has a verifier like Verus, Dafny, SPARK, Frama-C, or OpenJML. Formal verification proves no counterexample exists rather than only testing sampled inputs.