AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Zod Schema

skill-anbturki-claude-toolkit-zod-schema · by anbturki

Scaffold Zod validation schemas with inferred TypeScript types. Use when adding input validation for API endpoints or forms.

No reviews yet
0 installs
19 views
0.0% view→install

Install

$ agentstack add skill-anbturki-claude-toolkit-zod-schema

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-anbturki-claude-toolkit-zod-schema)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
4mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Zod Schema? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Create Zod Schema

Scaffold validation schemas for $ARGUMENTS.

Step 1: Learn Project Patterns

  1. Read CLAUDE.md for validation conventions
  2. Find existing schemas:

`` Glob("**/schemas/**/*.ts") Glob("**/validators/**/*.ts") ``

  1. Read 2-3 existing schemas — learn:
  • Import style (import { z } from "zod" vs import * as z)
  • How common schemas are reused (pagination, etc.)
  • Type export patterns
  • Where schemas live in the project

Step 2: Scaffold Schemas

File location: Match existing schema file locations.

import { z } from "zod";

// Reuse common schemas if they exist in the project
// import { paginationSchema } from "./common";

// List/filter schema (for GET query params)
export const list${Name}sSchema = z.object({
  search: z.string().optional(),
  limit: z.coerce.number().min(1).max(100).optional().default(50),
  offset: z.coerce.number().min(0).optional().default(0),
  // Add filter fields
});

// Create schema (for POST body)
export const create${Name}Schema = z.object({
  name: z.string().min(1, "Name is required").max(255),
  // Add required fields with validation
});

// Update schema (for PUT body)
export const update${Name}Schema = z.object({
  name: z.string().min(1).max(255).optional(),
  // Optional fields for partial updates
});

// Export inferred types — NEVER define these manually
export type List${Name}sInput = z.infer;
export type Create${Name}Input = z.infer;
export type Update${Name}Input = z.infer;

Common Patterns

Query Parameters (coerce from strings)

z.coerce.number()           // "50" → 50
z.coerce.boolean()          // "true" → true
z.string().optional()       // already a string from URL

Enums

export const statusSchema = z.enum(["active", "inactive", "pending"]);
type Status = z.infer;  // "active" | "inactive" | "pending"

Arrays

z.array(z.string()).min(1).max(10)          // 1-10 strings
z.array(z.string().uuid()).optional()       // optional UUID array

Refinements

z.string().regex(/^#[0-9A-Fa-f]{6}$/, "Invalid hex color")
z.string().email("Invalid email")
z.string().url("Invalid URL")
z.string().min(8, "Password must be at least 8 characters")

Nested Objects

export const create${Name}Schema = z.object({
  name: z.string().min(1),
  address: z.object({
    street: z.string(),
    city: z.string(),
    zip: z.string(),
  }).optional(),
  tags: z.array(z.string()).default([]),
});

Extending Schemas

// Update = Create with all fields optional
export const update${Name}Schema = create${Name}Schema.partial();

// List = pagination + filters
export const list${Name}sSchema = paginationSchema.extend({
  status: statusSchema.optional(),
  search: z.string().optional(),
});

Discriminated Unions

const eventSchema = z.discriminatedUnion("type", [
  z.object({ type: z.literal("click"), x: z.number(), y: z.number() }),
  z.object({ type: z.literal("scroll"), offset: z.number() }),
]);

Step 3: After Creation

  1. Export from schemas index file
  2. Export types — always co-export inferred types
  3. Wire to routes — pass schemas to route validation
  4. Wire to forms — use with @hookform/resolvers/zod for React Hook Form

Rules

  1. Always export inferred typesz.infer, never manual interfaces
  2. Coerce query params — URL values are strings, use z.coerce.number() etc.
  3. Reuse common schemas — pagination, sorting, filtering if they exist
  4. Meaningful validation messages.min(1, "Name is required")
  5. .default() for optional with defaultsz.number().optional().default(50)
  6. .partial() for update schemas — derive from create schema when possible

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.