proptest

Verify Rust code invariants with property-based testing using proptest.

Updated Jan 25, 2026
One-click install
npx skills add https://github.com/patrykgz/rust-devagent-loop-template --skill proptest
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: proptest
Source: https://github.com/patrykgz/rust-devagent-loop-template/tree/main/.claude/skills/proptest
Command: npx skills add https://github.com/patrykgz/rust-devagent-loop-template --skill proptest

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Property-based testing helps ensure correctness by verifying invariants across various inputs and shrinking failing cases to minimal examples.

Core Features & Use Cases

  • Property-based testing of Rust code using proptest, generating arbitrary data with strategies.
  • Shrinking: automatically reduces failing inputs to minimal counterexamples for easier debugging.
  • Optional: derive Arbitrary using proptest-derive for custom types.
  • Use Case: ensure a function behaves correctly for edge values across many inputs.

Quick Start

Write a proptest-based test that asserts a property holds for arbitrary inputs using the proptest! macro.

Frequently Asked Questions about proptest

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

FAQPage Schema
How does property-based testing in Rust find edge cases?

Property-based testing in Rust verifies invariants by generating arbitrary data inputs. This approach automatically uncovers edge cases that might cause failures.

How do I write a proptest test using the proptest macro?

Write a proptest test by applying the proptest! macro to assert a property holds for arbitrary inputs. This verifies invariants across custom types and collections.

Can I generate arbitrary data for custom Rust types with proptest?

Yes, you can generate arbitrary data for custom Rust types using proptest. The optional proptest-derive crate allows deriving Arbitrary for complex nested structures.

How does shrinking reduce failing test cases in Rust?

Shrinking in Rust automatically reduces failing arbitrary data inputs to minimal counterexamples. This makes debugging property-based test failures significantly easier.

Do I need the proptest-derive crate to use property-based testing?

No, the proptest-derive crate is optional. You can perform property-based testing using the core proptest crate with strategies for collections and custom types.