Zod Boundaries Skill
When to use
- Any time you accept external input (URL params, search params, form payloads, server-function inputs).
Workflow checklist
-
Define a schema close to the boundary (route module or a domain validator).
-
Parse early (parse /safeParse ) and return typed data.
-
Keep schemas reusable (export from a domain module when shared).
-
Prefer explicit error messages suitable for UX; avoid leaking internals.
-
In server code, validate before DB writes.
Notes
- Use Zod as the single source of truth for both runtime validation and TS inference.