npx skills add https://github.com/pproenca/dot-skills --skill zod适用于 TypeScript 应用程序的 Zod 综合模式验证指南。包含 8 个类别下的 43 条规则,按影响优先级排序,以指导自动化重构和代码生成。
在以下情况下参考这些指南:
parse() 和 safeParse() 之间做出选择z.infer 实现类型推断| 优先级 | 类别 | 影响 | 前缀 |
|---|---|---|---|
| 1 | 模式定义 | 关键 | schema- |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 2 | 解析与验证 | 关键 | parse- |
| 3 | 类型推断 | 高 | type- |
| 4 | 错误处理 | 高 | error- |
| 5 | 对象模式 | 中高 | object- |
| 6 | 模式组合 | 中 | compose- |
| 7 | 精炼与转换 | 中 | refine- |
| 8 | 性能与包大小 | 低中 | perf- |
schema-use-primitives-correctly - 为每种类型使用正确的原始模式schema-use-unknown-not-any - 为了类型安全,使用 z.unknown() 而不是 z.any()schema-avoid-optional-abuse - 避免过度使用可选字段schema-string-validations - 在模式定义时应用字符串验证schema-use-enums - 对固定的字符串值使用枚举schema-coercion-for-form-data - 对表单和查询数据使用强制转换parse-use-safeparse - 对用户输入使用 safeParse()parse-async-for-async-refinements - 对异步精炼使用 parseAsyncparse-handle-all-issues - 处理所有验证问题,而不仅仅是第一个parse-validate-early - 在系统边界进行验证parse-avoid-double-validation - 避免对相同数据进行两次验证parse-never-trust-json - 永远不要信任 JSON.parse 的输出type-use-z-infer - 使用 z.infer 而不是手动定义类型type-input-vs-output - 区分 z.input 和 z.infer 以用于转换type-export-schemas-and-types - 同时导出模式和推断出的类型type-branded-types - 使用品牌类型确保领域安全type-enable-strict-mode - 启用 TypeScript 严格模式error-custom-messages - 提供自定义错误消息error-use-flatten - 使用 flatten() 来显示表单错误error-path-for-nested - 使用 issue.path 来定位嵌套错误error-i18n - 实现国际化的错误消息error-avoid-throwing-in-refine - 在 refine 中返回 false 而不是抛出异常object-strict-vs-strip - 为未知键选择 strict() 或 strip()object-partial-for-updates - 对更新模式使用 partial()object-pick-omit - 使用 pick() 和 omit() 创建模式变体object-extend-for-composition - 使用 extend() 来添加字段object-optional-vs-nullable - 区分 optional() 和 nullable()object-discriminated-unions - 使用可辨识联合进行类型收窄compose-shared-schemas - 将共享模式提取到可重用模块中compose-intersection - 使用 intersection() 进行类型组合compose-lazy-recursive - 对递归模式使用 z.lazy()compose-preprocess - 使用 preprocess() 进行数据规范化compose-pipe - 使用 pipe() 进行多阶段验证refine-vs-superrefine - 正确选择 refine() 和 superRefine()refine-transform-coerce - 区分 transform()、refine() 和 coerce()refine-add-path - 为精炼错误添加路径refine-defaults - 对带有默认值的可选字段使用 default()refine-catch - 使用 catch() 进行容错解析perf-cache-schemas - 缓存模式实例perf-zod-mini - 对包大小敏感的应用使用 Zod Miniperf-avoid-dynamic-creation - 避免在热点路径中动态创建模式perf-lazy-loading - 懒加载大型模式perf-arrays - 优化大型数组验证阅读单独的参考文件以获取详细解释和代码示例:
如需包含所有规则详解的完整指南,请查看:AGENTS.md
react-hook-form 技能orval 技能每周安装量
908
仓库
GitHub 星标数
85
首次出现
2026年1月20日
安全审计
安装于
opencode776
codex765
gemini-cli762
github-copilot749
cursor661
amp640
Comprehensive schema validation guide for Zod in TypeScript applications. Contains 43 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.
Reference these guidelines when:
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Schema Definition | CRITICAL | schema- |
| 2 | Parsing & Validation | CRITICAL | parse- |
| 3 | Type Inference | HIGH | type- |
| 4 | Error Handling | HIGH | error- |
| 5 | Object Schemas | MEDIUM-HIGH | object- |
| 6 | Schema Composition | MEDIUM | compose- |
| 7 | Refinements & Transforms | MEDIUM | refine- |
| 8 | Performance & Bundle | LOW-MEDIUM | perf- |
schema-use-primitives-correctly - Use correct primitive schemas for each typeschema-use-unknown-not-any - Use z.unknown() instead of z.any() for type safetyschema-avoid-optional-abuse - Avoid overusing optional fieldsschema-string-validations - Apply string validations at schema definitionschema-use-enums - Use enums for fixed string valuesschema-coercion-for-form-data - Use coercion for form and query dataparse-use-safeparse - Use safeParse() for user inputparse-async-for-async-refinements - Use parseAsync for async refinementsparse-handle-all-issues - Handle all validation issues not just firstparse-validate-early - Validate at system boundariesparse-avoid-double-validation - Avoid validating same data twiceparse-never-trust-json - Never trust JSON.parse outputtype-use-z-infer - Use z.infer instead of manual typestype-input-vs-output - Distinguish z.input from z.infer for transformstype-export-schemas-and-types - Export both schemas and inferred typestype-branded-types - Use branded types for domain safetytype-enable-strict-mode - Enable TypeScript strict modeerror-custom-messages - Provide custom error messageserror-use-flatten - Use flatten() for form error displayerror-path-for-nested - Use issue.path for nested error locationerror-i18n - Implement internationalized error messageserror-avoid-throwing-in-refine - Return false instead of throwing in refineobject-strict-vs-strip - Choose strict() vs strip() for unknown keysobject-partial-for-updates - Use partial() for update schemasobject-pick-omit - Use pick() and omit() for schema variantsobject-extend-for-composition - Use extend() for adding fieldsobject-optional-vs-nullable - Distinguish optional() from nullable()object-discriminated-unions - Use discriminated unions for type narrowingcompose-shared-schemas - Extract shared schemas into reusable modulescompose-intersection - Use intersection() for type combinationscompose-lazy-recursive - Use z.lazy() for recursive schemascompose-preprocess - Use preprocess() for data normalizationcompose-pipe - Use pipe() for multi-stage validationrefine-vs-superrefine - Choose refine() vs superRefine() correctlyrefine-transform-coerce - Distinguish transform() from refine() and coerce()refine-add-path - Add path to refinement errorsrefine-defaults - Use default() for optional fields with defaultsrefine-catch - Use catch() for fault-tolerant parsingperf-cache-schemas - Cache schema instancesperf-zod-mini - Use Zod Mini for bundle-sensitive applicationsperf-avoid-dynamic-creation - Avoid dynamic schema creation in hot pathsperf-lazy-loading - Lazy load large schemasperf-arrays - Optimize large array validationRead individual reference files for detailed explanations and code examples:
references/{prefix}-{slug}.mdFor the complete guide with all rules expanded: AGENTS.md
react-hook-form skillorval skillWeekly Installs
908
Repository
GitHub Stars
85
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode776
codex765
gemini-cli762
github-copilot749
cursor661
amp640
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
102,200 周安装
Gemini Interactions API 指南:统一接口、智能体交互与服务器端状态管理
833 周安装
Apollo MCP 服务器:让AI代理通过GraphQL API交互的完整指南
834 周安装
智能体记忆系统构建指南:分块策略、向量存储与检索优化
835 周安装
Scrapling官方网络爬虫框架 - 自适应解析、绕过Cloudflare、Python爬虫库
836 周安装
抽奖赢家选取器 - 随机选择工具,支持CSV、Excel、Google Sheets,公平透明
838 周安装
Medusa 前端开发指南:使用 SDK、React Query 构建电商商店
839 周安装