Validator Gen for Openclaw

A specialized tool that automatically converts TypeScript interfaces and types into production-ready Zod or Yup validation schemas.

lxgicstudios
v1.0.1
Jan 29, 2026
0
0
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install validator-gen

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install validator-gen using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Validator Gen?

Validator Gen solves the common problem of maintaining separate TypeScript types and runtime validation schemas. By leveraging this tool within your Openclaw Skills library, you can ensure that your data validation always matches your static types without the manual overhead of writing schemas twice. It provides a bridge between compile-time safety and runtime integrity.

The skill intelligently analyzes your TypeScript source to generate schema code that handles nested objects, arrays, and union types. It goes beyond simple mapping by applying sensible constraints to common data formats like emails and URLs, ensuring your application remains secure and your data remains clean.

Validator Gen Use Cases

  • Building API endpoints that require strict request body validation matching existing types
  • Developing frontend forms where validation logic must stay in sync with data models
  • Migrating existing projects to modern validation libraries like Zod or Yup
  • Streamlining development workflows in Openclaw Skills by automating boilerplate schema creation

How Validator Gen Works

  1. The tool parses the specified TypeScript source file to identify interfaces and type aliases.
  2. It interprets the structure, including optional fields, arrays, and complex nested types.
  3. The engine maps these structures to the corresponding Zod or Yup syntax.
  4. It adds specialized validation logic for patterns like email formats or minimum/maximum lengths.
  5. The final output is generated as a ready-to-use code snippet that can be piped into your project files.

Validator Gen Setup

To use Validator Gen, ensure you are running Node.js 18 or higher and have an OpenAI API key configured in your environment variables. No permanent installation is required as it runs via npx.

export OPENAI_API_KEY=sk-...
npx ai-validator src/types/your-file.ts

Validator Gen Data Schema & Taxonomy

The tool processes TypeScript source code and generates schema definitions. The following table describes the mapping logic:

TypeScript Construct Generated Schema Equivalent
Interface/Type Alias zod.object() or yup.object()
Optional Property (?) .optional() or .notRequired()
String Patterns .email(), .url(), or .min()/.max()
Nested Objects Recursive schema generation
Arrays .array() validation

Validator Gen Advanced Features

  • Support for both Zod and Yup libraries via simple CLI flags
  • Automatic generation of localized or custom error messages using the --with-messages flag
  • Seamless integration with z.infer to maintain a single source of truth for types
  • High-fidelity parsing of complex TypeScript unions and intersections
  • Easy integration into Openclaw Skills automated devops pipelines

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*