arktype-validation — Claude Code skill: what it does, how to install
arktype-validation — a skill for ArkType, where schemas are TypeScript-shaped strings. Covers morphs, scopes and ArkEnv checks for environment variables. Handy for runtime validation that stays close to the type syntax.
MIT 153 installs ★ 29 updated 2026-08-17
npx skills add oakoss/agent-skills --skill arktype-validation -a claude-codeWhat arktype-validation does
ArkType builds runtime validators from strings that read like TypeScript: type({ id: "number", email: "string.email" }). The skill hands the agent a reference for that syntax, so it stops inventing call-style forms such as string.email() and checks failures with instanceof type.errors.
Three reference files sit inside: one on schema types, one on morphs and scopes, one on common patterns. That last file walks through JSON parsing, form and API response validation, plus environment variables via ArkEnv, which also comes with a Vite plugin for build-time checks.
One limit matters up front. This is written for ArkType, not Zod. If your code leans on the Zod ecosystem, or you need JSON Schema output, ArkType is the wrong tool here and the skill says so.
What it helps with
- define a runtime schema with TypeScript-like string syntax
- validate an API payload before it reaches the handler
- coerce environment variables to real types at startup
- cross-reference types inside a
scope() - transform input with a morph before validation runs
Example prompts for the agent
- Write an ArkType schema for the
userobject, withemailoptional and format-checked. - Validate
process.envwitharkenv()soPORTcomes out as a number. - Why does
type("string.email()")fail? Show me the version that works.
How to install arktype-validation
1Skills CLI (Vercel)
npx skills add oakoss/agent-skills --skill arktype-validation -a claude-code2Manually: put the files in place
~/.claude/skills/arktype-validation/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/arktype-validation/
1Skills CLI (Vercel)
npx skills add oakoss/agent-skills --skill arktype-validation -a codex2Manually: put the files in place
.agents/skills/arktype-validation/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add oakoss/agent-skills --skill arktype-validation -a cursor2Manually: put the files in place
.cursor/skills/arktype-validation/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install oakoss/agent-skills skills/arktype-validation2Manually: put the files in place
.github/skills/arktype-validation/SKILL.md1Skills CLI (Vercel)
npx skills add oakoss/agent-skills --skill arktype-validation -a gemini-cli2Platform CLI
gemini skills install https://github.com/oakoss/agent-skills --path skills/arktype-validationManually: put the files in place
.devin/skills/arktype-validation/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add oakoss/agent-skills --skill arktype-validation -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about arktype-validation
How do I install arktype-validation in Claude Code?
Run npx skills add oakoss/agent-skills --skill arktype-validation -a claude-code. The skill file lands at ~/.claude/skills/arktype-validation/SKILL.md.
What does arktype-validation do?
It gives the agent a reference for ArkType: string schemas, morphs and transforms, scope() for cross-references, generics, error handling. ArkEnv covers environment variables, with a Vite plugin alongside.
Does it replace Zod?
No. Zod schemas are handled by a separate skill, and ArkType does not target Zod ecosystem compatibility or JSON Schema output.
Source text
SKILL.md · MIT
---
name: arktype-validation
description: 'ArkType runtime validation with TypeScript-native syntax. Type-safe schemas using string expressions, morphs, scopes, and generics. Includes ArkEnv for typesafe environment variable validation with auto-coercion and Vite plugin. Use when defining schemas, validating data, transforming input, building type-safe APIs with ArkType, or validating environment variables with ArkEnv.'
license: MIT
metadata:
author: oakoss
version: '1.2'
user-invocable: false
---
# ArkType Validation
## Overview
ArkType is a TypeScript-native runtime validation library that defines schemas using string expressions mirroring TypeScript syntax, providing editor autocomplete, syntax highlighting, and optimized validators. Use when building type-safe APIs, validating JSON payloads, or replacing Zod with a more TypeScript-idiomatic approach. Not suitable for projects that need Zod ecosystem compatibility or JSON Schema output.
**Package:** `arktype`
## Quick Reference
| Pattern | Usage |
| --------------------------------- | ----------------------------------------------- |
| `type({ key: "string" })` | Define object schema |
| `type("string")` | Primitive type |
| `"string.email"`, `"string.url"` | Built-in string validators |
| `"string.trim"`, `"string.lower"` | Built-in string morphs (transforms) |
| `"string.json.parse"` | Parse JSON string to validated object |
| `"number > 0"`, `"string >= 1"` | Inline constraints |
| `"string \| number"` | Union types |
| `"'a' \| 'b' \| 'c'"` | String literal unions |
| `"string[]"` | Array types |
| `"key?": "string"` | Optional properties |
| `"key = 'default'"` | Default values |
| `.pipe()`, `.to()` | Transform output (morphs) |
| `.narrow()` | Custom validation (like Zod refine) |
| `.pick()`, `.omit()` | Object property selection |
| `.merge()` | Combine object types |
| `scope({...}).export()` | Named type scopes with cross-references |
| `type("<t>", { box: "t" })` | Generic type definitions |
| `type.errors` | Error handling (check `instanceof type.errors`) |
| `.assert(data)` | Throws on invalid input instead of returning |
| `"(number % 2)#even"` | Branding — type-only validated marker |
| `"0 <= number <= 100"` | Compact range constraints |
| `configure()` | Global defaults (from `arktype/config`) |
| `match()` | Type-safe pattern matching (2.1) |
| `"+" : "reject"` | Inline undeclared key handling |
| `arkenv({ PORT: "number" })` | Typesafe env var validation (ArkEnv) |
| `arkenvVitePlugin(Env)` | Build-time env validation for Vite |
## Common Mistakes
| Mistake | Fix |
| ------------------------------------- | ----------------------------------------------- |
| `type("string.email()")` with parens | `type("string.email")` (no parens) |
| Checking errors with `=== null` | Use `instanceof type.errors` |
| `{ key: "string?" }` for optional | `{ "key?": "string" }` (question mark on key) |
| Importing from `arktype/types` | Import `type` and `scope` from `"arktype"` |
| Nested `type()` in string expressions | Use `scope()` for cross-referencing types |
| Raw `.pipe()` without error handling | Use `.pipe.try()` for operations that can throw |
| `"string.lowercase"` for case morph | `"string.lower"` (also `"string.upper"`) |
| Configuring after importing `arktype` | Import `arktype/config` before `arktype` |
| Manual `process.env` parsing | Use `arkenv()` for auto-coercion and validation |
## Delegation
Use this skill for ArkType schema definitions, runtime validation, morphs/transforms, scopes, and type inference. For Zod-based validation, delegate to the zod-validation skill.
## References
- [Schema Types](references/schema-types.md) — primitives, string keywords, number constraints, objects, arrays, tuples, unions, optional, defaults
- [Morphs and Scopes](references/morphs-and-scopes.md) — pipe, morph transforms, narrow validation, scopes, recursive types, generics, global configuration, pattern matching
- [Common Patterns](references/common-patterns.md) — JSON parsing, form validation, API responses, error handling, ArkEnv environment variables, Vite plugin, comparison with Zod
© oakoss · MIT · oakoss/agent-skills