# Design Rust Property Tests with Proptest

Property-based testing can be hard to apply because useful properties and generators are not always obvious. This skill helps Claude, Codex, or Claude Code propose targeted proptest strategies for Rust code.

## Install

```bash
npx skillstore add emillindfors/property-testing-guide
```

## Metadata

- Status: approved
- Slug: emillindfors-property-testing-guide
- Version: 1.0.0
- Author version: 1.0.0
- Skillstore revision: r1
- Version status: valid
- Tree hash: 75670b0e2433c969ed29b0edb2803f79ede5a67002de2f5ac3e6a11ca7e40c59
- Author: EmilLindfors
- GitHub username: EmilLindfors
- License: MIT
- Repository: https://github.com/EmilLindfors/claude-marketplace/tree/main/plugins/rust-testing/skills/property-testing-guide
- Ref: a06681402992ceae98ba04d54cfd4ab004862696
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: external\_commands
- Quality score: 80
- Quality tier: silver
- Public page: https://skillstore.pages.dev/skills/emillindfors-property-testing-guide
- Manifest: https://skillstore.pages.dev/api/skills/emillindfors-property-testing-guide/manifest

## Capabilities

- Suggests roundtrip properties for serialization, encoding, and decoding code.
- Identifies invariant checks for sorting algorithms and data structures.
- Recommends oracle comparisons against standard library or slower reference implementations.
- Shows proptest strategies for domain types with constrained generated values.
- Explains shrinking as a way to minimize failing generated cases.

## Use Cases

- Test Algorithm Implementations: Create properties for sorting, encoding, parsing, or numeric functions that must behave correctly across many inputs.
- Validate Data Structures: Define generated operation sequences that check ordering, balance, and consistency after every mutation.
- Improve Review Coverage: Ask an assistant to suggest missing property tests before merging complex Rust logic.

## Prompt Templates

### Find Basic Properties

```
Review this Rust function and suggest simple proptest properties that should always hold. Focus on edge cases and clear assertions.
```

### Create Roundtrip Tests

```
Design property-based tests for this Rust roundtrip path. Include suitable input strategies and explain what each property proves.
```

### Test Data Structure Invariants

```
Suggest proptest operation sequences for this data structure. Check invariants after each operation and note important generated cases.
```

### Build an Oracle Comparison Plan

```
Compare this optimized Rust algorithm against a trusted reference implementation using proptest. Propose strategies, invariants, and failure triage steps.
```

## Limitations

- Focuses on Rust examples that use the proptest crate.
- Does not execute tests or verify that generated examples compile.
- Requires project-specific knowledge to choose complete domain invariants.
- Does not replace deterministic unit tests for known business rules.

## Best Practices

- Start with properties that describe observable behavior, not implementation details.
- Use constrained strategies when generated values must satisfy domain rules.
- Keep failing cases small and readable so shrinking results are easy to debug.

## Anti Patterns

- Generating only trivial values that never exercise boundary conditions.
- Replacing all example-based tests with broad properties that hide specific requirements.
- Writing properties that duplicate the same flawed logic as the implementation under test.

## Security Audit

- Audited at: 2026-07-06T15:19:22.912\+00:00
- Summary: All static findings are false positives from Markdown code fences, Rust examples, TOML dependency text, and ordinary proptest comments. No prompt injection, malicious intent, command execution, data exfiltration, or system reconnaissance was found in SKILL.md.

## Stats

- Views: 169
- Downloads: 8
- Favorites: 0
- Popularity score: 0
