input-validation

Validate API request bodies, queries, and params with Zod schemas.

11|2|Updated Apr 7, 2026
One-click install
npx skills add https://github.com/porcupine-md/jonggrang --skill input-validation-porcupine-md
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: input-validation
Source: https://github.com/porcupine-md/jonggrang/tree/main/skills/library/api/input-validation
Command: npx skills add https://github.com/porcupine-md/jonggrang --skill input-validation-porcupine-md

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Untrusted API inputs can lead to security vulnerabilities, data corruption, and runtime errors. Validate and sanitize all request data at the boundary.

Core Features & Use Cases

  • Base schemas (reusable): Centralized, strongly typed validation for bodies, queries, and params using Zod.
  • Middleware integration: Reusable Express validation middleware that parses and coerces input, returning structured errors.
  • Security and error handling: Enforces unknown-field stripping, length checks, HTML sanitization, and safe parameter usage to prevent injection and leakage.

Quick Start

Apply a Zod schema to req.body, req.query, and req.params to validate and sanitize API inputs.

Frequently Asked Questions about input-validation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is the best way to prevent API injection and data leakage from untrusted inputs?

Preventing API injection and data leakage requires enforcing unknown-field stripping, length checks, HTML sanitization, and safe parameter usage within your Zod validation schemas before processing request data.

How does Zod handle type coercion and unknown fields during API input validation?

Zod handles type coercion and unknown fields by automatically stripping unrecognized data from request payloads and safely coercing input types to match your strongly typed base schemas.

Can I return structured validation errors from Express middleware when API input validation fails?

Yes, you can return structured validation errors from Express middleware by integrating reusable Zod schemas that parse requests and format error responses securely without leaking internal data.

Do I need TypeScript to use Zod schemas for secure API boundary validation?

While Zod schemas provide centralized, strongly typed validation for TypeScript environments, the underlying schema enforcement and unknown-field stripping also secure JavaScript API services at runtime.