zod-skill AGENTS.md

zod-skill AGENTS.md is an instructions file for Codex, OpenCode from anivar/zod-skill. It costs 4,602 tokens per session, scanned A, original, MIT.

A set of instructions for using Zod 4, a TypeScript library that checks whether data has the expected shape while a program is running. It covers validation, reusable schemas, error handling, and changes from earlier Zod versions.

In plain words
What is it for?
Use it when writing, reviewing, or debugging Zod schemas in TypeScript, especially at application boundaries where outside data enters the program.
Why use it?
It helps prevent invalid API input, form data, settings, or external-service responses from reaching the rest of an application. It also gives consistent guidance for asynchronous checks and schema changes.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/anivar/zod-skill/agents-md
Clone the repo
git clone --depth 1 https://github.com/anivar/zod-skill

Made for: Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for zod-skill AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/anivar/zod-skill/agents-md.svg)](https://agentmods.dev/instructions/anivar/zod-skill/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/anivar/zod-skill/agents-md"><img src="https://agentmods.dev/badge/instructions/anivar/zod-skill/agents-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 4,602 This file is loaded in full into every session.
When invoked 4,602 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.04602 $0.04602
Opus 5 $0.02301 $0.02301
Sonnet 5 $0.00920 $0.00920
Haiku 4.5 $0.00460 $0.00460

Measured 4d ago against content hash 13bc5e438148, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

zod-skill AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 654 lines

How it starts

The opening of the file, as written. The whole thing — 654 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Zod v4 — Complete Guide

This document is for AI agents and LLMs to follow when writing, reviewing, or debugging Zod schemas. It compiles all rules and references into a single executable guide.

Baseline: zod ^4.0.0 with TypeScript ^5.5


Abstract

Zod is a TypeScript-first schema validation library for runtime type checking at system boundaries — API input, form data, environment variables, external services. Use z.infer<typeof Schema> for type extraction, safeParse() for validation, and composition methods (.pick(), .omit(), .partial()) to derive schema variants. Zod v4 introduces breaking changes to string formats, enums, error handling, and recursive types. This guide also covers architectural placement (where to parse), schema organization, versioning strategy, and production observability.


Table of Contents

  1. Parsing & Type Safety — CRITICAL
  2. Schema Design — CRITICAL
  3. Refinements & Transforms — HIGH
  4. Error Handling — HIGH
  5. Performance & Composition — MEDIUM
  6. v4 Migration — MEDIUM
  7. Advanced Patterns — MEDIUM
  8. Architecture & Boundaries — CRITICAL/HIGH
  9. Observability — HIGH/MEDIUM

1. Parsing & Type Safety

Impact: CRITICAL

Rule: Use safeParse() for User Input

parse() throws on invalid input. Use safeParse() which returns a discriminated result.

// INCORRECT — try/catch is verbose and catches unrelated errors
try {
  const user = UserSchema.parse(data)
} catch (e) {
  if (e instanceof z.ZodError) { ... }
}

// CORRECT — discriminated union result
const result = UserSchema.safeParse(data)
if (!result.success) {
  console.log(result.error.issues)
} else {
  console.log(result.data)
}

Use parse() only for internal data that should never be invalid (config, constants).

Read the full file on GitHub · 654 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 654 lines · 4,602 tokens per session scan A 13bc5e438148

Subscribe to this mod's changes

zod-skill AGENTS.md is an instructions file published in the GitHub repository anivar/zod-skill (21 stars, last pushed 27d ago), licensed MIT. It adds 4,602 tokens to every session, about $0.0230 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other instructions, from other repositories