---
name: "hypothesis-property-based-testing"
description: "Discover hidden edge cases and crashes by testing invariants against thousands of generated inputs."
metadata:
  author: "Hypothesis Works"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "property based testing hypothesis"
  - "hypothesis @given strategy"
  - "find edge case bugs python"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Hypothesis Property-Based Testing for Python

Implements Hypothesis: @given decorator, data generation strategies (st.integers, st.text, st.lists, st.builds), finding minimal failing shrink examples, and testing data serialization and parser invariants.

## When to Invoke
Invoke this skill whenever you need to:
- property based testing hypothesis
- hypothesis @given strategy
- find edge case bugs python

## Execution SOP & Rules
1. Import hypothesis: from hypothesis import given, strategies as st.
2. Decorate test function: @given(st.lists(st.integers())) def test_sorting_invariant(nums): ...
3. Assert universal invariants: sorted_nums = my_sort(nums); assert len(sorted_nums) == len(nums).
4. Observe Hypothesis report the exact shrunk minimal input that triggered an assertion failure.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
