[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6FEMT08RMNK17EGFSZQ4K57":3,"skill-same:01M6FEMT08RMNK17EGFSZQ4K57":45},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":20,"frontMatter":21,"refName":22,"commitSha":23,"skillDirectory":24,"forksCount":25,"repositoryHtmlUrl":26,"repositoryHomepageUrl":27,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":29,"updatedAt":30,"install":31,"resources":44},"01M6FEMT08RMNK17EGFSZQ4K57","zod",null,"ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fpproenca\u002Fdot-skills\u002Fzod\u002FSKILL.md",[],[5],"2026-11-10 10:12:30",false,"# Zod Best Practices\n\nComprehensive schema validation guide for Zod in TypeScript applications. Contains 43 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.\n\n## When to Apply\n\nReference these guidelines when:\n- Writing new Zod schemas\n- Choosing between parse() and safeParse()\n- Implementing type inference with z.infer\n- Handling validation errors for user feedback\n- Composing complex object schemas\n- Using refinements and transforms\n- Optimizing bundle size and validation performance\n- Reviewing Zod code for best practices\n\n## Rule Categories by Priority\n\n| Priority | Category | Impact | Prefix |\n|----------|----------|--------|--------|\n| 1 | Schema Definition | CRITICAL | `schema-` |\n| 2 | Parsing & Validation | CRITICAL | `parse-` |\n| 3 | Type Inference | HIGH | `type-` |\n| 4 | Error Handling | HIGH | `error-` |\n| 5 | Object Schemas | MEDIUM-HIGH | `object-` |\n| 6 | Schema Composition | MEDIUM | `compose-` |\n| 7 | Refinements & Transforms | MEDIUM | `refine-` |\n| 8 | Performance & Bundle | LOW-MEDIUM | `perf-` |\n\n## Quick Reference\n\n### 1. Schema Definition (CRITICAL)\n\n- `schema-use-primitives-correctly` - Use correct primitive schemas for each type\n- `schema-use-unknown-not-any` - Use z.unknown() instead of z.any() for type safety\n- `schema-avoid-optional-abuse` - Avoid overusing optional fields\n- `schema-string-validations` - Apply string validations at schema definition\n- `schema-use-enums` - Use enums for fixed string values\n- `schema-coercion-for-form-data` - Use coercion for form and query data\n\n### 2. Parsing & Validation (CRITICAL)\n\n- `parse-use-safeparse` - Use safeParse() for user input\n- `parse-async-for-async-refinements` - Use parseAsync for async refinements\n- `parse-handle-all-issues` - Handle all validation issues not just first\n- `parse-validate-early` - Validate at system boundaries\n- `parse-avoid-double-validation` - Avoid validating same data twice\n- `parse-never-trust-json` - Never trust JSON.parse output\n\n### 3. Type Inference (HIGH)\n\n- `type-use-z-infer` - Use z.infer instead of manual types\n- `type-input-vs-output` - Distinguish z.input from z.infer for transforms\n- `type-export-schemas-and-types` - Export both schemas and inferred types\n- `type-branded-types` - Use branded types for domain safety\n- `type-enable-strict-mode` - Enable TypeScript strict mode\n\n### 4. Error Handling (HIGH)\n\n- `error-custom-messages` - Provide custom error messages\n- `error-use-flatten` - Use flatten() for form error display\n- `error-path-for-nested` - Use issue.path for nested error location\n- `error-i18n` - Implement internationalized error messages\n- `error-avoid-throwing-in-refine` - Return false instead of throwing in refine\n\n### 5. Object Schemas (MEDIUM-HIGH)\n\n- `object-strict-vs-strip` - Choose strict() vs strip() for unknown keys\n- `object-partial-for-updates` - Use partial() for update schemas\n- `object-pick-omit` - Use pick() and omit() for schema variants\n- `object-extend-for-composition` - Use extend() for adding fields\n- `object-optional-vs-nullable` - Distinguish optional() from nullable()\n- `object-discriminated-unions` - Use discriminated unions for type narrowing\n\n### 6. Schema Composition (MEDIUM)\n\n- `compose-shared-schemas` - Extract shared schemas into reusable modules\n- `compose-intersection` - Use intersection() for type combinations\n- `compose-lazy-recursive` - Use z.lazy() for recursive schemas\n- `compose-preprocess` - Use preprocess() for data normalization\n- `compose-pipe` - Use pipe() for multi-stage validation\n\n### 7. Refinements & Transforms (MEDIUM)\n\n- `refine-vs-superrefine` - Choose refine() vs superRefine() correctly\n- `refine-transform-coerce` - Distinguish transform() from refine() and coerce()\n- `refine-add-path` - Add path to refinement errors\n- `refine-defaults` - Use default() for optional fields with defaults\n- `refine-catch` - Use catch() for fault-tolerant parsing\n\n### 8. Performance & Bundle (LOW-MEDIUM)\n\n- `perf-cache-schemas` - Cache schema instances\n- `perf-zod-mini` - Use Zod Mini for bundle-sensitive applications\n- `perf-avoid-dynamic-creation` - Avoid dynamic schema creation in hot paths\n- `perf-lazy-loading` - Lazy load large schemas\n- `perf-arrays` - Optimize large array validation\n\n## How to Use\n\nRead individual reference files for detailed explanations and code examples:\n\n- [Section definitions](references\u002F_sections.md) - Category structure and impact levels\n- [Rule template](assets\u002Ftemplates\u002F_template.md) - Template for adding new rules\n- Individual rules: `references\u002F{prefix}-{slug}.md`\n\n## Full Compiled Document\n\nFor the complete guide with all rules expanded: `AGENTS.md`\n\n## Related Skills\n\n- For React Hook Form integration, see `react-hook-form` skill\n- For API client generation, see `orval` skill\n\n## Sources\n\n- [Zod Official Documentation](https:\u002F\u002Fzod.dev\u002F)\n- [Zod v4 Release Notes](https:\u002F\u002Fzod.dev\u002Fv4)\n- [Zod GitHub Repository](https:\u002F\u002Fgithub.com\u002Fcolinhacks\u002Fzod)\n- [Zod Mini](https:\u002F\u002Fzod.dev\u002Fpackages\u002Fmini)\n- [Total TypeScript Zod Tutorial](https:\u002F\u002Fwww.totaltypescript.com\u002Ftutorials\u002Fzod)\n",{},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Fpproenca\u002Fdot-skills\u002Fzod",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":7,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill zod",{"tool":37,"command":38},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill zod",{"tool":40,"command":41},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill zod","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fpproenca\u002Fdot-skills\u002Fzod\u002FSKILL.md",true,[],[46,55,64,73,79,85],{"skillNo":47,"name":48,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":51,"publishedAt":18},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[],[52,53,54],"model","model hierarchy","model hierarchy skill",{"skillNo":56,"name":57,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":18},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[],[61,62,63],"MCP","zoom","zoom mcp",{"skillNo":65,"name":66,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":18},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[70,71,72,62],"sdk","zoom apps sdk","apps",{"skillNo":74,"name":75,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":18},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[75],{"skillNo":80,"name":81,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":18},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[],[81],{"skillNo":86,"name":87,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":18},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[87]]