property-based-testing

Run property-based tests that generate inputs and shrink failures to minimal counterexamples.

1|Updated May 6, 2026
One-click install
npx skills add https://github.com/jacob-balslev/skill-graph --skill property-based-testing-jacob-balslev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: property-based-testing
Source: https://github.com/jacob-balslev/skill-graph/tree/main/marketplace/skills/property-based-testing
Command: npx skills add https://github.com/jacob-balslev/skill-graph --skill property-based-testing-jacob-balslev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Property-based testing helps you validate correctness by expressing a universal contract that must hold for all inputs in a domain, then generating many inputs to challenge that contract.

Core Features & Use Cases

  • Universal property assertions: Specify invariants, oracles, and round-trip properties rather than one-off input-output expectations.
  • Generator + shrinker discipline: Generate representative edge-covering inputs and shrink failures to minimal counterexamples for fast debugging.
  • Choosing where PBT fits: Use PBT for combinatorial correctness and round-trips; use examples for specific behaviors, fuzzing for crash-focused exploration, and mutation testing to measure suite quality.

Quick Start

Apply property-based testing when you need to prove an invariant or round-trip contract across many generated inputs for a function or transformation.

Frequently Asked Questions about property-based-testing

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

FAQPage Schema
How does property-based testing find bugs that example-based tests miss?

Property-based testing validates universal correctness claims by generating many inputs across a domain and shrinking failures to minimal counterexamples. Unlike example-based tests checking specific expectations, it automatically explores rich input domains to challenge invariants.

When should I use property-based testing instead of fuzz testing or mutation testing?

Use property-based testing for combinatorial correctness, invariants, and round-trip specifications. Use fuzz testing for crash-focused exploration, mutation testing to measure suite quality, and example-based tests for specific behaviors, ensuring clear separation between approaches.

How do I write a property-based test for a round-trip transformation?

Express a universal round-trip property, design generators to produce representative edge-covering inputs, and run trials to verify the property holds. When a failure occurs, the shrinker automatically reduces it to a minimal counterexample for fast debugging.

Do I need to design custom generators and shrinkers for property-based testing?

Yes, property-based testing requires generator and shrinker discipline to produce representative edge-covering inputs and shrink failures to minimal counterexamples. You must also set appropriate trial budgets to effectively validate the universal property across the input domain.

Can property-based testing verify state-machine models and component-level invariants?

Property-based testing applies to unit-level and component-level verification for invariants, oracles, and round-trip specifications. It requires clear separation from state-machine modeling, meaning you must define clearly universal and falsifiable properties for your specific domain.