property-based-testing

Adopt property-based testing to validate code against a wide input space.

1|Updated Apr 28, 2026
One-click install
npx skills add https://github.com/naramore/dotai --skill property-based-testing-naramore
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: property-based-testing
Source: https://github.com/naramore/dotai/tree/main/claude/skills/property-based-testing
Command: npx skills add https://github.com/naramore/dotai --skill property-based-testing-naramore

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Property-based testing helps you move beyond one-off examples to describe and verify how code behaves under a wide range of inputs. It focuses on invariants, generators, shrinking, and model-based reasoning to reveal edge-case bugs that example-based tests often miss.

Core Features & Use Cases

  • Language-agnostic guidance applicable across Go, Python, Rust, and Elixir.
  • Five canonical strategies: Validity, Postcondition, Metamorphic, Inductive, Model-based.
  • Generator design and shrinking best practices, plus CI regression handling and language-specific recipes.
  • Practical use cases include serialization, parsing, and stateful protocols.

Quick Start

Define a small property-based test with a basic generator and one invariant you want to prove, and run it in your test framework.

Frequently Asked Questions about property-based-testing

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

FAQPage Schema
What is property-based testing and how does it find edge-case bugs?

Property-based testing validates code against a wide input space by defining invariants and generating inputs automatically. It reveals edge-case bugs that example-based tests miss by focusing on model-based reasoning and input shrinking to isolate failures.

How do I write a property-based test for serialization and parsing logic?

To write a property-based test for serialization, define a basic generator to create inputs and establish an invariant proving the output holds true. Apply this to parsing logic to ensure data structures maintain their expected state across generated inputs.

Can I apply property-based testing strategies across Go, Python, Rust, and Elixir?

Yes, you can apply property-based testing across Go, Python, Rust, and Elixir. The approach provides language-agnostic strategies, including validity, postcondition, and model-based testing, allowing you to validate stateful logic regardless of your programming environment.

What are the best property-based testing strategies for stateful protocols?

The best strategies for stateful protocols include model-based and inductive testing. These approaches validate that invariants hold across many generated inputs, allowing you to verify complex state transitions and protocol rules effectively during testing.

How does shrinking work in property-based testing to isolate failures?

Shrinking automatically reduces a failing generated input to its minimal form to make the bug easier to diagnose. It works by systematically simplifying the input data while preserving the failure, helping you pinpoint the exact edge-case that broke the invariant.

How do I integrate property-based testing into CI-friendly regression workflows?

To integrate property-based testing into CI-friendly regression workflows, configure your tests to run generated inputs and capture failing states. This allows your CI pipeline to automatically detect brittle tests and validate that invariants hold across a wide input space.