Airsc miễn phí cho tất cả. Nếu nó giúp bạn, hãy ủng hộ $2–$20.

Ủng hộ
SkillAn toànReview & chất lượng codeCần cài đặt chút

zod-skill

anivar · anivar/zod-skill

Kỹ năng này hướng dẫn các AI coding agent viết và debug schema Zod v4 một cách chính xác, ngăn ngừa lỗi phổ biến và tuân thủ các thực hành tốt nhất về thiết kế schema và an toàn kiểu dữ liệu.

Skill cho tác nhân AI dành cho Zod v4 — 27 quy tắc: thiết kế schema, phân tích cú pháp, xử lý lỗi, suy luận kiểu. Hoạt động với Claude Code, Cursor, Codex, Windsurf.

23 sao1Giấy phép: MITCập nhật 2 tháng trước0 lượt mở

Xem trước

▍

Bạn có thể làm gì với nó

  • Tạo schema Zod cho body và response của API với cú pháp v4 chính xác.
  • Debug các schema Zod hiện có đang lỗi ngầm khi chạy do các mẫu lỗi thời.
  • Cải thiện an toàn kiểu dữ liệu trong ứng dụng bằng cách đảm bảo tất cả quá trình xác thực dữ liệu tuân thủ các thực hành tốt nhất của Zod v4.

Kiểm tra an toàn

An toàn

Không thấy dấu hiệu rủi ro trong các file đã quét.

Quét tự động các file trong repo. Luôn xem lại code trước khi chạy.

Trích từ README

Zod Skill

Created by Anivar Aravind

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 the unified 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

npx skills add anivar/zod-skill -g

Testing schemas is covered too, merged from the former zod-testing skill — see references/testing.md.

Or with full URL:

npx skills add https://github.com/anivar/zod-skill

Baseline

  • zod ^4.3.0 (tracks 4.4.x; audited against zod.dev, August 2026)
  • TypeScript ^5.5

The skill is checked against Zod's own documentation rather than its release notes, which matters more than it sounds: several APIs announced in 4.3 releases — slugify, .with(), .apply(), .overwrite(), .register() — have no presence in the documentation, and a skill that taught them would be teaching an interface the project has not committed to.

What's Inside

27 Rules Across 9 Categories

PriorityCategoryRulesImpact
1Parsing & Type Safety3CRITICAL
2Schema Design4CRITICAL
3Refinements & Transforms3HIGH
4Error Handling3HIGH
5Performance & Composition3MEDIUM
6v4 Migration3MEDIUM
7Advanced Patterns3MEDIUM
8Architecture & Boundaries3CRITICAL/HIGH
9Observability2HIGH/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

ReferenceCovers
schema-types.mdAll primitives, string formats, numbers, enums, dates, files, JSON
parsing-and-inference.mdparse, safeParse, parseAsync, z.infer, z.input, coercion
objects-and-composition.mdobject/strict/loose, pick, omit, partial, recursive, unions, tuples
refinements-and-transforms.mdrefine, superRefine, transform, pipe, defaults, catch
error-handling.mdZodError, flattenError, treeifyError, error customization, i18n
advanced-features.mdCodecs, branded types, JSON Schema, registries, Standard Schema
anti-patterns.md14 common mistakes with BAD/GOOD examples
boundary-architecture.mdWhere Zod fits: Express, tRPC, Next.js, React Hook Form, env, external APIs
linter-and-ci.mdESLint rules, CI schema snapshots, unused schema detection, circular deps

Structure

├── SKILL.md                          # Entry point for AI agents
├── AGENTS.md                         # Compiled guide with all rules expanded
├── rules/                            # Individual rules (Incorrect→Correct)
│   ├── parse-*                       # Parsing & type safety (CRITICAL)
│   ├── schema-*                      # Schema design (CRITICAL)
│   ├── refine-*                      # Refinements & transforms (HIGH)
│   ├── error-*                       # Error handling (HIGH)
│   ├── perf-*                        # Performance & composition (MEDIUM)
│   ├── migrate-*                     # v4 migration (MEDIUM)
│   ├── pattern-*                     # Advanced patterns (MEDIUM)
│   ├── arch-*                        # Architecture & boundaries (CRITICAL/HIGH)
│   └── observe-*                     # Observability (HIGH/MEDIUM)
└── references/                       # Deep-dive reference docs
    ├── schema-types.md
    ├── parsing-and-inference.md
    ├── objects-and-composition.md
    ├── refinements-and-transforms.md
    ├── error-handling.md
    ├── advanced-features.md
    ├── anti-patterns.md
    ├── boundary-architecture.md
    └── linter-and-ci.md

Ecosystem — Skills by Anivar Aravind

Testing Skills

SkillWhat it coversInstall
jest-skillJest best practices — mock design, async testing, matchers, timers, snapshotsnpx skills add anivar/jest-skill -g
zod-testingZod schema testing — safeParse, mock data, property-basednpx skills add anivar/zod-testing -g
msw-skillMSW 2.0 API mocking — handlers, responses, GraphQLnpx skills add anivar/msw-skill -g
redux-saga-testingRedux-Saga testing — expectSaga, testSaga, providersnpx skills add anivar/redux-saga-testing -g

Library & Framework Skills

SkillWhat it coversInstall
redux-saga-skillRedux-Saga effects, fork model, channels, RTKnpx skills add anivar/redux-saga-skill -g
msw-skillMSW 2.0 handlers, responses, migrationnpx skills add anivar/msw-skill -g

Engineering Analysis

SkillWhat it coversInstall
contributor-codebase-analyzerCode analysis, annual reviews, promotion readinessnpx skills add anivar/contributor-codebase-analyzer -g

Author

Anivar Aravind — Building AI agent skills for mo

Xem mã nguồn trên GitHub