string-utils

Normalize and sanitize strings in Zod schemas across frontend and backend.

23|3|Updated Jun 28, 2022
One-click install
npx skills add https://github.com/Esposter/Esposter --skill string-utils-esposter
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: string-utils
Source: https://github.com/Esposter/Esposter/tree/main/.agents/skills/string-utils
Command: npx skills add https://github.com/Esposter/Esposter --skill string-utils-esposter

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Centralize string handling across frontend and backend to normalize inputs and sanitize HTML.

Core Features & Use Cases

  • Normalize strings across the data pipeline to trim whitespace and standardize empty values.
  • Apply HTML sanitization at the Zod boundary to prevent XSS and ensure safe content in user data.
  • Use with base models and schemas to align server and client validation, reducing drift and errors.

Quick Start

Import normalizeString from @esposter/shared and apply it to all user inputs, forms, and parsing pipelines to ensure trimmed, non-null strings.

Frequently Asked Questions about string-utils

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

FAQPage Schema
How do I normalize strings and prevent XSS in Zod schemas?

You can normalize strings and prevent XSS in Zod schemas by applying centralized string handling at the Zod boundary. This trims whitespace, standardizes empty values, and sanitizes HTML to enforce type-safety and secure data processing across frontend and backend.

What is the best way to standardize empty strings and trim whitespace in TypeScript?

The best way to standardize empty strings and trim whitespace in TypeScript is to use a centralized normalizeString convention. Applying this to base models aligns server and client validation, reducing drift and ensuring consistent data parsing.

How do I sanitize HTML inputs for database fields in a TypeScript full-stack app?

To sanitize HTML inputs for database fields in a TypeScript full-stack app, apply HTML sanitization at the Zod validation boundary. This prevents XSS and ensures safe content is stored and processed across your data pipeline.

Does Zod support HTML sanitization and string normalization out of the box?

While Zod handles base validation, you enforce HTML sanitization and string normalization by integrating custom conventions into your Zod schemas. This centralizes trimming and empty-string semantics to secure user data inputs.

Why does frontend and backend string validation drift in TypeScript applications?

Frontend and backend string validation drifts when inputs are processed independently without a centralized convention. Applying a shared normalizeString function to base models and schemas aligns validation, reducing errors and ensuring consistent empty-string semantics.