zod schema validation 4.x
Parse at the boundary, read the failure, and let the schema be the type.
Other lines of this skill:
3.x (frozen, for zod@^3.0.0).
- For
zod@4.5.4- Verified
- 2026-09-07, 7 examples executed
- Package
@modootoday/pmcp-zod-schema-validation@4.0.0
What it covers
- When to reach for it
- Parse or branch, not both
- Unknown keys are dropped, not rejected
- Read the failure, do not stringify it
- Let the schema be the type
- Coerce only where the wire is untyped
- What this skill does not cover
One example from this skill
This is the skill's own text, not a summary of it. It runs: that is what verifying means here.
import { z } from "zod";
import assert from "node:assert/strict";
const Config = z.object({ port: z.number(), host: z.string() });
// safeParse when the caller answers for the failure.
const result = Config.safeParse({ port: "8080", host: "localhost" });
assert.equal(result.success, false);
// parse when there is no answer but to stop.
assert.deepEqual(Config.parse({ port: 8080, host: "localhost" }), {
port: 8080,
host: "localhost",
});
What it did in the sandbox
Verifying this skill meant installing the package and running code against it with no route out. Nothing was observed. The full ledger lists every package examined, including the ones that never became a skill.
Nothing observed is not a finding of safety. It means one run, under one policy, produced nothing to report.
Getting it
With a subscription:
npx -y @modootoday/pmcp login
npx -y @modootoday/pmcp install @modootoday/pmcp-zod-schema-validation
It installs as a dev dependency of your project, and the MCP server finds it there like any other skill.