Skip to content
Skills Library
Programming · Testing

property-based-tests

/property-based-tests

Write property-based tests (Hypothesis for Python, fast-check for JS/TS, jqwik or FsCheck for JVM/.NET) that state invariants and let the framework search for counter-examples. Use for parsers, serializers, calculations, money/rounding, sorting, state machines, or anywhere example tests keep missing edge cases.

Licence
MIT
Last repository change
10.11.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 10.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Write property-based tests (Hypothesis for Python, fast-check for JS/TS, jqwik or FsCheck for JVM/.NET) that state invariants and let the framework search for counter-examples. Use for parsers, serializers, calculations, money/rounding, sorting, state machines, or anywhere example tests keep missing edge cases.

Original author description

Write property-based tests (Hypothesis for Python, fast-check for JS/TS, jqwik or FsCheck for JVM/.NET) that state invariants and let the framework search for counter-examples. Use for parsers, serializers, calculations, money/rounding, sorting, state machines, or anywhere example tests keep missing edge cases.

How it works

  1. Find properties
  2. Steps
  3. Output
Original SKILL.md headings · 22 lines, 173 words
SKILL.md preview
---
name: property-based-tests
description: "Write property-based tests (Hypothesis for Python, fast-check for JS/TS, jqwik or FsCheck for JVM/.NET) that state invariants and let the framework search for counter-examples. Use for parsers, serializers, calculations, money/rounding, sorting, state machines, or anywhere example tests keep missing edge cases."
---

# Property-based tests

## Find properties
| Pattern | Example |
|---|---|
| Round trip | `parse(format(x)) == x` (CSV, JSON, dates, amounts) |
| Invariant | Sum of invoice lines == invoice total; balance of debits == credits |
| Idempotence | `normalize(normalize(x)) == normalize(x)` |
| Oracle / reference | Optimised function == simple slow implementation |
| Metamorphic | Adding a 0-amount line does not change the total; sorting twice == sorting once |
| No crash | Any input of the right type -> no exception other than documented ones |

## Steps
1. Pick 2-4 properties for the unit under test; say why each matters.
2. Write generators that respect the domain (e.g. amounts as integers of cents, dates within the fiscal year), plus `assume()` for preconditions.
3. Run with enough examples (`max_examples=500` for critical code).
4. When a counter-example is found, keep the **shrunk** failing input as a regular example test.

## Output
Test code, the properties in plain words, and any counter-example found with its explanation.

Versions

The database has no other skills named property-based-tests.

Database snapshot: 13.11.2026 · package version d74f851e61a0 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 3 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100property-based-test
    Use when a ticket's correctness is about invariants over many inputs — parsers and serialisers, encoders/decoders, arithmetic and date logic, sorting and merging, state machines, concurrent operations and interleavings — anything with "for all inputs" in its contract, where…
  • 95property-based-testing
    Writes, reviews, and debugs property-based tests — Hypothesis, fast-check, proptest, jqwik, rapid, and Echidna or Medusa for Solidity invariants. Use whenever tests should cover a whole input domain instead of a hand-picked list of examples: encode/decode and…
  • 100property-based-testing
    Property-based testing with fast-check (TS/JS) and Hypothesis (Python). Use when generating test data, finding edge cases, testing properties, or writing QuickCheck-style tests.
  • 100property-based-testing
    Property-based testing (PBT) patterns with fast-check (JS/TS), Hypothesis (Python), and gopter (Go). Generate random inputs, define invariants, shrink failures to minimal cases. Adapted from Trail of Bits. Use when testing pure functions, parsers, serializers, state machines, or…
  • 100property-based-testing
    Use when writing, reviewing, or modifying property-based tests, such as those using `fast-check`, or when asked to add test coverage.
  • 95property-based-testing
    Property-based testing with fast-check (TypeScript/JavaScript) and Hypothesis (Python). Generate test cases automatically, find edge cases, and test mathematical properties. Use when user mentions property-based testing, fast-check, Hypothesis, generating test data,…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.