property-based-testing

Design property-based test strategies and review workflows across multiple languages.

6.5k|561|Updated Jan 14, 2026
One-click install
npx skills add https://github.com/trailofbits/skills --skill property-based-testing-trailofbits
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: property-based-testing
Source: https://github.com/trailofbits/skills/tree/main/plugins/property-based-testing/skills/property-based-testing
Command: npx skills add https://github.com/trailofbits/skills --skill property-based-testing-trailofbits

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Property-based testing helps teams shift from example-driven tests to invariants and generative testing, capturing edge cases and reducing brittle test suites.

Core Features & Use Cases

  • Guidance for designing input strategies, selecting properties (roundtrip, idempotence, invariants), and reviewing PBT tests across languages (Python/Hypothesis, JavaScript/fast-check, Rust/proptest, Go/rapid, Java/jqwik, etc.)
  • Practical workflows for unit tests, contract testing in smart contracts, and design-first development using properties.

Quick Start

Write a high-level plan for a function: describe input domains, the properties to validate, and a minimal example of a property-based test skeleton.

Frequently Asked Questions about property-based-testing

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

FAQPage Schema
How do I design input strategies for property-based testing?

Property-based testing shifts focus from specific examples to invariants and generative testing. This approach automatically captures edge cases and reduces brittle test suites by validating that universal properties hold across generated inputs.

Can I use property-based testing for smart contracts?

Yes, property-based testing supports smart contract contexts. You can apply strategy design and property catalogs to validate contract invariants, using practical workflows specifically tailored for contract testing and design-first development.

Does property-based testing work with Python and JavaScript frameworks?

Property-based testing works across multiple languages including Python with Hypothesis and JavaScript with fast-check. It also supports Rust with proptest, Go with rapid, and Java with jqwik, guiding strategy design and test review workflows.

What invariants should I validate when writing property-based tests?

You should validate invariants such as roundtrip, idempotence, and other structural properties. Selecting properties involves identifying the rules your function must always satisfy and using a property catalog to ensure comprehensive coverage.

Why does my example-driven test suite miss edge cases?

Example-driven tests miss edge cases because they only check explicitly defined inputs. Shifting to property-based testing captures edge cases by generating diverse inputs and validating invariants, reducing brittle test suites.