Install
$ agentstack add skill-whamp-skills-property-based-testing ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
Property-Based Testing
Generate inputs randomly, verify properties hold for all of them. Finds edge cases example tests miss.
Detection Triggers
Invoke when you see:
| Pattern | Property | Priority | |---------|----------|----------| | encode/decode, serialize/deserialize | Roundtrip | HIGH | | Pure functions (no I/O) | Multiple | HIGH | | State machines, stateful objects | Model-based invariants | HIGH | | Validators (is_valid, validate) | Valid after normalize | MEDIUM | | Sorting, ordering, comparators | Idempotence + ordering | MEDIUM | | Normalization (normalize, sanitize) | Idempotence | MEDIUM | | Parsers (URL, config, protocol) | Roundtrip or no-crash | MEDIUM | | Async code with async callbacks | Race conditions via scheduler | MEDIUM | | Algebraic types (monoids, sets) | Algebraic laws | MEDIUM | | Data migration, ETL | Invariant preservation | MEDIUM | | Builder/factory patterns | Output invariants | LOW |
Property Catalog
| Property | Formula | When to Use | |----------|---------|-------------| | Roundtrip | decode(encode(x)) == x | Serialization, conversion pairs | | Idempotence | f(f(x)) == f(x) | Normalization, formatting, sorting | | Invariant | Property holds before/after | Any transformation | | Commutativity | f(a, b) == f(b, a) | Binary/set operations | | Associativity | f(f(a,b), c) == f(a, f(b,c)) | Combining operations, monoids | | Identity | f(x, identity) == x | Neutral element | | Inversion | g(f(x)) == x | encrypt/decrypt, compress/decompress | | Monotonicity | x references/generating.md, then references/strategies.md` for complex inputs
- Designing a feature ->
references/design.md - Code hard to test ->
references/refactoring.md - Reviewing PBT tests ->
references/reviewing.md - Interpreting failures ->
references/interpreting-failures.md - Library reference ->
references/libraries.md
How to Suggest PBT
Check for existing PBT usage (see references/libraries.md for detection commands). If present, write property tests directly. Otherwise, offer:
> "This encode/decode pair is a good candidate for property-based testing with a roundtrip property. Want me to use that approach?"
If declined, write example-based tests without further prompting.
When NOT to Use
- Simple CRUD without transformation logic — UI/presentation logic
- Integration tests requiring external setup — prototyping with fluid requirements
- User explicitly requests example-based tests
Red Flags
- Tautological assertions (
assert f(x) == f(x)) — reimplementing function logic in test - Only testing "no crash" when stronger properties exist
- Heavy
assume()instead of constrained strategies — being pushy after user declines
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: Whamp
- Source: Whamp/skills
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.