property-based-testing

Detect when property-based testing outperforms example-based tests for pure functions.

1|Updated Jan 7, 2026
One-click install
npx skills add https://github.com/adamatdevops/forge-works --skill property-based-testing-adamatdevops
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: property-based-testing
Source: https://github.com/adamatdevops/forge-works/tree/main/.skills/trailofbits/property-based-testing
Command: npx skills add https://github.com/adamatdevops/forge-works --skill property-based-testing-adamatdevops

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Property-based testing helps you uncover hidden edge cases and spec violations that example-based tests often miss by testing general properties across many generated inputs.

Core Features & Use Cases

  • Automatic Detection of High-Value Patterns: Triggers when you see serialization pairs, parsers, normalization/validation logic, pure functions, data-structure operations, and even smart-contract state invariants.
  • Property Catalog & Prioritization: Guides you toward stronger properties (roundtrip, idempotence, invariants, commutativity, oracle comparisons) instead of settling for weak checks.
  • Methodical Design Workflow: Supports property-driven development by defining the input domain (strategies) and then writing tests that exercise the properties before code is implemented or refactored.

Quick Start

Invoke the skill when you are testing an encode/decode pair so it can define a roundtrip property and suggest appropriate generators and edge-case examples.

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 differ from example-based testing?

Property-based testing uncovers hidden edge cases and spec violations by testing general properties across many generated inputs, whereas example-based testing only checks specific hardcoded values. It automatically detects high-value patterns like serialization pairs and pure functions to provide stronger coverage.

How do I design generators and select properties for testing parsers and validators?

To design generators for parsers and validators, define the input domain constraints and select stronger properties like roundtrip, idempotence, invariants, commutativity, or oracle comparisons. This methodical workflow ensures generated inputs exercise the properties before code is implemented or refactored.

When should I use property-based testing instead of example-based tests?

Use property-based testing when evaluating transformations, parsers, validators, or pure functions with well-defined contracts. It is appropriate when you need to verify roundtrip, idempotence, invariants, commutativity, and oracle-based properties across generated input domains rather than isolated examples.

How do I test encode and decode roundtrip properties with generated inputs?

To test encode and decode roundtrip properties, invoke the skill to define a roundtrip property and suggest appropriate generators and edge-case examples. This ensures that decoding an encoded value yields the original input across a wide range of generated domains.

What are the limitations of property-based testing for complex functions?

Property-based testing is not appropriate when functions lack well-defined contracts or clear invariants. It requires guided selection of property types and careful generator strategy design constraints, making it less suitable for logic without verifiable roundtrip, idempotence, or oracle-based properties.

Can I use property-based testing for normalization and data structure operations?

Yes, property-based testing applies to normalization logic and data-structure operations by verifying invariants and idempotence across generated input domains. It guides the selection of property types and generator strategies to ensure transformations maintain their defined contracts.