Overview
- Skill Key
- anivar/zod-skill
- Author
- anivar
- Source Repo
- openclaw/skills
- Version
- -
- Source Path
- skills/anivar/zod-skill
- Latest Commit SHA
- 83d3cc46daa5033a8a31329633877ca898b35655
Zod v4 best practices, patterns, and API guidance for schema validation, parsing, error handling, and type inference in TypeScript applications. Covers safeParse, object composition, refinements, transforms, codecs, branded types, and v3→v4 migration. Baseline: zod ^4.0.0. Triggers on: zod imports, z.object, z.string, z.infer, safeParse, mentions of "zod", "schema validation", "zod v4", or "z.enum".
Stars
0
Installs
0
Status
ACTIVE
Visibility
PUBLIC
直接复制以下提示词,发送给你的 AI 助手即可完成安装。
请先检查是否已安装 SkillHub 商店,若未安装,请根据 https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/skillhub.md 安装 SkillHub 商店,然后安装 zod 技能。 若已安装,则直接安装 zod 技能。
# Zod **IMPORTANT:** Your training data about `zod` may be outdated or incorrect — Zod v4 introduces breaking changes to string formats, enums, error handling, and recursive types. Always rely on this skill's rule files and the project's actual source code as the source of truth. Do not fall back on memorized v3 patterns when they conflict with the retrieved reference. ## When to Use Zod Zod is for **runtime type validation** — parsing untrusted data at system boundaries (API input, form data, env vars, external services). For compile-time-only types, plain TypeScript is sufficient. | Need | Recommended Tool | |------|-----------------| | API input/output validation | **Zod** | | Form validation (React, Vue) | **Zod** (with react-hook-form, formik, etc.) | | Env var parsing | **Zod** (with t3-env or manual) | | Compile-time types only | Plain TypeScript | | Smaller bundle (~1kb) | Valibot | | Maximum type inference | ArkType | ## Rule Categories by Priority | Priority | Category | Impact | Prefix | |----------|----------|--------|--------| | 1 | Parsing & Type Safety | CRITICAL | `parse-` | | 2 | Schema Design | CRITICAL | `schema-` | | 3 | Refinements & Transforms | HIGH | `refine-` | | 4 | Error Handling | HIGH | `error-` | | 5 | Performance & Composition | MEDIUM | `perf-` | | 6 | v4 Migration | MEDIUM | `migrate-` | | 7 | Advanced Patterns | MEDIUM | `pattern-` | | 8 | Architecture & Boundaries | CRITICAL/HIGH | `arch-` | | 9 | Observability | HIGH/MEDIUM | `observe-` | ## Quick Reference ### 1. Parsing & Type Safety (CRITICAL) - `parse-use-safeParse` — Use `safeParse()` for user input instead of `parse()` which throws - `parse-async-required` — Must use `parseAsync()`/`safeParseAsync()` when schema has async refinements - `parse-infer-types` — Use `z.infer<typeof Schema>` for output types; never manually duplicate types ### 2. Schema Design (CRITICAL) - `schema-object-unknowns` — `z.object()` strips unknown keys; use `strictObject` or `looseObject` -...
# Zod Skill Created by **[Anivar Aravind](https://anivar.net)** An AI agent skill for writing, validating, and debugging Zod v4 schemas with modern best practices. ## The Problem AI agents often generate outdated Zod v3 patterns — `z.string().email()` instead of `z.email()`, `z.nativeEnum()` instead of `z.enum()`, `required_error` instead of the `error` parameter — and miss critical parsing pitfalls like using `parse()` instead of `safeParse()`, forgetting `parseAsync` for async refinements, or assuming `z.object()` preserves unknown keys. These produce schemas that compile but silently misbehave at runtime. ## This Solution 27 rules with incorrect→correct code examples that teach agents Zod v4's actual API behavior, schema design patterns, error handling, architectural placement, observability, and TypeScript integration. Each rule targets a specific mistake and shows exactly how to fix it. ## Install ```bash npx skills add anivar/zod-skill -g ``` Or with full URL: ```bash npx skills add https://github.com/anivar/zod-skill ``` ## Baseline - zod ^4.0.0 - TypeScript ^5.5 ## What's Inside ### 27 Rules Across 9 Categories | Priority | Category | Rules | Impact | |----------|----------|-------|--------| | 1 | Parsing & Type Safety | 3 | CRITICAL | | 2 | Schema Design | 4 | CRITICAL | | 3 | Refinements & Transforms | 3 | HIGH | | 4 | Error Handling | 3 | HIGH | | 5 | Performance & Composition | 3 | MEDIUM | | 6 | v4 Migration | 3 | MEDIUM | | 7 | Advanced Patterns | 3 | MEDIUM | | 8 | Architecture & Boundaries | 3 | CRITICAL/HIGH | | 9 | Observability | 2 | HIGH/MEDIUM | Each rule file contains: - Why it matters - Incorrect code with explanation - Correct code with explanation - Decision tables and additional context ### 9 Deep-Dive References | Reference | Covers | |-----------|--------| | `schema-types.md` | All primitives, string formats, numbers, enums, dates, files, JSON | | `parsing-and-inference.md` | parse, safeParse, parseAsync, z.infer, z.inpu...
heyixuan2
Bambu Lab 3D printer control and automation. Activate when user mentions: printer status, 3D printing, slice, analyze model, generate 3D, AMS filament, print monitor, Bambu Lab, or any 3D printing task. Full pipeline: search → generate → analyze → colorize → preview → open BS → user slice → print → monitor. Supports all 9 Bambu Lab printers (A1 Mini, A1, P1S, P2S, X1C, X1E, H2C, H2S, H2D).
openstockdata
OpenClaw Skill for stock data analysis
capt-marbles
Generative Engine Optimization (GEO) for AI search visibility. Optimize content to appear in ChatGPT, Perplexity, Claude, and Google AI Overviews. Use when optimizing websites, pages, or content for LLM discoverability and citation.
cancorleone
cancorteaw app
camopel
Personal PWA dashboard server with plugin apps. Use when: (1) installing or setting up PrivateApp, (2) starting/stopping/restarting the service, (3) building frontends after changes, (4) adding new app plugins, (5) configuring push notifications. Requires Python 3.9+, Node.js 18+. Runs as systemd user service or launchd plist.
canbirlik
A visual, human-like web browser for OpenClaw agents.Supports reading,screenshots, and visible mode.