aj-geddes avatar

Property Based Testing

This generates random inputs to verify your code satisfies general properties rather than just testing handpicked examples. It's great for catching edge cases you'd never think to test manually, like testing that reversing a string twice returns the original or that sorting preserves length. The skill covers Hypothesis for Python, fast-check for JavaScript, and junit-quickcheck for Java. The real value is in the shrinking: when a test fails, these tools automatically minimize the failing input to show you the simplest case that breaks your code. Works best alongside traditional tests, not as a replacement, and you need to think carefully about what properties actually matter rather than just restating your implementation.

skills.sh installs
454
GitHub stars
379
last updated
Aug 21, 2026

Install

$ npx -y skills add aj-geddes/useful-ai-prompts --skill property-based-testing --agent claude-code

Installs into .claude/skills of the current project.

Files

Property-Based Testing

Table of Contents

Overview

Property-based testing verifies that code satisfies general properties or invariants for a wide range of automatically generated inputs, rather than testing specific examples. This approach finds edge cases and bugs that example-based tests often miss.

When to Use

  • Testing algorithms with mathematical properties
  • Verifying invariants that should always hold
  • Finding edge cases automatically
  • Testing parsers and serializers (round-trip properties)
  • Validating data transformations
  • Testing sorting, searching, and data structure operations
  • Discovering unexpected input combinations

Quick Start

Minimal working example:

# test_string_operations.py
import pytest
from hypothesis import given, strategies as st, assume, example

def reverse_string(s: str) -> str:
    """Reverse a string."""
    return s[::-1]

Sponsors

Details

Repository
github.com/aj-geddes/useful-ai-prompts
Categories
Testing & QA, AI & Agent Building, Data Science & ML, Design & UI/UX
First seen
Jun 3, 2026

More from aj-geddes/useful-ai-prompts

All 258
1openclaudia avatarab-test-setupopenclaudia/openclaudia-skillsDesign, plan, and analyze A/B tests with statistical rigor. Use when the user asks about A/B testing, split testing, experiment design, statistical significance427skills.sh installs
2bobmatnyc avatarhono-testingbobmatnyc/claude-mpm-skillsHono testing patterns - app.request(), test client, mocking environment, and integration testing strategies422skills.sh installs
3pproenca avatarreact-testing-librarypproenca/dot-skillsReact Testing Library best practices for writing maintainable, user-centric tests. Use when writing, reviewing, or refactoring RTL tests. Triggers on test files418skills.sh installs
4levnikolaevich avatarln-140-test-docs-creatorlevnikolaevich/claude-code-skillsCreates test documentation (testing-strategy.md, tests/README.md) with Risk-Based Testing philosophy. Use when setting up test strategy for a project.394skills.sh installs
5pmprompt avatarab-test-designerpmprompt/claude-plugin-product-managementDesign robust A/B test experiments. Use when testing a new feature, validating a hypothesis, or optimizing conversion rates.394skills.sh installs
6dawiddutoit avatarplaywright-web-scraperdawiddutoit/custom-claudeExtract structured data from multiple web pages using Playwright with built-in ethical crawling practices including rate limiting, robots.txt compliance, and er393skills.sh installs