AI agent skill for testing Zod schemas — Jest/Vitest patterns, mock data, property-based testing. Works with Claude Code, Cursor, Codex, Windsurf.
# Zod Testing Created by **[Anivar Aravind](https://anivar.net)** An AI agent skill for testing Zod schemas with Jest and Vitest. ## The Problem AI agents often write schema tests that only check the happy path, use `parse()` instead of `safeParse()` (crashing instead of failing), test schema internals (`.shape`, `._def`) instead of behavior, or hardcode mock data instead of generating it from the schema. The result: tests that miss regressions and break on harmless refactors. ## This Solution A focused testing skill covering schema correctness testing, error assertion patterns, mock data generation, snapshot testing with `z.toJSONSchema()`, property-based testing, structural testing, and drift detection — with 14 anti-patterns showing exactly what goes wrong and how to fix it. ## Install ```bash npx skills add anivar/zod-testing -g ``` Or with full URL: ```bash npx skills add https://github.com/anivar/zod-testing ``` ## Baseline - zod ^4.0.0 - Jest or Vitest - TypeScript ^5.5 ## What's Inside ### Testing Approaches | Approach | Type | Use When | |----------|------|----------| | `safeParse()` result checking | Correctness | Default — always use safeParse in tests | | `z.flattenError()` assertions | Error messages | Verifying specific field errors | | `z.toJSONSchema()` snapshots | Schema shape | Detecting unintended schema changes | | Mock data generation | Fixtures | Need valid/randomized test data | | Property-based testing | Fuzz testing | Schemas must handle arbitrary valid inputs | | Structural testing | Architecture | Verify schemas are only imported at boundaries | | Drift detection | Regression | Catch unintended schema changes via JSON Schema snapshots | ### Anti-Patterns 14 common testing mistakes with BAD/GOOD code examples: - Testing schema internals instead of behavior - Not testing error paths (only happy path) - Using `parse()` in tests (crashes instead of failing) - Not testing boundary values (min/max edges) - Hardcoding mock data i
Agent that generates comprehensive documentation, API references, architecture diagrams, and developer onboarding guides from existing code.
Agent configuration for systematic bug investigation that traces issues from error logs through the codebase to root cause with suggested fixes.
Agent for integrating third-party APIs including SDK setup, type generation, error handling, retry logic, and rate limit management.
Cursor's built-in autonomous coding agent that can make multi-file edits, run terminal commands, search the codebase, and iteratively build features with minimal human intervention.
Cloud-based autonomous coding agent that runs in the background on remote sandboxed environments, handling complex multi-step tasks while you continue working.
Cursor's multi-file editing agent within Composer mode that can create, edit, and delete files across your entire project in a single conversation.