transforming-string-methods

Installation
SKILL.md

Writing Zod Transformations

Purpose

Comprehensive guide to writing transformations in Zod v4, covering built-in string methods, custom transforms, codecs, and transformation pipelines.

Built-In String Transformations

Trim, Lower Case, Upper Case

const schema = z.string().trim();           // Remove whitespace
const schema = z.string().toLowerCase();    // Convert to lowercase
const schema = z.string().toUpperCase();    // Convert to uppercase

Use cases:

  • Trim: User input fields (always trim)
  • Lower: Email/username normalization
Related skills
Installs
4
First Seen
Feb 4, 2026