[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M758VJFHJ68RZRDKN3V660VB":3,"skill-same:01M758VJFHJ68RZRDKN3V660VB":46},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":28,"ownerHtmlUrl":29,"ownerBlogUrl":28,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M758VJFHJ68RZRDKN3V660VB","zod-schema-validation",null,"Use Zod schemas for runtime validation of form data — API response validation is handled by @repo\u002Fapi-client which provides auto-generated Zod schemas","CliqRelay\u002Fcliqrelay","CliqRelay","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F290753656?v=4","01M758RPDEB11FEYA2XK17DSHA","01M758RPEKP0NKH6P43GD2FBDG",41,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FCliqRelay\u002Fcliqrelay\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Ffrontend\u002Fzod-schema-validation\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: zod-schema-validation\ndescription: Use Zod schemas for runtime validation of form data — API response validation is handled by @repo\u002Fapi-client which provides auto-generated Zod schemas\n---\n\n# Zod Schema Validation\n\nThis project uses Zod for runtime validation at two levels:\n\n1. **Form\u002FInput validation** — user-facing forms with cross-field validation (manual Zod schemas)\n2. **API response validation** — handled automatically by `@repo\u002Fapi-client` (auto-generated Zod schemas)\n\nThe `getValidationResult` utility and shared entity schemas (`guideSchema`, `stepSchema`, etc.) live in `packages\u002Fdata-commons` and are imported as `@repo\u002Fdata-commons`.\n\n---\n\n## Key Change: API Response Validation\n\nWith `@repo\u002Fapi-client`, **API response validation is handled automatically** by the auto-generated SDK. The SDK includes Zod schemas that validate every response from the backend. No manual validation needed.\n\n```typescript\n\u002F\u002F ✅ DO — Use api-client directly; response validation is automatic\nimport { api } from \"@repo\u002Fapi-client\";\n\nconst response = await api.guides.getAllGuides();\n\u002F\u002F response.data is already validated and typed\n```\n\nFor domains **not covered by `@repo\u002Fapi-client`**, use the manual validation patterns described below.\n\n---\n\n## Folder Structure\n\n```\npackages\u002Fdata-commons\u002Fsrc\u002Fmodels\u002F\n├── index.ts                     ← Re-exports all shared schemas\n├── guides.ts                    ← Canonical schema + inferred type\n├── steps.ts                     ← Canonical schema + inferred type\n└── ...\n\napps\u002Fweb\u002Fsrc\u002Fmodels\u002F\n├── guides.ts                    ← Web-specific schemas + types (non-api-client domains)\n├── steps.ts\n└── index.ts\n\napps\u002Fextension\u002Fsrc\u002Fmodels\u002F\n├── guides.ts                    ← Extension HTTP response schemas (non-api-client domains)\n├── steps.ts\n└── index.ts\n```\n\nShared Zod schemas belong in `packages\u002Fdata-commons\u002Fsrc\u002Fmodels\u002F`, using the `getValidationResult` utility from `packages\u002Fdata-commons\u002Fsrc\u002Fhelpers\u002F`.\n\n---\n\n## Pattern 1: Shared Canonical Schemas\n\nEntity schemas are defined in `packages\u002Fdata-commons` and represent the single source of truth:\n\n```typescript\n\u002F\u002F packages\u002Fdata-commons\u002Fsrc\u002Fmodels\u002Fguides.ts\nimport { z } from \"zod\";\n\nexport const guideSchema = z.object({\n  id: z.uuid(),\n  title: z.string().min(1).max(255),\n  status: z.enum([\"draft\", \"published\", \"archived\"]),\n  \u002F\u002F ...\n});\nexport type Guide = z.infer\u003Ctypeof guideSchema>;\n```\n\n---\n\n## Pattern 2: Form Schemas (Per-App)\n\nForm schemas live in the respective app's `models\u002F{domain}.ts`:\n\n```typescript\n\u002F\u002F apps\u002Fweb\u002Fsrc\u002Fmodels\u002Fsteps.ts\nimport { z } from \"zod\";\nimport { stepActionSchema } from \"@repo\u002Fdata-commons\";\n\nconst createStepInputSchema = z.object({\n  guideId: z.string().uuid(\"guideId must be a valid UUID\"),\n  action: stepActionSchema,\n  url: z.string().min(1, \"url is required\"),\n});\nexport type CreateStepInput = z.infer\u003Ctypeof createStepInputSchema>;\n```\n\n---\n\n## Pattern 3: HTTP Response Schemas (Extension Fallback — Non-api-client Domains)\n\nFor endpoints **not covered by `@repo\u002Fapi-client`**, define response body schemas:\n\n```typescript\n\u002F\u002F apps\u002Fextension\u002Fsrc\u002Fmodels\u002Fguides.ts\nimport { z } from \"zod\";\nimport { getValidationResult, guideSchema } from \"@repo\u002Fdata-commons\";\n\nexport const httpCreateGuideResponseBodySchema = z.object({\n  data: guideSchema,\n});\nexport type HttpCreateGuideResponseBody = z.infer\u003Ctypeof httpCreateGuideResponseBodySchema>;\n\nexport const validateHttpCreateGuide = (data: unknown) =>\n  getValidationResult(data, httpCreateGuideResponseBodySchema);\n```\n\nThese validators are used in the HTTP implementation layer (not factories):\n\n```typescript\n\u002F\u002F services\u002Fguides\u002Fhttp-guides.service.ts\nimport { validateHttpCreateGuide, type HttpCreateGuide } from \"@\u002Fmodels\";\n\nexport const httpCreateGuide: HttpCreateGuide = async (url, body) => {\n  const response = await fetch(url, { ... });\n  const data = await response.json();\n  const validationResult = validateHttpCreateGuide(data);\n  if (!validationResult.success) {\n    throw new Error(validationResult.error);\n  }\n  return validationResult.value;\n};\n```\n\n---\n\n## Pattern 4: Cross-Field Validation with superRefine\n\nUse `superRefine` for validations involving multiple fields:\n\n```typescript\n\u002F\u002F packages\u002Fdata-commons\u002Fsrc\u002Fmodels\u002Fsteps.ts\nexport const stepSchema = z.object({\n  id: z.uuid(),\n  action: stepActionSchema.nullable().optional(),\n  url: z.string().url().or(z.literal(\"\")).nullable().optional(),\n  \u002F\u002F ...\n}).superRefine((arg, ctx) => {\n  if (hasScreenshot && !hasAction) {\n    ctx.addIssue({\n      code: z.ZodIssueCode.custom,\n      path: [\"action\"],\n      message: \"Capture steps require an action.\",\n    });\n  }\n});\n```\n\n---\n\n## Common Utilities\n\nThe shared `getValidationResult` utility wraps Zod's `safeParse`:\n\n```typescript\n\u002F\u002F packages\u002Fdata-commons\u002Fsrc\u002Fhelpers\u002Fgenerics.ts\nimport { z } from \"zod\";\n\ntype ValidationResult\u003CT> =\n  | { success: true; value: T }\n  | { success: false; error: string };\n\nexport function getValidationResult\u003CT>(\n  data: unknown,\n  schema: z.ZodSchema\u003CT>\n): ValidationResult\u003CT> {\n  const result = schema.safeParse(data);\n  if (result.success) {\n    return { success: true, value: result.data };\n  }\n  return { success: false, error: result.error.errors.map(e => e.message).join(\", \") };\n}\n```\n\n---\n\n## When to Use What\n\n| Scenario | Validation Source |\n|----------|------------------|\n| API response (api-client domain) | Auto-generated by `@repo\u002Fapi-client` |\n| API response (non-api-client domain) | Manual Zod schema in `models\u002F{domain}.ts` |\n| Form input | Manual Zod schema in component or `models\u002F{domain}.ts` |\n| Shared entity | `@repo\u002Fdata-commons` |\n\n## Rules\n\n### ✅ DO\n- Let `@repo\u002Fapi-client` handle API response validation for covered domains\n- Define shared entity schemas in `packages\u002Fdata-commons\u002Fsrc\u002Fmodels\u002F`\n- Define form\u002Finput schemas in the app's `models\u002F{domain}.ts`\n- Use `z.infer` to derive TypeScript types from schemas\n- Use `superRefine` for cross-field validation\n- Import `getValidationResult` from `@repo\u002Fdata-commons`\n\n### ❌ DON'T\n- Don't manually validate API responses that are already handled by `@repo\u002Fapi-client`\n- Don't put schemas in component files — they go in `models\u002F`\n- Don't manually type what `z.infer` can derive\n- Don't catch validation errors silently — let them propagate\n- Don't duplicate schemas across apps — share them via `@repo\u002Fdata-commons`\n","# Zod Schema Validation\n\nThis project uses Zod for runtime validation at two levels:\n\n1. **Form\u002FInput validation** — user-facing forms with cross-field validation (manual Zod schemas)\n2. **API response validation** — handled automatically by `@repo\u002Fapi-client` (auto-generated Zod schemas)\n\nThe `getValidationResult` utility and shared entity schemas (`guideSchema`, `stepSchema`, etc.) live in `packages\u002Fdata-commons` and are imported as `@repo\u002Fdata-commons`.\n\n---\n\n## Key Change: API Response Validation\n\nWith `@repo\u002Fapi-client`, **API response validation is handled automatically** by the auto-generated SDK. The SDK includes Zod schemas that validate every response from the backend. No manual validation needed.\n\n```typescript\n\u002F\u002F ✅ DO — Use api-client directly; response validation is automatic\nimport { api } from \"@repo\u002Fapi-client\";\n\nconst response = await api.guides.getAllGuides();\n\u002F\u002F response.data is already validated and typed\n```\n\nFor domains **not covered by `@repo\u002Fapi-client`**, use the manual validation patterns described below.\n\n---\n\n## Folder Structure\n\n```\npackages\u002Fdata-commons\u002Fsrc\u002Fmodels\u002F\n├── index.ts                     ← Re-exports all shared schemas\n├── guides.ts                    ← Canonical schema + inferred type\n├── steps.ts                     ← Canonical schema + inferred type\n└── ...\n\napps\u002Fweb\u002Fsrc\u002Fmodels\u002F\n├── guides.ts                    ← Web-specific schemas + types (non-api-client domains)\n├── steps.ts\n└── index.ts\n\napps\u002Fextension\u002Fsrc\u002Fmodels\u002F\n├── guides.ts                    ← Extension HTTP response schemas (non-api-client domains)\n├── steps.ts\n└── index.ts\n```\n\nShared Zod schemas belong in `packages\u002Fdata-commons\u002Fsrc\u002Fmodels\u002F`, using the `getValidationResult` utility from `packages\u002Fdata-commons\u002Fsrc\u002Fhelpers\u002F`.\n\n---\n\n## Pattern 1: Shared Canonical Schemas\n\nEntity schemas are defined in `packages\u002Fdata-commons` and represent the single source of truth:\n\n```typescript\n\u002F\u002F packages\u002Fdata-commons\u002Fsrc\u002Fmodels\u002Fguides.ts\nimport { z } from \"zod\";\n\nexport const guideSchema = z.object({\n  id: z.uuid(),\n  title: z.string().min(1).max(255),\n  status: z.enum([\"draft\", \"published\", \"archived\"]),\n  \u002F\u002F ...\n});\nexport type Guide = z.infer\u003Ctypeof guideSchema>;\n```\n\n---\n\n## Pattern 2: Form Schemas (Per-App)\n\nForm schemas live in the respective app's `models\u002F{domain}.ts`:\n\n```typescript\n\u002F\u002F apps\u002Fweb\u002Fsrc\u002Fmodels\u002Fsteps.ts\nimport { z } from \"zod\";\nimport { stepActionSchema } from \"@repo\u002Fdata-commons\";\n\nconst createStepInputSchema = z.object({\n  guideId: z.string().uuid(\"guideId must be a valid UUID\"),\n  action: stepActionSchema,\n  url: z.string().min(1, \"url is required\"),\n});\nexport type CreateStepInput = z.infer\u003Ctypeof createStepInputSchema>;\n```\n\n---\n\n## Pattern 3: HTTP Response Schemas (Extension Fallback — Non-api-client Domains)\n\nFor endpoints **not covered by `@repo\u002Fapi-client`**, define response body schemas:\n\n```typescript\n\u002F\u002F apps\u002Fextension\u002Fsrc\u002Fmodels\u002Fguides.ts\nimport { z } from \"zod\";\nimport { getValidationResult, guideSchema } from \"@repo\u002Fdata-commons\";\n\nexport const httpCreateGuideResponseBodySchema = z.object({\n  data: guideSchema,\n});\nexport type HttpCreateGuideResponseBody = z.infer\u003Ctypeof httpCreateGuideResponseBodySchema>;\n\nexport const validateHttpCreateGuide = (data: unknown) =>\n  getValidationResult(data, httpCreateGuideResponseBodySchema);\n```\n\nThese validators are used in the HTTP implementation layer (not factories):\n\n```typescript\n\u002F\u002F services\u002Fguides\u002Fhttp-guides.service.ts\nimport { validateHttpCreateGuide, type HttpCreateGuide } from \"@\u002Fmodels\";\n\nexport const httpCreateGuide: HttpCreateGuide = async (url, body) => {\n  const response = await fetch(url, { ... });\n  const data = await response.json();\n  const validationResult = validateHttpCreateGuide(data);\n  if (!validationResult.success) {\n    throw new Error(validationResult.error);\n  }\n  return validationResult.value;\n};\n```\n\n---\n\n## Pattern 4: Cross-Field Validation with superRefine\n\nUse `superRefine` for validations involving multiple fields:\n\n```typescript\n\u002F\u002F packages\u002Fdata-commons\u002Fsrc\u002Fmodels\u002Fsteps.ts\nexport const stepSchema = z.object({\n  id: z.uuid(),\n  action: stepActionSchema.nullable().optional(),\n  url: z.string().url().or(z.literal(\"\")).nullable().optional(),\n  \u002F\u002F ...\n}).superRefine((arg, ctx) => {\n  if (hasScreenshot && !hasAction) {\n    ctx.addIssue({\n      code: z.ZodIssueCode.custom,\n      path: [\"action\"],\n      message: \"Capture steps require an action.\",\n    });\n  }\n});\n```\n\n---\n\n## Common Utilities\n\nThe shared `getValidationResult` utility wraps Zod's `safeParse`:\n\n```typescript\n\u002F\u002F packages\u002Fdata-commons\u002Fsrc\u002Fhelpers\u002Fgenerics.ts\nimport { z } from \"zod\";\n\ntype ValidationResult\u003CT> =\n  | { success: true; value: T }\n  | { success: false; error: string };\n\nexport function getValidationResult\u003CT>(\n  data: unknown,\n  schema: z.ZodSchema\u003CT>\n): ValidationResult\u003CT> {\n  const result = schema.safeParse(data);\n  if (result.success) {\n    return { success: true, value: result.data };\n  }\n  return { success: false, error: result.error.errors.map(e => e.message).join(\", \") };\n}\n```\n\n---\n\n## When to Use What\n\n| Scenario | Validation Source |\n|----------|------------------|\n| API response (api-client domain) | Auto-generated by `@repo\u002Fapi-client` |\n| API response (non-api-client domain) | Manual Zod schema in `models\u002F{domain}.ts` |\n| Form input | Manual Zod schema in component or `models\u002F{domain}.ts` |\n| Shared entity | `@repo\u002Fdata-commons` |\n\n## Rules\n\n### ✅ DO\n- Let `@repo\u002Fapi-client` handle API response validation for covered domains\n- Define shared entity schemas in `packages\u002Fdata-commons\u002Fsrc\u002Fmodels\u002F`\n- Define form\u002Finput schemas in the app's `models\u002F{domain}.ts`\n- Use `z.infer` to derive TypeScript types from schemas\n- Use `superRefine` for cross-field validation\n- Import `getValidationResult` from `@repo\u002Fdata-commons`\n\n### ❌ DON'T\n- Don't manually validate API responses that are already handled by `@repo\u002Fapi-client`\n- Don't put schemas in component files — they go in `models\u002F`\n- Don't manually type what `z.infer` can derive\n- Don't catch validation errors silently — let them propagate\n- Don't duplicate schemas across apps — share them via `@repo\u002Fdata-commons`\n",{"name":5,"description":7},"main","f06510bcaf955afc66bbbc1606871e1a1576492e",".agents\u002Fskills\u002Ffrontend\u002Fzod-schema-validation",0,"https:\u002F\u002Fgithub.com\u002FCliqRelay\u002Fcliqrelay","https:\u002F\u002Fcliqrelay.com","https:\u002F\u002Fgithub.com\u002FCliqRelay","Capture and refine workflows instantly to help your teams and AI agents perform at their best.","2026-11-04 22:56:05",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add CliqRelay\u002Fcliqrelay --skill zod-schema-validation",{"tool":38,"command":39},"bunx","bunx skills add CliqRelay\u002Fcliqrelay --skill zod-schema-validation",{"tool":41,"command":42},"pnpm","pnpm dlx skills add CliqRelay\u002Fcliqrelay --skill zod-schema-validation","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FCliqRelay\u002Fcliqrelay\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Ffrontend\u002Fzod-schema-validation\u002FSKILL.md",true,[],[47,54,61,68,75,82],{"skillNo":48,"name":49,"nameZh":6,"description":50,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":51,"categories":52,"keywords":53,"publishedAt":18},"01M758WG0JG18W5MZD6ZPM6PGG","typst","Typst document creation and package development. Use when: (1) Working with .typ files, (2) User mentions typst, typst.toml, or typst-cli, (3) Creating or using Typst packages, (4) Developing document templates, (5) Converting Markdown\u002FLaTeX to Typst","https:\u002F\u002Fgithub.com\u002FCliqRelay\u002Fcliqrelay\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Ftypst\u002FSKILL.md",[],[],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":18},"01M758WACKQMHG2BFF7T758J12","shadcn","Manages shadcn components and projects — adding, searching, fixing, debugging, styling, and composing UI. Provides project context, component docs, and usage examples. Applies when working with shadcn\u002Fui, component registries, presets, --preset codes, or any project with a components.json file. Also triggers for \"shadcn init\", \"create an app with --preset\", or \"switch to --preset\".","https:\u002F\u002Fgithub.com\u002FCliqRelay\u002Fcliqrelay\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fshadcn\u002FSKILL.md",[],[],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":18},"01M758W82G2QQ5Q14FKYNHRXQW","handoff","Compact the current conversation into a handoff document for another agent to pick up.","https:\u002F\u002Fgithub.com\u002FCliqRelay\u002Fcliqrelay\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fproductivity\u002Fhandoff\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":18},"01M758W63H60EK55A93199B6NR","grilling","Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.","https:\u002F\u002Fgithub.com\u002FCliqRelay\u002Fcliqrelay\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fproductivity\u002Fgrilling\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":18},"01M758W4HD4PF66929V7MDGKW8","grill-me","A relentless interview to sharpen a plan or design.","https:\u002F\u002Fgithub.com\u002FCliqRelay\u002Fcliqrelay\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fproductivity\u002Fgrill-me\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":18},"01M758VYC5CCTP7EA5VKE7YWM5","dont-waffle","Use this skill when answering questions, explaining concepts, writing technical responses, reviewing code, or helping with development tasks. Communicate in clear, simple, standard English. Keep answers concise and focused, remove unnecessary filler and repetition, explain technical ideas in plain language, and structure information so it is easy to read and understand. When showing code, present it clearly with enough context for the developer to understand what it does and where it belongs.","https:\u002F\u002Fgithub.com\u002FCliqRelay\u002Fcliqrelay\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fproductivity\u002Fdont-waffle\u002FSKILL.md",[],[]]