# property-based-testing

This skill helps create and inspect tests that check rules across generated inputs. Use it for parsers, serialization pairs, data structures, and Solidity contract invariants.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 7000 installs · ★ 7805
- Author: trailofbits
- License: CC-BY-SA-4.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/trailofbits/skills/tree/HEAD/plugins/property-based-testing/skills/property-based-testing/SKILL.md
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/skills/property-based-testing

## What it does

The skill helps choose meaningful claims about code, such as whether a conversion can be reversed or a normalization step stays stable when repeated. It can draft tests, assess an existing suite, and investigate a failure to distinguish a flawed claim from a defect in the code.

It covers Hypothesis, fast-check, proptest, jqwik, and rapid, plus Echidna and Medusa for Solidity invariants. Its supporting guides address generators, test review, failure analysis, library selection, and code changes that expose a testable property.

For a project without a property-testing library, adding that dependency remains the user's call; the skill suggests a test rather than installing a library. It is not aimed at binary fuzzing, mutation testing, static analysis, benchmarks, or end-to-end UI checks.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add trailofbits/skills --skill property-based-testing -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/property-based-testing/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/property-based-testing/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add trailofbits/skills --skill property-based-testing -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/property-based-testing/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add trailofbits/skills --skill property-based-testing -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/property-based-testing/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install trailofbits/skills property-based-testing
```

2. **Manually: put the files in place**
- File: `.github/skills/property-based-testing/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add trailofbits/skills --skill property-based-testing -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/trailofbits/skills --path plugins/property-based-testing/skills/property-based-testing
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/property-based-testing/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add trailofbits/skills --skill property-based-testing -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/trailofbits/skills/tree/HEAD/plugins/property-based-testing/skills/property-based-testing/SKILL.md

## When to use it
- Test that encoding can be reversed by decoding
- Define useful claims for a parser or normalizer
- Spot vacuous or self-confirming test assertions
- Determine whether a shrunk counterexample reveals a bug
- Check state invariants in Solidity contracts

## Example prompts
- Write property-based tests for the encode and decode pair.
- Review the `@given` tests and find assertions that cannot catch a bug.
- Inspect this failing test's counterexample and decide whether its property is sound.

## Similar
- [improve-codebase-architecture](https://affpapa.org/en/nevibecode/skills/improve-codebase-architecture.md) — skill · 1163035 installs
- [design-taste-frontend](https://affpapa.org/en/nevibecode/skills/design-taste-frontend.md) — skill · 678700 installs
- [tdd](https://affpapa.org/en/nevibecode/skills/tdd.md) — skill · 1141062 installs
- [skill-creator](https://affpapa.org/en/nevibecode/skills/skill-creator.md) — skill · 414180 installs
- [agent-browser](https://affpapa.org/en/nevibecode/skills/vercel-labs-agent-browser.md) — skill · 1200000 installs
- [prototype](https://affpapa.org/en/nevibecode/skills/prototype.md) — skill · 986201 installs

From the same set: [trailofbits/skills](https://affpapa.org/en/nevibecode/by/trailofbits/skills.md) — 77 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
