skills$openclaw/validator-gen
lxgicstudios7.1k

by lxgicstudios

validator-gen – OpenClaw Skill

validator-gen is an OpenClaw Skills integration for coding workflows. Generate Zod and Yup validation schemas from TypeScript types. Use when you need runtime validation that matches your types.

7.1k stars10.0k forksSecurity L1
Updated Feb 7, 2026Created Feb 7, 2026coding

Skill Snapshot

namevalidator-gen
descriptionGenerate Zod and Yup validation schemas from TypeScript types. Use when you need runtime validation that matches your types. OpenClaw Skills integration.
ownerlxgicstudios
repositorylxgicstudios/validator-gen
languageMarkdown
licenseMIT
topics
securityL1
installopenclaw add @lxgicstudios/validator-gen
last updatedFeb 7, 2026

Maintainer

lxgicstudios

lxgicstudios

Maintains validator-gen in the OpenClaw Skills directory.

View GitHub profile
File Explorer
9 files
.
src
cli.ts
659 B
index.ts
1.2 KB
_meta.json
284 B
package-lock.json
30.2 KB
package.json
645 B
README.md
255 B
SKILL.md
2.5 KB
tsconfig.json
251 B
SKILL.md

name: validator-gen description: Generate Zod and Yup validation schemas from TypeScript types. Use when you need runtime validation that matches your types.

Validator Gen

Your TypeScript types don't validate at runtime. This tool generates Zod or Yup schemas that match your existing types. Type safety meets runtime validation without writing everything twice.

One command. Zero config. Just works.

Quick Start

npx ai-validator types.ts

What It Does

  • Generates Zod or Yup schemas from TypeScript interfaces and types
  • Handles nested objects, arrays, unions, and optional fields
  • Adds sensible constraints like email formats, min/max lengths
  • Includes error messages that make sense to users
  • Outputs ready-to-use validation code

Usage Examples

# Generate Zod schemas from your types
npx ai-validator src/types/user.ts

# Use Yup instead
npx ai-validator src/types/user.ts --library yup

# Include custom error messages
npx ai-validator src/types/user.ts --with-messages

# Save to file
npx ai-validator src/types/user.ts > src/validators/user.ts

Best Practices

  • Keep types and validators together - Put them in the same file or adjacent files
  • Infer types from validators - Use z.infer<typeof schema> for single source of truth
  • Add custom refinements manually - AI handles structure but you know your business rules
  • Test edge cases - Validators catch more than you think, make sure that's what you want

When to Use This

  • Building an API and need request body validation
  • Form validation that matches your data types
  • Migrating from no validation to typed validation
  • Don't want to manually sync types and validators

Part of the LXGIC Dev Toolkit

This is one of 110+ free developer tools built by LXGIC Studios. No paywalls, no sign-ups, no API keys on free tiers. Just tools that work.

Find more:

Requirements

No install needed. Just run with npx. Node.js 18+ recommended. Requires OPENAI_API_KEY environment variable.

export OPENAI_API_KEY=sk-...
npx ai-validator --help

How It Works

Parses your TypeScript source to extract type definitions. Translates each type into equivalent Zod or Yup schema code with appropriate validators for common patterns like emails, URLs, and dates. Preserves structure and optionality from your original types.

License

MIT. Free forever. Use it however you want.

README.md

ai-validator

Generate Zod and Yup validation schemas from TypeScript types

Install

npm install -g ai-validator

Usage

npx ai-validator ./path/to/file

Setup

export OPENAI_API_KEY=sk-...

License

MIT

Permissions & Security

Security level L1: Low-risk skills with minimal permissions. Review inputs and outputs before running in production.

Requirements

No install needed. Just run with npx. Node.js 18+ recommended. Requires OPENAI_API_KEY environment variable. ```bash export OPENAI_API_KEY=sk-... npx ai-validator --help ```

FAQ

How do I install validator-gen?

Run openclaw add @lxgicstudios/validator-gen in your terminal. This installs validator-gen into your OpenClaw Skills catalog.

Does this skill run locally or in the cloud?

OpenClaw Skills execute locally by default. Review the SKILL.md and permissions before running any skill.

Where can I verify the source code?

The source repository is available at https://github.com/openclaw/skills/tree/main/skills/lxgicstudios/validator-gen. Review commits and README documentation before installing.