← ClaudeAtlas

pbtlisted

Write property-based tests using rapid (pgregory.net/rapid) for Go. Triggers on: "property-based tests", "PBT", "rapid tests", "test with random inputs", "generative tests", "test properties", "randomized testing"
jeremiah-masters/skills · ★ 0 · AI & Automation · score 72
Install: claude install-skill jeremiah-masters/skills
# Rapid: Property-Based Testing for Go Rapid (`pgregory.net/rapid`) is a Go library for property-based testing. Tests integrate with `go test` via `rapid.Check`. Rapid generates random inputs for your code and automatically shrinks failing cases to minimal counterexamples. It has zero external dependencies. ## Workflow Follow these steps when writing property-based tests. ### 1. Load the Go Reference Load `references/go.md` for full API details and idiomatic patterns. ### 2. Explore the Code Under Test Before writing any test, understand what you're testing: - **Read the source code** of the function/module under test - **Read existing tests** to understand expected behavior and edge cases - **Read godoc comments and type signatures** for documented contracts - **Read usage sites** to see how callers use the code and what they expect The goal is to find *evidence* for properties, not to invent them. ### 3. Identify Valuable Properties Look for properties that are: - **Grounded in evidence** from the code, docs, or usage patterns - **Non-trivial** — they test real behavior, not tautologies, and do not duplicate the code being tested - **Falsifiable** — a buggy implementation could actually violate them Write one test per property. Don't cram multiple properties into one test. ### 4. Check for Existing Tests to Evolve or Port Before writing tests from scratch, **always** check existing tests: - **Existing PBTs in another framework** (`testing/quick`, etc.) shoul