Claude-skill-registry gen-property-test
Generate fast-check property tests following project conventions
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/gen-property-test" ~/.claude/skills/majiayu000-claude-skill-registry-gen-property-test && rm -rf "$T"
manifest:
skills/data/gen-property-test/SKILL.mdsource content
Generate Property Test
Generate a property-based test for the
{{ method }} method on the Decimal class.
Project Conventions
This project uses fast-check for property-based testing. Follow these patterns:
Custom Arbitrary
Use the existing
decimalArb pattern from src/core/decimal.property.test.ts:
import * as fc from "fast-check"; import { Decimal } from "./decimal"; // Arbitrary for valid decimal values const decimalArb = fc .tuple( fc.bigInt({ min: -10n ** 18n, max: 10n ** 18n }), fc.integer({ min: 0, max: 8 }) ) .map(([significand, scale]) => { const str = significand.toString(); if (scale === 0) return Decimal.from(str); const insertPoint = str.length - scale; if (insertPoint <= 0) { return Decimal.from(`0.${"0".repeat(-insertPoint)}${str.replace("-", "")}`); } return Decimal.from(`${str.slice(0, insertPoint)}.${str.slice(insertPoint)}`); });
Test Structure
import { describe, test, expect } from "bun:test"; import * as fc from "fast-check"; describe("{{ method }} properties", () => { test("property name", () => { fc.assert( fc.property(decimalArb, (a) => { // Return boolean for invariant return /* invariant expression */; }) ); }); });
Mathematical Invariants to Consider
For arithmetic operations, consider these properties:
| Property | Formula | Applies To |
|---|---|---|
| Identity | | add(0), multiply(1) |
| Commutativity | | add, multiply |
| Associativity | | add, multiply |
| Inverse | | add/negate, multiply/reciprocal |
| Distributivity | | multiply over add |
| Idempotence | | min, max |
| Absorption | | min/max |
Output Location
Add tests to:
src/core/decimal.property.test.ts
Your Task
- Read
to understand existing patternssrc/core/decimal.property.test.ts - Read
to understand thesrc/core/decimal.ts
implementation{{ method }} - Generate property tests for
covering relevant invariants{{ method }} - Add tests to the existing property test file in the appropriate describe block