agentleFS
kriscardkriscard/Skills/skills/dev/zod/SKILL.md

zod

Skill15 starsChanged 15 days agoMITView on GitHub

Implement, review, or debug Zod 4 schemas and their runtime contracts. Use only when the requested outcome concerns Zod parsing, transforms, structured errors, schema composition, codecs, JSON Schema artifacts, Mini, or Zod interoperability. Check the installed entrypoint before using capability-sensitive APIs.

23 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use tailwind-css-patterns, typescript-advanced-types and 3 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • midudevSkill

    tailwind-css-patterns

    Provides comprehensive Tailwind CSS utility-first styling patterns including responsive design, layout utilities, flexbox, grid, spacing, typography, colors, and modern CSS best practices. Use when styling React/Vue/Svelte components, building responsive layouts, implementing design systems, or optimizing CSS workflow.

    Also in 3 projects that use this

  • xfstudioSkill

    typescript-advanced-types

    Master TypeScript's advanced type system including generics, conditional types, mapped types, template literals, and utility types for building type-safe applications. Use when implementing complex type logic, creating reusable type utilities, or ensuring compile-time type safety in TypeScript projects.

    Also in 5 projects that use this

  • VercelSkill

    turborepo

    Turborepo monorepo build system guidance. Triggers on: turbo.json, task pipelines, dependsOn, caching, remote cache, the "turbo" CLI, --filter, --affected, CI optimization, environment variables, internal packages, monorepo structure/best practices, and boundaries.

    Also in 4 projects that use this

  • VercelSkill

    ai-sdk

    Answer questions about the AI SDK and help build AI-powered features. Use when developers: (1) Ask about AI SDK functions like generateText, streamText, ToolLoopAgent, embed, or tools, (2) Want to build AI agents, chatbots, RAG systems, or text generation features, (3) Have questions about AI providers (OpenAI, Anthropic, Google, etc.), streaming, tool calling, structured output, or embeddings, (4) Use React hooks like useChat or useCompletion. Triggers on: "AI SDK", "Vercel AI SDK", "generateText", "streamText", "add AI to my app", "build an agent", "tool calling", "structured output", "useChat".

    Also in 3 projects that use this

  • BlockSkill

    frontend-design

    Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

    Also in 4 projects that use this

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 23 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use unknown at external boundaries.

    line 39
  2. Very specific:

    Prefer a schema and a caller that make the success value and failure path observable.

    line 59
  3. Distinctive:

    Run exact-entrypoint cases for valid and invalid input, then the affected typecheck and tests.

    line 73

“Common” is measured: kept by at least 6 in 10 of the 23 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Zod 4

Make untrusted values earn a trusted type once. Start this workflow only when the requested outcome changes, diagnoses, or verifies a Zod contract. Keep unrelated form lifecycle, authorization, UI, and transport failures with their owners even when Zod is nearby.

Workflow

1. Establish the effective contract

Inspect the resolved zod version, actual import path, TypeScript configuration, and affected adapter declarations. This skill targets Zod 4. Use the package root or zod/v4 for Classic and a Mini entrypoint only when the code intentionally uses Mini's functional API. Capability-check APIs introduced during Zod 4 instead of treating the major as a promise that every minor exposes them.

Complete when: the exact Zod 4 version, entrypoint, TypeScript version, and adapter versions are known, and every proposed API exists in those installed declarations.

2. Write the boundary contract

Before code, record:

  • the untrusted producer and raw representation;
  • the parsed output and whether it is still a wire model or a domain value;
  • strip, reject, preserve, or catchall behavior for unknown object keys;
  • synchronous or asynchronous parsing;
  • whether invalid input throws, branches locally, or becomes an adapter error;
  • whether reverse encoding or a published JSON Schema artifact is required.

Use unknown at external boundaries. Parse once, then pass the parsed output inward until another trust boundary is crossed. Keep independent domain rules outside schemas unless they are part of the boundary's validity.

Complete when: input, output, object policy, failure consumer, and artifact direction are explicit.

3. Load the matching reference

PriorityLoad whenReference
1 — CriticalImports, package capabilities, adapters, Standard Schema, or optional/newer Zod 4 APIsreferences/imports-and-capabilities.md
1 — CriticalBoundary parsing, Query fetchers, input/output types, form conversion, coercion, transforms, defaults, codecs, or async schemasreferences/types-and-parsing.md
1 — HighObject policy, composition, PATCH schemas, refinements, or cross-field rulesreferences/objects-and-refinements.md
1 — HighCustom messages, issues, error formatting, localization, logging, or API/form projectionsreferences/errors.md
1 — HighTagged unions, ordinary unions, enums, exhaustive records, or sparse enum mapsreferences/unions-records-and-enums.md
2 — ConditionalMetadata, registries, JSON Schema, structured outputs, documentation, or code generationreferences/metadata-and-json-schema.md
2 — ConditionalClassic versus Mini, bundle size, compiler/validate APIs, CSP, or parse performancereferences/mini-and-performance.md

4. Implement the smallest complete pattern

Prefer a schema and a caller that make the success value and failure path observable. Preserve z.input and z.output when conversion changes representation. Give adapters the schema contract they support; do not assume validation also supplies transformed output, async parsing, or the error shape the consumer expects.

For React Hook Form, show the Zod input/output handoff but leave defaults, dirty state, and submission lifecycle to that owner. For TanStack Query, make HTTP and parse failures reject the query function, but leave retry, cache, and rendering policy to Query/frontend owners.

Complete when: the requested integration receives parsed output or structured failure without a second parse or an unchecked assertion.

5. Verify observable behavior

Run exact-entrypoint cases for valid and invalid input, then the affected typecheck and tests. Cover missing/null values, extra keys, ambiguous raw strings, transformed output, and issue paths as applicable. Use async parsing end to end when any nested effect is async. When an implementation answer requests checks, include runnable success/failure assertions and label unexecuted checks.

For artifacts, assert direction, dialect, required keys, object policy, metadata, and refs. For Mini or performance changes, compare production bundles or representative throughput while preserving the same outputs and failures.

Complete when: runtime results, inferred input/output types, failure projection, and generated artifacts have executable evidence.

Completion gate

  • installed Zod 4 imports and declarations support every API used;
  • untrusted input is parsed once before entering trusted domain or query-cache data;
  • coercion and fallback behavior is tested with ambiguous inputs;
  • object composition preserves explicit key policy and refinements;
  • errors retain code and path until the consumer projection and exclude sensitive input;
  • codecs are reserved for real round trips and report recoverable conversion failures as issues;
  • JSON Schema states whether it describes accepted input or parsed output;
  • Classic, Mini, compile, or validate choices follow measured needs rather than novelty.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.