zap-validation-standard-schema

Validate unknown data with @zap-studio/validation using isStandardSchema, standardValidate/standardValidateSync, createStandardValidator, createSyncStandardValidator, and throwOnError result/exception modes.

155 stars

Best use case

zap-validation-standard-schema is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Validate unknown data with @zap-studio/validation using isStandardSchema, standardValidate/standardValidateSync, createStandardValidator, createSyncStandardValidator, and throwOnError result/exception modes.

Teams using zap-validation-standard-schema should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/zap-validation-standard-schema/SKILL.md --create-dirs "https://raw.githubusercontent.com/zap-studio/monorepo/main/packages/validation/skills/zap-validation-standard-schema/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/zap-validation-standard-schema/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How zap-validation-standard-schema Compares

Feature / Agentzap-validation-standard-schemaStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Validate unknown data with @zap-studio/validation using isStandardSchema, standardValidate/standardValidateSync, createStandardValidator, createSyncStandardValidator, and throwOnError result/exception modes.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# @zap-studio/validation — Standard Schema Validation

## Setup

```ts
import { standardValidate } from "@zap-studio/validation";
import { ValidationError } from "@zap-studio/validation/errors";
import { z } from "zod";

const UserSchema = z.object({ id: z.string(), email: z.string().email() });

try {
  const user = await standardValidate(
    UserSchema,
    { id: "1", email: "a@b.com" },
    {
      throwOnError: true,
    },
  );
  console.log(user.id);
} catch (error) {
  if (error instanceof ValidationError) {
    console.error(error.issues);
  }
}
```

## Core Patterns

### Use non-throw mode for explicit branching

```ts
import { standardValidate } from "@zap-studio/validation";

const result = await standardValidate(UserSchema, payload);
if (result.issues) {
  return { ok: false, issues: result.issues };
}

return { ok: true, value: result.value };
```

### Build reusable validators

```ts
import { createStandardValidator } from "@zap-studio/validation";

const validateUser = createStandardValidator(UserSchema);
const output = await validateUser(payload, { throwOnError: true });
```

### Guard unknown schema-like values

```ts
import { isStandardSchema, standardValidate } from "@zap-studio/validation";

async function validateMaybeSchema(schemaLike: unknown, input: unknown) {
  if (!isStandardSchema(schemaLike)) {
    throw new Error("Unsupported schema");
  }
  return standardValidate(schemaLike, input);
}
```

## Common Mistakes

### HIGH Calling sync helper on async schema

Wrong:

```ts
const value = standardValidateSync(asyncSchema, payload, { throwOnError: true });
```

Correct:

```ts
const value = await standardValidate(asyncSchema, payload, {
  throwOnError: true,
});
```

`standardValidateSync` throws when schema validation returns a Promise.

Source: zap-studio/monorepo:packages/validation/src/index.ts

### HIGH Treating non-throw result as parsed value

Wrong:

```ts
const user = await standardValidate(UserSchema, payload);
console.log(user.id);
```

Correct:

```ts
const result = await standardValidate(UserSchema, payload);
if (result.issues) throw new Error("invalid payload");
console.log(result.value.id);
```

Default mode returns `{ value?, issues? }`, not direct parsed output.

Source: zap-studio/monorepo:packages/validation/src/index.ts

### MEDIUM Skipping runtime schema guard for unknown inputs

Wrong:

```ts
await standardValidate(schemaLike as any, payload);
```

Correct:

```ts
if (!isStandardSchema(schemaLike)) throw new Error("Unsupported schema");
await standardValidate(schemaLike, payload);
```

Validation helpers expect Standard Schema-compatible values and rely on `~standard.validate` at runtime.

Source: zap-studio/monorepo:packages/validation/src/index.ts

Related Skills

zap-webhooks-routing-and-verification

155
from zap-studio/monorepo

Build webhook ingestion with @zap-studio/webhooks using createWebhookRouter, register path keys, prefix normalization, schema validation, lifecycle hooks, createHmacVerifier, and BaseAdapter request/response mapping.

zap-permit-policy-authoring

155
from zap-studio/monorepo

Author typed authorization policies with @zap-studio/permit using createPolicy, allow/deny/when, condition combinators, has/hasRole, and mergePolicies vs mergePoliciesAny decision strategies.

zap-fetch-typed-http

155
from zap-studio/monorepo

Implement type-safe HTTP requests with @zap-studio/fetch using $fetch, api.get/post/put/patch/delete, createFetch defaults, searchParams merging, and throwOnFetchError/throwOnValidationError return modes.

cpp-coding-standards

144923
from affaan-m/everything-claude-code

基于C++核心指南(isocpp.github.io)的C++编码标准。在编写、审查或重构C++代码时使用,以强制实施现代、安全和惯用的实践。

DevelopmentClaude

java-coding-standards

144923
from affaan-m/everything-claude-code

Spring Bootサービス向けのJavaコーディング標準:命名、不変性、Optional使用、ストリーム、例外、ジェネリクス、プロジェクトレイアウト。

coding-standards

144923
from affaan-m/everything-claude-code

Baseline cross-project coding conventions for naming, readability, immutability, and code-quality review. Use detailed frontend or backend skills for framework-specific patterns.

DevelopmentClaude

nft-standards

31392
from sickn33/antigravity-awesome-skills

Master ERC-721 and ERC-1155 NFT standards, metadata best practices, and advanced NFT features.

Web3 & BlockchainClaude

n8n-validation-expert

31392
from sickn33/antigravity-awesome-skills

Expert guide for interpreting and fixing n8n validation errors.

Workflow AutomationClaude

deployment-validation-config-validate

31392
from sickn33/antigravity-awesome-skills

You are a configuration management expert specializing in validating, testing, and ensuring the correctness of application configurations. Create comprehensive validation schemas, implement configurat

DevOps ToolsClaude

cc-skill-coding-standards

31392
from sickn33/antigravity-awesome-skills

Universal coding standards, best practices, and patterns for TypeScript, JavaScript, React, and Node.js development.

Code Quality & StandardsClaude

vault-standard-dev

16
from solanabr/solana-vault-standard

This skill provides a comprehensive development playbook for building Solana Tokenized Vaults, porting the ERC-4626 standard. It covers Anchor program development, vault mechanics, share/asset accounting, inflation attack protection, and robust testing strategies.

Coding & DevelopmentClaude

zod-validation-expert

31392
from sickn33/antigravity-awesome-skills

Expert in Zod — TypeScript-first schema validation. Covers parsing, custom errors, refinements, type inference, and integration with React Hook Form, Next.js, and tRPC.