{"owner":"open-circle","repo":"valibot","hasSkills":true,"totalSkillsCount":10,"totalTokensCount":19381,"categories":["anthropic-skill","root-instruction","claude-rule","plugin-manifest"],"hasMcp":false,"mcpConfig":null,"found":[".agents/skills/repo-source-code-document/SKILL.md",".agents/skills/repo-source-code-review/SKILL.md",".agents/skills/repo-structure-navigate/SKILL.md",".agents/skills/repo-website-api-create/SKILL.md",".agents/skills/repo-website-api-update/SKILL.md",".agents/skills/repo-website-guide-create/SKILL.md","AGENTS.md","CLAUDE.md","packages/to-json-schema/README.md","website/public/.well-known/agent-skills/valibot/SKILL.md"],"skills":{".agents/skills/repo-source-code-document/SKILL.md":"---\nname: repo-source-code-document\ndescription: Write JSDoc comments and inline documentation for Valibot library source code in /library/src/. Use when documenting schemas, actions, methods, or utilities. Covers interface documentation, function overloads, purity annotations, inline comment patterns, and terminology consistency.\n---\n\n# Valibot Source Code Documentation\n\nDocumentation patterns for library source code in `/library/src/`.\n\n## JSDoc Patterns\n\n### Interface Documentation\n\n```typescript\n/**\n * String issue interface.\n */\nexport interface StringIssue extends BaseIssue<unknown> {\n  /**\n   * The issue kind.\n   */\n  readonly kind: 'schema';\n  /**\n   * The issue type.\n   */\n  readonly type: 'string';\n}\n```\n\n**Rules:**\n\n- First line: `[Name] [category] interface.` (e.g., \"String issue interface.\")\n- Property comments: `The [description].` (always start with \"The\", end with period)\n- All properties use `readonly`\n- No blank lines between property and its comment\n\n### Variance Annotations\n\nInterfaces in `/library/src/types/` annotate every generic and explain it with a hint:\n\n```typescript\n/**\n * Success dataset interface.\n *\n * Hint: The explicit variance annotations of the generics spare TypeScript\n * from measuring the variance of this interface (see issue #1663).\n */\nexport interface SuccessDataset<out TValue> {}\n```\n\n**Rules:**\n\n- `out` or `in`, whichever `tsc` accepts, and `in out` only if it rejects both (give the reason in the hint)\n- Not for interfaces in `schemas/`, `actions/` or `methods/`\n\n### Function Overloads\n\nEach overload gets its own complete JSDoc:\n\n```typescript\n/**\n * Creates a string schema.\n *\n * @returns A string schema.\n */\nexport function string(): StringSchema<undefined>;\n\n/**\n * Creates a string schema.\n *\n * @param message The error message.\n *\n * @returns A string schema.\n */\nexport function string<\n  const TMessage extends ErrorMessage<StringIssue> | undefined,\n>(message: TMessage): StringSchema<TMessage>;\n```\n\n**Rules:**\n\n- First line: `Creates a [name] [category].` (use \"a\" vs \"an\" correctly)\n- Blank line after description\n- `@param name The [description].` (start with \"The\", end with period)\n- Blank line after params\n- `@returns A [name] [category].` or `@returns The [description].`\n\n### Hints\n\nAdd hints after the main description, before `@param`:\n\n```typescript\n/**\n * Creates an object schema.\n *\n * Hint: This schema removes unknown entries. To include unknown entries, use\n * `looseObject`. To reject unknown entries, use `strictObject`.\n *\n * @param entries The entries schema.\n *\n * @returns An object schema.\n */\n```\n\n### Links\n\nLink to external resources when relevant using markdown format:\n\n```typescript\n/**\n * Creates an [email](https://en.wikipedia.org/wiki/Email_address) validation action.\n */\n```\n\n### Implementation Function\n\nThe implementation has **NO JSDoc** but uses `// @__NO_SIDE_EFFECTS__`:\n\n```typescript\n// @__NO_SIDE_EFFECTS__\nexport function string(\n  message?: ErrorMessage<StringIssue>\n): StringSchema<ErrorMessage<StringIssue> | undefined> {\n  return {\n    /* ... */\n  };\n}\n```\n\n**`// @__NO_SIDE_EFFECTS__` rules:**\n\n- Add for pure functions (no external state mutation, no I/O)\n- Most schema/action/method factories are pure\n- **Do NOT add** for functions that mutate arguments (like `_addIssue`)\n- Used by bundlers for tree-shaking\n\n### Utility Functions\n\n```typescript\n/**\n * Stringifies an unknown input to a literal or type string.\n *\n * @param input The unknown input.\n *\n * @returns A literal or type string.\n *\n * @internal\n */\n// @__NO_SIDE_EFFECTS__\nexport function _stringify(input: unknown): string {\n  // ...\n}\n```\n\n**Rules:**\n\n- Use `@internal` tag for internal utilities\n- Prefix internal functions with `_`\n- Only add `// @__NO_SIDE_EFFECTS__` if function is pure\n\n## Inline Comment Patterns\n\n### Section Headers\n\n```typescript\n'~run'(dataset, config) {\n  // Get input value from dataset\n  const input = dataset.value;\n\n  // If root type is valid, check nested types\n  if (Array.isArray(input)) {\n    // Set typed to true and value to empty array\n    dataset.typed = true;\n    dataset.value = [];\n\n    // Parse schema of each array item\n    for (let key = 0; key < input.length; key++) {\n      // ...\n    }\n  }\n}\n```\n\n**Rules:**\n\n- Describe WHAT the next code block does\n- Present tense verbs: \"Get\", \"Parse\", \"Check\", \"Set\", \"Add\", \"Create\"\n- **Omit articles** (\"the\", \"a\", \"an\"): \"Get input value\" not \"Get the input value\"\n- No period at end\n- Blank line before comment, no blank line after\n\n### Conditional Logic\n\n```typescript\n// If root type is valid, check nested types\nif (input && typeof input === 'object') {\n  // ...\n}\n\n// Otherwise, add issue\nelse {\n  _addIssue(this, 'type', dataset, config);\n}\n```\n\n**Rules:**\n\n- Use \"If [condition], [action]\"\n- Use \"Otherwise, [action]\" for else branches\n- Omit articles\n\n### Hint Comments (Exception)\n\n```typescript\n// Hint: The issue is deliberately not constructed with the spread operator\n// for performance reasons\nconst issue: BaseIssue<unknown> = {\n  /* ... */\n};\n```\n\n**Rules:**\n\n- Start with \"Hint:\"\n- Explain WHY, not just what\n- **CAN use articles** (unlike other inline comments)\n- Document performance decisions, non-obvious logic\n\n### TODO Comments\n\n```typescript\n// TODO: Should we add \"n\" suffix to bigints?\nif (type === 'bigint') {\n  /* ... */\n}\n```\n\n### @ts-expect-error\n\nUsed for internal dataset mutations TypeScript can't track:\n\n```typescript\n// @ts-expect-error\ndataset.typed = true;\n```\n\n## File Type Patterns\n\n### Schema Files (`string.ts`, `object.ts`, etc.)\n\n1. Issue interface with JSDoc\n2. Schema interface with JSDoc\n3. Function overloads with full JSDoc each\n4. Implementation with `// @__NO_SIDE_EFFECTS__`\n5. Return object with `'~run'` method containing inline comments\n\n### Action Files (`email.ts`, `minLength.ts`, etc.)\n\n1. Issue interface (for validation actions)\n2. Action interface with JSDoc\n3. Function overloads with JSDoc\n4. Implementation with `// @__NO_SIDE_EFFECTS__`\n\n### Method Files (`parse.ts`, `pipe.ts`, etc.)\n\nMore complex logic, require more inline comments.\n\n### Utility Files (`_addIssue.ts`, `_stringify.ts`)\n\n1. Single function with JSDoc including `@internal`\n2. `// @__NO_SIDE_EFFECTS__` only if pure\n\n## Terminology Consistency\n\nJSDoc descriptions must match the `kind` property if present:\n\n| `kind` Property    | JSDoc Wording                          |\n| ------------------ | -------------------------------------- |\n| `'schema'`         | \"Creates a ... schema.\"                |\n| `'validation'`     | \"Creates a ... validation action.\"     |\n| `'transformation'` | \"Creates a ... transformation action.\" |\n\n## Quick Reference\n\n### JSDoc First Lines\n\n| Type      | Pattern                        |\n| --------- | ------------------------------ |\n| Interface | `[Name] [category] interface.` |\n| Type      | `[Name] [category] type.`      |\n| Function  | `Creates a [name] [category].` |\n| Utility   | `[Verb]s [description].`       |\n\n### Inline Comment Starters\n\n| Pattern                        | Example                                        |\n| ------------------------------ | ---------------------------------------------- |\n| `// Get [what]`                | `// Get input value from dataset`              |\n| `// If [condition], [action]`  | `// If root type is valid, check nested types` |\n| `// Otherwise, [action]`       | `// Otherwise, add issue`                      |\n| `// Create [what]`             | `// Create object path item`                   |\n| `// Add [what] to [where]`     | `// Add issues to dataset`                     |\n| `// Parse [what]`              | `// Parse schema of each array item`           |\n| `// Set [property] to [value]` | `// Set typed to true`                         |\n| `// Hint: [explanation]`       | `// Hint: This is for performance`             |\n| `// TODO: [task]`              | `// TODO: Add bigint suffix`                   |\n\n## Terminology\n\nUse consistently:\n\n- **Schema** (not \"validator\")\n- **Action** (not \"validation\" for the object)\n- **Issue** (not \"error\" in type names)\n- **Dataset** (internal data structure)\n- **Config/Configuration** (not \"options\")\n\n## Checklist\n\n- [ ] Interfaces: `[Name] [category] interface.`\n- [ ] Properties: `The [description].`\n- [ ] `types/` interfaces: Variance annotations with hint\n- [ ] Overloads: Complete JSDoc each\n- [ ] Implementation: NO JSDoc\n- [ ] Pure functions: `// @__NO_SIDE_EFFECTS__`\n- [ ] Impure functions (mutate args): NO `@__NO_SIDE_EFFECTS__`\n- [ ] Internal utilities: `@internal` tag\n- [ ] Inline comments: No articles (except Hint), no periods\n- [ ] JSDoc comments: End with periods\n",".agents/skills/repo-source-code-review/SKILL.md":"---\nname: repo-source-code-review\ndescription: Review pull requests and source code changes in /library/src/. Use when reviewing PRs, validating implementation patterns, or checking code quality before merging. Covers code quality checks, type safety, documentation review, test coverage, and common issues to watch for.\n---\n\n# Reviewing Source Code Changes\n\nGuide for reviewing PRs and source code changes in `/library/src/`.\n\n## When to Use This Guide\n\n- Reviewing pull requests modifying library source\n- Validating implementation patterns before merging\n- Checking code quality, types, documentation, and tests\n\n## Review Process\n\n1. **Understand the change** — Read PR description, identify affected files\n2. **Check patterns** — Verify code follows existing conventions\n3. **Verify types** — Ensure type safety and proper inference\n4. **Review docs** — Confirm JSDoc is complete and accurate\n5. **Check tests** — Validate runtime and type test coverage\n\n## What to Review\n\n### Code Quality\n\n| Check             | Requirement                                                           |\n| ----------------- | --------------------------------------------------------------------- |\n| Naming            | Matches existing patterns (`StringSchema`, `minLength`, `_parse`)     |\n| Purity annotation | `// @__NO_SIDE_EFFECTS__` before pure factory functions               |\n| Import extensions | All imports use `.ts` extension                                       |\n| Interface vs type | Use `interface` for object shapes, `type` for unions/aliases          |\n| Folder structure  | Each API has: `name.ts`, `name.test.ts`, `name.test-d.ts`, `index.ts` |\n\n**Good — purity annotation:**\n\n```typescript\n// @__NO_SIDE_EFFECTS__\nexport function string(message?: ErrorMessage<StringIssue>): StringSchema {\n  return {\n    /* ... */\n  };\n}\n```\n\n**Bad — missing annotation:**\n\n```typescript\nexport function string(message?: ErrorMessage<StringIssue>): StringSchema {\n  return {\n    /* ... */\n  };\n}\n```\n\n### Type Safety\n\n| Check             | Requirement                                           |\n| ----------------- | ----------------------------------------------------- |\n| Generic inference | Types infer correctly without explicit annotations    |\n| Constraints       | Generic parameters have appropriate `extends` clauses |\n| Return types      | Explicit return types on exported functions           |\n| Type tests        | `.test-d.ts` file covers type inference scenarios     |\n| Variance          | Interfaces in `types/` annotate every generic         |\n\n**Good — constrained generic:**\n\n```typescript\nexport function minLength<\n  TInput extends LengthInput,\n  TRequirement extends number,\n>(\n  requirement: TRequirement,\n  message?: ErrorMessage<MinLengthIssue<TInput, TRequirement>>\n): MinLengthAction<TInput, TRequirement>;\n```\n\n### Documentation\n\n| Check          | Requirement                                       |\n| -------------- | ------------------------------------------------- |\n| JSDoc present  | All exported functions have JSDoc                 |\n| First line     | Action verb matching function purpose (see below) |\n| `@param` tags  | Every parameter documented                        |\n| `@returns` tag | Return value documented                           |\n| Overloads      | Every overload has its own complete JSDoc block   |\n\n**First line patterns by category:**\n\n| Category       | Pattern                                        |\n| -------------- | ---------------------------------------------- |\n| Schemas        | `Creates a ... schema.`                        |\n| Actions        | `Creates a ... action.`                        |\n| Parse methods  | `Parses ...`                                   |\n| Type guards    | `Checks if ...`                                |\n| Unwrap methods | `Unwraps ...`                                  |\n| Other methods  | `Creates a ...`, `Returns ...`, `Forwards ...` |\n\nSee `repo-source-code-document` skill for full documentation rules.\n\n### Tests\n\n| Check          | Requirement                                                |\n| -------------- | ---------------------------------------------------------- |\n| Runtime tests  | `.test.ts` covers success cases, failure cases, edge cases |\n| Type tests     | `.test-d.ts` validates type inference with `expectTypeOf`  |\n| Issue messages | Tests verify correct error messages and issue structure    |\n\n## Common Issues\n\n| Issue                     | What to Look For                                             |\n| ------------------------- | ------------------------------------------------------------ |\n| Missing purity annotation | Factory function without `// @__NO_SIDE_EFFECTS__`           |\n| Incomplete JSDoc          | Missing `@param` or `@returns`, wrong description format     |\n| No type tests             | New API without `.test-d.ts` file                            |\n| Wrong import extension    | Imports without `.ts` suffix                                 |\n| Inconsistent naming       | Schema not ending in `Schema`, action not ending in `Action` |\n| Side effects in pure code | Mutations, I/O, or global state in schema/action creation    |\n\n## Checklist\n\n- [ ] Implementation follows existing patterns in similar files\n- [ ] `// @__NO_SIDE_EFFECTS__` on pure factory functions\n- [ ] All imports use `.ts` extension\n- [ ] `interface` used for object shapes\n- [ ] JSDoc complete on all exports\n- [ ] Runtime tests in `.test.ts`\n- [ ] Type tests in `.test-d.ts`\n- [ ] Naming conventions followed\n- [ ] Variance annotations on generics of `types/` interfaces\n\n## Related Skills\n\n- `repo-structure-navigate` — Navigate the codebase\n- `repo-source-code-document` — JSDoc requirements\n",".agents/skills/repo-structure-navigate/SKILL.md":"---\nname: repo-structure-navigate\ndescription: Navigate the Valibot repository structure. Use when looking for files, understanding the codebase layout, finding schema/action/method implementations, locating tests, API docs, or guide pages. Covers monorepo layout, library architecture, file naming conventions, and quick lookups.\n---\n\n# Valibot Repository Structure\n\n## Monorepo Layout\n\n```\nvalibot/\n├── library/          # Core valibot package (zero dependencies)\n├── packages/\n│   ├── i18n/         # Translated error messages (25+ languages)\n│   └── to-json-schema/  # JSON Schema converter\n├── codemod/\n│   ├── migrate-to-v0.31.0/  # Version migration\n│   └── zod-to-valibot/      # Zod converter\n├── website/          # valibot.dev (Qwik + Vite)\n├── brand/            # Brand assets\n├── skills/           # Agent skills (this folder)\n└── prompts/          # Legacy AI agent guides\n```\n\n## Core Library (`/library/src/`)\n\n### Directory Structure\n\n| Directory   | Purpose                         | Examples                                      |\n| ----------- | ------------------------------- | --------------------------------------------- |\n| `schemas/`  | Data type validators            | `string/`, `object/`, `array/`, `union/`      |\n| `actions/`  | Validation & transformation     | `email/`, `minLength/`, `trim/`, `transform/` |\n| `methods/`  | High-level API                  | `parse/`, `safeParse/`, `pipe/`, `partial/`   |\n| `types/`    | TypeScript definitions          | `schema.ts`, `issue.ts`, `dataset.ts`         |\n| `utils/`    | Internal helpers (prefixed `_`) | `_addIssue/`, `_stringify/`, `ValiError/`     |\n| `storages/` | Global state                    | Config, message storage                       |\n\n### Schema Categories\n\n- **Primitives**: `string`, `number`, `boolean`, `bigint`, `date`, `symbol`, `blob`, `file`\n- **Objects**: `object`, `strictObject`, `looseObject`, `objectWithRest`\n- **Arrays**: `array`, `tuple`, `strictTuple`, `looseTuple`, `tupleWithRest`\n- **Advanced**: `union`, `variant`, `intersect`, `record`, `map`, `set`, `lazy`, `custom`\n- **Modifiers**: `optional`, `nullable`, `nullish`, `nonNullable`, `nonNullish`, `nonOptional`\n\n### Action Types\n\n**Validation** (return issues): `email`, `url`, `uuid`, `regex`, `minLength`, `maxValue`, `check`\n\n**Transformation** (modify data): `trim`, `toLowerCase`, `toUpperCase`, `mapItems`, `transform`\n\n**Metadata**: `brand`, `flavor`, `metadata`, `description`, `title`\n\n### File Naming Convention\n\nEach schema/action/method has its own directory:\n\n```\nschemas/string/\n├── string.ts        # Implementation\n├── string.test.ts   # Runtime tests\n├── string.test-d.ts # Type tests\n└── index.ts         # Re-export\n```\n\n### Core Patterns\n\n**Schemas** define data types:\n\n```typescript\nexport interface StringSchema<TMessage> extends BaseSchema<...> {\n  readonly kind: 'schema';\n  readonly type: 'string';\n  // ...\n}\n```\n\n**Actions** validate/transform in pipelines:\n\n```typescript\nexport interface EmailAction<TInput, TMessage> extends BaseValidation<...> {\n  readonly kind: 'validation';\n  readonly type: 'email';\n  // ...\n}\n```\n\n**Methods** provide API functions:\n\n```typescript\nexport function parse<TSchema>(\n  schema: TSchema,\n  input: unknown\n): InferOutput<TSchema>;\n```\n\n### Key Types\n\n- `BaseSchema`, `BaseValidation`, `BaseTransformation` - Base interfaces\n- `InferOutput<T>`, `InferInput<T>`, `InferIssue<T>` - Type inference\n- `Config`, `ErrorMessage<T>`, `BaseIssue<T>` - Configuration and errors\n- `'~standard'` property - [Standard Schema](https://github.com/standard-schema/standard-schema) compatibility\n\n## Website (`/website/src/routes/`)\n\n### API Documentation\n\n```\nroutes/api/\n├── (schemas)/string/     # Schema docs\n│   ├── index.mdx         # MDX content\n│   └── properties.ts     # Type definitions\n├── (actions)/email/      # Action docs\n├── (methods)/parse/      # Method docs\n├── (types)/StringSchema/ # Type docs\n└── menu.md               # Navigation\n```\n\n### Guides\n\n```\nroutes/guides/\n├── (get-started)/       # Intro, installation\n├── (main-concepts)/     # Schemas, pipelines, parsing\n├── (schemas)/           # Objects, arrays, unions\n├── (advanced)/          # Async, i18n, JSON Schema\n├── (migration)/         # Version upgrades\n└── menu.md              # Navigation\n```\n\n## Development\n\n### Playground\n\nUse `library/playground.ts` for quick experimentation.\n\n### Adding a Schema/Action\n\n1. Create directory: `library/src/schemas/yourSchema/`\n2. Create files: `yourSchema.ts`, `yourSchema.test.ts`, `yourSchema.test-d.ts`, `index.ts`\n3. Follow existing patterns (copy similar implementation)\n4. Export from category `index.ts`\n5. Run `pnpm -C library test`\n\n### Modifying Core Types\n\n⚠️ Changes to `library/src/types/` affect the entire library. Always run full test suite.\n\n## Quick Lookups\n\n| Looking for...        | Location                                       |\n| --------------------- | ---------------------------------------------- |\n| Schema implementation | `library/src/schemas/[name]/[name].ts`         |\n| Action implementation | `library/src/actions/[name]/[name].ts`         |\n| Method implementation | `library/src/methods/[name]/[name].ts`         |\n| Type definitions      | `library/src/types/`                           |\n| Internal utilities    | `library/src/utils/`                           |\n| Error messages (i18n) | `packages/i18n/[lang]/`                        |\n| API docs page         | `website/src/routes/api/(category)/[name]/`    |\n| Guide page            | `website/src/routes/guides/(category)/[name]/` |\n| Tests                 | Same directory as source, `.test.ts` suffix    |\n| Type tests            | Same directory as source, `.test-d.ts` suffix  |\n\n## Commands\n\n```bash\n# Library\npnpm -C library build      # Build\npnpm -C library test       # Run tests\npnpm -C library lint       # Lint\npnpm -C library format     # Format\n\n# Website\npnpm -C website dev        # Dev server\npnpm -C website build      # Production build\n\n# Root\npnpm install               # Install all\npnpm format                # Format all\n```\n\n## Key Principles\n\n1. **Modularity** - Small, focused functions; one per file\n2. **Zero dependencies** - Core library has no runtime deps\n3. **100% test coverage** - Required for library\n4. **Tree-shakable** - Use `// @__NO_SIDE_EFFECTS__` annotation\n5. **Type-safe** - Full TypeScript with strict mode\n6. **ESM only** - Imports include `.ts` extensions\n\n## Do's and Don'ts\n\n**Do:**\n\n- Follow existing code patterns\n- Write runtime and type tests\n- Add JSDoc documentation\n- Keep functions small and focused\n- Check bundle size impact\n\n**Don't:**\n\n- Add external dependencies\n- Modify core types without full test run\n- Skip tests\n- Create large multi-purpose functions\n- Modify generated files (`dist/`, `coverage/`)\n",".agents/skills/repo-website-api-create/SKILL.md":"---\nname: repo-website-api-create\ndescription: Create new API reference pages for the Valibot website at website/src/routes/api/. Use when adding documentation for new schemas, actions, methods, or types. Covers reading source code, creating properties.ts and index.mdx files, updating menu.md, and cross-referencing related APIs.\n---\n\n# Adding API Documentation to Website\n\nGuide for creating new API reference pages at `website/src/routes/api/`.\n\n## Process Overview\n\n1. Read source code in `/library/src/`\n2. Create folder in `/website/src/routes/api/(category)/[name]/`\n3. Create `properties.ts` with type definitions\n4. Create `index.mdx` with documentation\n5. Update `menu.md`\n6. Create type documentation if needed (Issue, Schema/Action interfaces)\n\n## File Structure\n\n```\nwebsite/src/routes/api/\n├── (schemas)/string/\n│   ├── index.mdx        # Documentation content\n│   └── properties.ts    # Type definitions for Property component\n├── (actions)/email/\n├── (methods)/parse/\n├── (types)/StringSchema/\n└── menu.md              # Navigation (alphabetical order)\n```\n\nCategories: `(schemas)`, `(actions)`, `(methods)`, `(types)`, `(utils)`, `(async)`, `(storages)`\n\n## Reading Source Code\n\n### What to Extract\n\nFrom `/library/src/schemas/string/string.ts`:\n\n```typescript\n// 1. Issue interface → Document in (types)/StringIssue/\nexport interface StringIssue extends BaseIssue<unknown> { ... }\n\n// 2. Schema interface → Document in (types)/StringSchema/\nexport interface StringSchema<TMessage extends ErrorMessage<StringIssue> | undefined>\n  extends BaseSchema<string, string, StringIssue> { ... }\n\n// 3. Function overloads → Main documentation\nexport function string(): StringSchema<undefined>;\nexport function string<const TMessage>(message: TMessage): StringSchema<TMessage>;\n\n// 4. JSDoc → Description, hints, parameter docs\n/**\n * Creates a string schema.\n *\n * Hint: This is an example hint.\n *\n * @param message The error message.\n *\n * @returns A string schema.\n */\n```\n\n**JSDoc hints** become blockquotes in the Explanation section:\n\n```mdx\n> This is an example hint.\n```\n\n### Extract for properties.ts\n\n- Generic parameters and constraints (e.g., `TMessage extends ErrorMessage<...> | undefined`)\n- Function parameters and types\n- Return type\n\n## properties.ts\n\nImport and define properties matching source code:\n\n```typescript\nimport type { PropertyProps } from '~/components';\n\nexport const properties: Record<string, PropertyProps> = {\n  // Generics (use modifier: 'extends')\n  TMessage: {\n    modifier: 'extends',\n    type: {\n      type: 'union',\n      options: [\n        {\n          type: 'custom',\n          name: 'ErrorMessage',\n          href: '../ErrorMessage/',\n          generics: [\n            { type: 'custom', name: 'StringIssue', href: '../StringIssue/' },\n          ],\n        },\n        'undefined',\n      ],\n    },\n  },\n\n  // Parameters (reference generic or direct type)\n  message: {\n    type: { type: 'custom', name: 'TMessage' },\n  },\n\n  // Return type\n  Schema: {\n    type: {\n      type: 'custom',\n      name: 'StringSchema',\n      href: '../StringSchema/',\n      generics: [{ type: 'custom', name: 'TMessage' }],\n    },\n  },\n};\n```\n\n### Optional Object Keys\n\nFor optional object keys from TypeScript source such as `key?: string`, do not append `?` to the property name in `properties.ts`.\n\nUse the plain key name and represent optionality in the value type with `undefined` as the last union option:\n\n```typescript\npayload: {\n  type: {\n    type: 'object',\n    entries: [\n      {\n        key: 'key',\n        value: {\n          type: 'union',\n          options: ['string', 'undefined'],\n        },\n      },\n    ],\n  },\n},\n```\n\n### DefinitionData Types\n\n| Type            | Syntax                                                                         |\n| --------------- | ------------------------------------------------------------------------------ |\n| Primitive       | `'string'`, `'number'`, `'boolean'`, `'unknown'`, etc.                         |\n| Literal string  | `{ type: 'string', value: 'email' }`                                           |\n| Literal number  | `{ type: 'number', value: 5 }`                                                 |\n| Custom/Named    | `{ type: 'custom', name: 'TypeName', href: '../TypeName/', generics: [...] }`  |\n| Custom+modifier | `{ type: 'custom', modifier: 'typeof', name: 'string', href: '../string/' }`   |\n| Union           | `{ type: 'union', options: [type1, type2] }`                                   |\n| Intersect       | `{ type: 'intersect', options: [type1, type2] }`                               |\n| Array           | `{ type: 'array', item: elementType }`                                         |\n| Tuple           | `{ type: 'tuple', items: [type1, type2] }`                                     |\n| Object          | `{ type: 'object', entries: [{ key: 'name', value: type }] }`                   |\n| Function        | `{ type: 'function', params: [{ name: 'x', type: t }], return: retType }`      |\n| Template        | `{ type: 'template', parts: [{ type: 'string', value: '>=' }, otherType] }`    |\n\n## index.mdx Template\n\n```mdx\n---\ntitle: functionName\ndescription: One-line description from JSDoc.\nsource: /schemas/string/string.ts\ncontributors:\n  - github-username\n---\n\nimport { ApiList, Property } from '~/components';\nimport { properties } from './properties';\n\n# functionName\n\nCreates a string schema.\n\n\\`\\`\\`ts\nconst Schema = v.functionName<TMessage>(message);\n\\`\\`\\`\n\n## Generics\n\n- \\`TMessage\\` <Property {...properties.TMessage} />\n\n## Parameters\n\n- \\`message\\` <Property {...properties.message} />\n\n### Explanation\n\nWith \\`functionName\\` you can validate... If the input does not match, you can use \\`message\\` to customize the error message.\n\n## Returns\n\n- \\`Schema\\` <Property {...properties.Schema} />\n\n## Examples\n\nThe following examples show how \\`functionName\\` can be used.\n\n### Email schema\n\nSchema to validate an email.\n\n\\`\\`\\`ts\nconst EmailSchema = v.pipe(\nv.string(),\nv.nonEmpty('Please enter your email.'),\nv.email('The email is badly formatted.')\n);\n\\`\\`\\`\n\n## Related\n\nThe following APIs can be combined with \\`functionName\\`.\n\n### Schemas\n\n<ApiList items={['array', 'object', 'string']} />\n\n### Methods\n\n<ApiList items={['parse', 'pipe', 'safeParse']} />\n\n### Actions\n\n<ApiList items={['email', 'minLength']} />\n\n### Utils\n\n<ApiList items={['isOfKind', 'isOfType']} />\n```\n\n**Related section order:** Schemas → Methods → Actions → Utils (omit empty sections)\n\n## Key Conventions\n\n### Naming\n\n- Schema variables: `PascalCase` + `Schema` suffix: `EmailSchema`, `UserSchema`\n- Action variables: `PascalCase` + `Action`: `MinLengthAction`\n- Parse output: `output` or descriptive name\n\n### Examples\n\n- Always include error messages for validation actions\n- Progress from simple to complex\n- Use realistic, practical scenarios\n- Start with `import * as v from 'valibot';` pattern\n\n### Error Messages\n\nUse friendly, actionable messages:\n\n- ✅ \"Your password is too short.\"\n- ✅ \"Please enter your email.\"\n- ❌ \"Invalid\" or \"Error\"\n\n### Links\n\n- Use `href: '../TypeName/'` for type references (with trailing slash)\n- Use `<Link href=\"/api/parse/\">\\`parse\\`</Link>`in MDX prose (import from`~/components`)\n- Link to related guides when relevant: `<Link href=\"/guides/objects/\">object guide</Link>`\n\n## Update Related Files\n\n### menu.md\n\nAdd alphabetically to `/website/src/routes/api/menu.md`:\n\n```markdown\n## Schemas\n\n- [any](/api/any/)\n- [newSchema](/api/newSchema/) ← Add here\n- [string](/api/string/)\n```\n\n### Related Sections of Other API Docs\n\nExisting API pages have a `## Related` section with `<ApiList>` components. When adding a new API, update related APIs to include the new one.\n\n**Rule:** An API is \"related\" if:\n\n- It makes sense to use it as an argument of the other API, or vice versa\n- It makes sense to use them together in the same `pipe` (e.g., `v.pipe(v.string(), v.email())` → `string` and `email` are related)\n\nExamples:\n\n- `string` schema lists `email` action because they work together in a pipe\n- `email` action lists `string` schema because it validates string input\n- `pipe` method lists all schemas because any schema can be piped\n- `minLength` action lists `string`, `array`, `tuple` because it validates their length\n\n**Process:**\n\n1. Review a few existing API docs in the same category to understand the pattern\n2. Check `menu.md` to identify potentially related APIs\n3. For each related API, edit its `index.mdx` and add the new API to the appropriate `<ApiList>`\n\n**Shortcut:** If your new API is very similar to an existing one (e.g., `guard` is similar to `check`), add it everywhere the similar API appears. This ensures consistent coverage across all related docs.\n\n### Concept Guides\n\nAdd the new API to the appropriate guide in `/website/src/routes/guides/`:\n\n| API Category | Guide to Update                       |\n| ------------ | ------------------------------------- |\n| Schema       | `(main-concepts)/schemas/index.mdx`   |\n| Action       | `(main-concepts)/pipelines/index.mdx` |\n| Method       | `(main-concepts)/methods/index.mdx`   |\n\nAlso update topic-specific guides if relevant (e.g., `(schemas)/objects/`, `(schemas)/arrays/`, `(advanced)/async/`).\n\n### Type Documentation\n\nCreate pages for new types in `(types)/`:\n\n- Issue interfaces (e.g., `StringIssue`)\n- Schema/Action interfaces (e.g., `StringSchema`)\n\nType pages differ from function docs:\n\n- **No `source` field** in frontmatter\n- **No Examples or Related sections**\n- Use `## Definition` instead of `## Returns`\n\nType page structure:\n\n```mdx\n---\ntitle: StringSchema\ndescription: String schema interface.\ncontributors:\n  - github-username\n---\n\nimport { Property } from '~/components';\nimport { properties } from './properties';\n\n# StringSchema\n\nString schema interface.\n\n## Generics\n\n- \\`TMessage\\` <Property {...properties.TMessage} />\n\n## Definition\n\n- \\`StringSchema\\` <Property {...properties.BaseSchema} />\n  - \\`type\\` <Property {...properties.type} />\n  - \\`reference\\` <Property {...properties.reference} />\n  - \\`expects\\` <Property {...properties.expects} />\n  - \\`message\\` <Property {...properties.message} />\n```\n\n## Checklist\n\n- [ ] Read source file completely\n- [ ] `properties.ts` matches source types exactly\n- [ ] `index.mdx` signature matches source\n- [ ] All generics documented\n- [ ] All parameters documented\n- [ ] Examples are realistic with error messages\n- [ ] `menu.md` updated (alphabetically)\n- [ ] Related type pages created if needed\n- [ ] Related API docs updated (add new API to their `## Related` sections)\n- [ ] Concept guide updated (schemas/pipelines/methods)\n- [ ] All `href` links valid with trailing slashes\n",".agents/skills/repo-website-api-update/SKILL.md":"---\nname: repo-website-api-update\ndescription: Update existing API documentation pages after source code changes. Use when syncing docs with library changes like new parameters, type constraint changes, interface updates, or function renames. Covers common change patterns and verification steps.\n---\n\n# Updating API Documentation\n\nGuide for syncing API docs with source code changes.\n\n**Prerequisite:** Read the `repo-website-api-create` skill for `properties.ts` and `index.mdx` patterns.\n\n## When to Update\n\nUpdate documentation when source code changes:\n\n- Function signatures (parameters, generics, return types)\n- Interface properties\n- JSDoc descriptions or hints\n- Behavior changes affecting examples\n\n**Do NOT update for:** Internal implementation changes (`~run` method), test changes, non-JSDoc comments.\n\n## Process\n\n1. **Read full source file** - Don't just look at diff; understand complete current state\n2. **Identify changes** - Categorize as addition, removal, or modification\n3. **Update `properties.ts`** - Match types exactly to source; for optional object keys, keep the plain key name and use a union with `undefined` as the last option instead of appending `?`\n4. **Update `index.mdx`** - Signature, generics, parameters, examples\n5. **Update related files** - Type docs, `menu.md` if renamed\n\n## Common Change Types\n\n### New Parameter Added\n\n```typescript\n// Before: one overload\nexport function action<TInput>(requirement: TRequirement): Action<...>;\n\n// After: two overloads (message is optional)\nexport function action<TInput>(requirement: TRequirement): Action<..., undefined>;\nexport function action<TInput, TMessage>(requirement: TRequirement, message: TMessage): Action<..., TMessage>;\n```\n\nUpdate:\n\n1. Add `TMessage` generic to `properties.ts`\n2. Add `message` parameter to `properties.ts`\n3. Update signature in `index.mdx`\n4. Add generic and parameter documentation\n5. Update examples to show new parameter\n\n### Parameter Removed (Breaking)\n\n1. Remove from `properties.ts`\n2. Update signature in `index.mdx`\n3. Remove from Parameters section\n4. Update all examples\n5. Consider adding migration note in Explanation\n\n### Type Constraint Changed\n\n```typescript\n// Before\nTRequirement extends number\n\n// After\nTRequirement extends number | string\n```\n\nUpdate:\n\n1. Update type in `properties.ts`\n2. Update Explanation to mention both types\n3. Add examples for new type usage\n\n### Interface Property Added\n\n1. Update type documentation in `(types)/TypeName/`\n2. Add new property to `properties.ts`; if the source key is optional, do not append `?` to the key name and model it as a union with `undefined` last\n3. Document in Definition section\n\n### Function Renamed\n\n1. Rename folder\n2. Update all references in files\n3. Update `menu.md` (maintain alphabetical order)\n4. Update cross-references in related API docs\n5. Consider redirect if widely used\n\n### Deprecation\n\nAdd notice at top of `index.mdx` (import `Link` from `~/components`):\n\n```mdx\n> **⚠️ Deprecated**: Use <Link href=\"../newFunction/\">\\`newFunction\\`</Link> instead. Will be removed in v2.0.\n```\n\n### New Helper Type Introduced\n\nWhen source introduces a type alias:\n\n```typescript\n// Before: TInput extends string | unknown[]\n// After: TInput extends LengthInput\n```\n\n1. Update `properties.ts` to reference new type with `href`\n2. Create documentation for the new type in `(types)/`\n3. Update explanation if supported types changed\n\n### Multiple Overloads Added (Sync/Async)\n\nWhen sync and async variants are added:\n\n1. Update signature to show general pattern or both overloads\n2. Add explanation about sync vs async usage\n3. Add examples for both use cases\n4. Update Related section for async schemas if relevant\n\n## Related Files to Update\n\nWhen a function changes, check:\n\n- **Type docs** - If interfaces changed (`(types)/TypeName/`)\n- **Related API docs** - Other APIs that reference this function in their Related section\n- **Guide files** - If usage patterns changed significantly\n- **menu.md** - If function renamed or moved\n\n## Verification\n\nAfter updating, verify:\n\n- [ ] All types match source exactly\n- [ ] Function signature matches source\n- [ ] All examples work with new API\n- [ ] All `href` links are valid\n- [ ] Related type docs updated if interfaces changed\n- [ ] `menu.md` updated if renamed\n- [ ] Related API docs updated (their Related sections)\n\n## Best Practices\n\n- **Read full source file** - Don't just look at diff\n- **Update incrementally** - `properties.ts` → `index.mdx` → related files\n- **Don't over-document internals** - Only user-facing changes need docs\n- **Preserve example quality** - Keep realistic, demonstrate best practices\n- **Check related APIs** - They may reference the changed function\n\n## When to Ask for Help\n\n- Major breaking changes (complete signature overhaul)\n- Complex generic constraint changes\n- Unclear intent from source changes\n- Many related files affected\n- Need to document migration path\n\n## Quick Reference\n\n| Change            | Files to Update                                                      |\n| ----------------- | -------------------------------------------------------------------- |\n| New parameter     | `properties.ts`, `index.mdx` (signature, generics, params, examples) |\n| Removed parameter | `properties.ts`, `index.mdx`                                         |\n| Type change       | `properties.ts`, `index.mdx` (explanation, examples)                 |\n| Interface change  | `(types)/TypeName/properties.ts`, `(types)/TypeName/index.mdx`       |\n| Renamed function  | Folder name, all files, `menu.md`, cross-references                  |\n| Deprecation       | `index.mdx` (add warning)                                            |\n",".agents/skills/repo-website-guide-create/SKILL.md":"---\nname: repo-website-guide-create\ndescription: Create conceptual documentation and tutorial pages for the Valibot website at website/src/routes/guides/. Use when adding guides about schemas, pipelines, async validation, migration, or other topics. Covers directory structure, MDX templates, frontmatter, and content guidelines.\n---\n\n# Adding Guides to Website\n\nGuide for creating conceptual documentation at `website/src/routes/guides/`.\n\n## Directory Structure\n\n```\nwebsite/src/routes/guides/\n├── menu.md                    # Navigation menu\n├── (get-started)/             # Intro, installation, quick start\n├── (main-concepts)/           # Schemas, pipelines, parsing\n├── (schemas)/                 # Objects, arrays, unions\n├── (advanced)/                # Async, i18n, JSON Schema\n├── (migration)/               # Version upgrades, Zod migration\n└── (category)/guide-slug/\n    └── index.mdx              # Guide content\n```\n\nNote: Category folders use parentheses (Qwik route grouping).\n\n## Process\n\n1. Review 2-3 existing guides in the target category to understand style\n2. Choose category from existing or create new\n3. Create folder: `(category)/guide-slug/`\n4. Create `index.mdx` with content\n5. Update `menu.md`\n\n## index.mdx Template\n\n```mdx\n---\ntitle: Guide Title\ndescription: >-\n  A concise description of what this guide covers.\ncontributors:\n  - github-username\n---\n\nimport { ApiList, Link } from '~/components';\n\n# Guide Title\n\nOpening paragraph explaining what the reader will learn.\n\n## Section Heading\n\nContent with clear, concise language.\n\n\\`\\`\\`ts\nimport \\* as v from 'valibot';\n\nconst Schema = v.object({\nname: v.string(),\nemail: v.pipe(v.string(), v.email()),\n});\n\\`\\`\\`\n\n## Another Section\n\nContinue with additional sections as needed.\n\nUse <Link href=\"/api/pipe/\">\\`pipe\\`</Link> for internal links.\n```\n\n## Frontmatter\n\nRequired fields:\n\n- **title**: Page title and navigation label\n- **description**: SEO description (use `>-` for multi-line)\n- **contributors**: Array of GitHub usernames\n\n## Content Guidelines\n\n### Code Examples\n\n- Use TypeScript (`ts` language)\n- Import as `import * as v from 'valibot';`\n- Include comments for complex code\n\n### Links\n\nInternal links use the `Link` component:\n\n```mdx\n<Link href=\"/guides/schemas/\">schemas guide</Link>\n<Link href=\"/api/pipe/\">\\`pipe\\`</Link>\n```\n\n### Components\n\n```mdx\n<ApiList label=\"Related schemas\" items={['object', 'array', 'string']} />\n```\n\n### Formatting\n\n- `inline code` for API names, variables, file names\n- **bold** for genuine emphasis only — not as inline section labels\n- Proper heading hierarchy (h1 title, h2 sections, h3 subsections)\n\n### Writing tone\n\n- Write conversational prose, not terse reference-doc style\n- Use first-person plural: \"we recommend\" not \"you should\"\n- Do not use bold as inline section labels (e.g. avoid `**Label:** content`). Use a proper subheading instead\n- Do not prefix blockquotes with bold labels (e.g. avoid `> **Note:** ...`). A plain `>` is correct\n- Bullet list items do not need a bold prefix on each item\n\n### Images\n\nPlace images in the same folder as `index.mdx`:\n\n```mdx\n![Alt text](./diagram-light.jpg)\n```\n\nConsider light/dark theme variants if applicable (e.g., `diagram-light.jpg`, `diagram-dark.jpg`).\n\n## Update menu.md\n\nAdd to `/website/src/routes/guides/menu.md`:\n\n```markdown\n## Category Name\n\n- [Existing Guide](/guides/existing/)\n- [New Guide Title](/guides/guide-slug/)\n```\n\nMaintain logical ordering within categories.\n\n## Checklist\n\n- [ ] Reviewed existing guides in the same category\n- [ ] Folder structure: `(category)/guide-slug/index.mdx`\n- [ ] Frontmatter: title, description, contributors\n- [ ] Internal links use `Link` component\n- [ ] Code examples use `import * as v from 'valibot';`\n- [ ] Added to `menu.md`\n- [ ] Style matches existing guides\n","AGENTS.md":"# AI Instructions\n\nValibot is a modular, type-safe schema validation library with zero runtime dependencies.\n\n## Monorepo Layout\n\n| Directory                  | Purpose                                         |\n| -------------------------- | ----------------------------------------------- |\n| `library/`                 | Core `valibot` package — most work happens here |\n| `packages/to-json-schema/` | JSON Schema converter                           |\n| `packages/i18n/`           | Translated error messages                       |\n| `website/`                 | valibot.dev (Qwik + Vite)                       |\n| `codemod/`                 | Migration and conversion tools                  |\n\n## Essential Commands\n\n```bash\npnpm install                    # Install dependencies\npnpm test                       # Run tests (all packages)\npnpm lint                       # ESLint + tsc + deno check (all packages)\npnpm format                     # Format code with Prettier (all packages)\npnpm build                      # Build for publishing (all packages)\n```\n\n## Code Conventions\n\n- **ESM with `.ts` extensions** in imports (enforced by ESLint)\n- **`interface` over `type`** for object shapes\n- **JSDoc required** on exported functions (first overload only for overload sets)\n- **`// @__NO_SIDE_EFFECTS__`** before pure factory functions for tree-shaking\n\n## Other Rules\n\n- **Source code is the single source of truth.** All documentation must match `/library/src/`.\n- **Lint and format after modifying code.** Run `eslint --fix` and `prettier --write` on the files you changed so CI passes.\n- **Use the GitHub CLI for GitHub-related tasks.** Prefer `gh` for pull requests, issues, checks, and other GitHub operations.\n\n## Library Architecture\n\nSchemas, actions, and methods are plain objects with a `'~run'` method:\n\n```\nlibrary/src/\n├── schemas/   → Data types (string, object, array...)\n├── actions/   → Validations & transforms (email, minLength, trim...)\n├── methods/   → API functions (parse, pipe, partial...)\n├── types/     → TypeScript definitions\n└── utils/     → Internal helpers (prefixed with _)\n```\n\nEach has its own folder: `name.ts`, `name.test.ts`, `name.test-d.ts`, `index.ts`.\n\n## Agent Skills\n\nThis repository includes agent skills in `/skills/` following the [Agent Skills](https://agentskills.io) open standard.\n\n**Naming:** Skills prefixed with `repo-` are local repository skills\n","CLAUDE.md":"AGENTS.md","packages/to-json-schema/README.md":"# Valibot to JSON Schema\n\nUtility to convert [Valibot](https://valibot.dev) schemas to JSON Schema. Supports JSON Schema draft-07, draft-2020-12, and OpenAPI 3.0 Schema Object formats.\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\ntoJsonSchema(v.string()); // { $schema: \"http://json-schema.org/draft-07/schema#\", type: \"string\" }\n```\n\nThis package is particularly popular for:\n\n- **API Documentation**: Generate OpenAPI specifications from your Valibot schemas\n- **Code Generation**: Create client SDKs and types from your validation schemas\n- **LLM Integration**: Generate structured outputs for Large Language Models\n- **Schema Sharing**: Share validation logic between different programming languages\n\n> Some Valibot features can't be mapped to JSON schema. For example, transformation actions have no equivalent in JSON schema. Also, some Valibot schemas or validations are too JS-specific and do not have an equivalent JSON schema attribute.\n\n## Supported features\n\n**Note**: Converted schemas may behave slightly differently in JSON schema validators (especially for string format) because their implementation is different from Valibot's.\n\n| Schema           | Status | Note                                                                                                                                  |\n| ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------- |\n| `any`            | ✅     |                                                                                                                                       |\n| `array`          | ✅     |                                                                                                                                       |\n| `boolean`        | ✅     |                                                                                                                                       |\n| `enum`           | ⚠️     | Only JSON compatible values are supported                                                                                             |\n| `exactOptional`  | ✅     |                                                                                                                                       |\n| `intersect`      | ✅     |                                                                                                                                       |\n| `lazy`           | ⚠️     | The `.getter` function is always executed with `undefined` as input                                                                   |\n| `literal`        | ⚠️     | Only JSON compatible values are supported                                                                                             |\n| `looseObject`    | ✅     |                                                                                                                                       |\n| `looseTuple`     | ✅     |                                                                                                                                       |\n| `never`          | ✅     |                                                                                                                                       |\n| `null`           | ✅     |                                                                                                                                       |\n| `nullable`       | ✅     |                                                                                                                                       |\n| `nullish`        | ✅     |                                                                                                                                       |\n| `number`         | ✅     |                                                                                                                                       |\n| `objectWithRest` | ✅     |                                                                                                                                       |\n| `object`         | ✅     |                                                                                                                                       |\n| `optional`       | ✅     |                                                                                                                                       |\n| `picklist`       | ⚠️     | Only JSON compatible values are supported                                                                                             |\n| `record`         | ⚠️     | Only `string` schemas for the key of the record are supported. Adds `propertyNames` for key validation (not available in OpenAPI 3.0) |\n| `strictObject`   | ✅     |                                                                                                                                       |\n| `strictTuple`    | ✅     |                                                                                                                                       |\n| `string`         | ✅     |                                                                                                                                       |\n| `tupleWithRest`  | ✅     |                                                                                                                                       |\n| `tuple`          | ✅     |                                                                                                                                       |\n| `union`          | ✅     |                                                                                                                                       |\n| `undefinedable`  | ✅     |                                                                                                                                       |\n| `unknown`        | ✅     |                                                                                                                                       |\n| `variant`        | ⚠️     | The discriminator key will be ignored                                                                                                 |\n\n| Actions         | Status | Note                                                   |\n| --------------- | ------ | ------------------------------------------------------ |\n| `base64`        | ✅     |                                                        |\n| `bic`           | ✅     |                                                        |\n| `cuid2`         | ✅     |                                                        |\n| `decimal`       | ✅     |                                                        |\n| `description`   | ✅     |                                                        |\n| `digits`        | ✅     |                                                        |\n| `domain`        | ✅     |                                                        |\n| `email`         | ✅     |                                                        |\n| `emoji`         | ✅     |                                                        |\n| `empty`         | ✅     |                                                        |\n| `endsWith`      | ✅     |                                                        |\n| `entries`       | ✅     |                                                        |\n| `examples`      | ✅     |                                                        |\n| `gtValue`       | ⚠️     | Only in combination with `number` and `integer` schema |\n| `hash`          | ✅     |                                                        |\n| `hexadecimal`   | ✅     |                                                        |\n| `hexColor`      | ✅     |                                                        |\n| `includes`      | ✅     |                                                        |\n| `integer`       | ✅     |                                                        |\n| `ipv4`          | ✅     |                                                        |\n| `ipv6`          | ✅     |                                                        |\n| `isoDate`       | ✅     |                                                        |\n| `isoDateTime`   | ✅     |                                                        |\n| `isoTime`       | ✅     |                                                        |\n| `isoTimeSecond` | ✅     |                                                        |\n| `isoTimestamp`  | ✅     |                                                        |\n| `isoWeek`       | ✅     |                                                        |\n| `isrc`          | ✅     |                                                        |\n| `jwsCompact`    | ✅     |                                                        |\n| `ksuid`         | ✅     |                                                        |\n| `length`        | ⚠️     | Only in combination with `string` and `array` schema   |\n| `ltValue`       | ⚠️     | Only in combination with `number` and `integer` schema |\n| `mac`           | ✅     |                                                        |\n| `mac48`         | ✅     |                                                        |\n| `mac64`         | ✅     |                                                        |\n| `maxEntries`    | ✅     |                                                        |\n| `maxLength`     | ⚠️     | Only in combination with `string` and `array` schema   |\n| `maxValue`      | ⚠️     | Only in combination with `number` schema               |\n| `metadata`      | ✅     | Additional properties are added without validation     |\n| `minEntries`    | ✅     |                                                        |\n| `minLength`     | ⚠️     | Only in combination with `string` and `array` schema   |\n| `minValue`      | ⚠️     | Only in combination with `number` schema               |\n| `multipleOf`    | ✅     |                                                        |\n| `nanoid`        | ✅     |                                                        |\n| `nonEmpty`      | ✅     |                                                        |\n| `notValue`      | ⚠️     | Only JSON compatible values are supported              |\n| `notValues`     | ⚠️     | Only JSON compatible values are supported              |\n| `octal`         | ✅     |                                                        |\n| `regex`         | ⚠️     | RegExp flags are not supported in JSON Schema          |\n| `rfcEmail`      | ✅     |                                                        |\n| `safeInteger`   | ✅     |                                                        |\n| `slug`          | ✅     |                                                        |\n| `startsWith`    | ✅     |                                                        |\n| `title`         | ✅     |                                                        |\n| `ulid`          | ✅     |                                                        |\n| `url`           | ✅     |                                                        |\n| `uuid`          | ✅     |                                                        |\n| `value`         | ⚠️     | Only JSON compatible values are supported              |\n| `values`        | ⚠️     | Only JSON compatible values are supported              |\n\n> For `length`, `minLength`, and `maxLength`, string constraints have different length semantics in Valibot and JSON Schema. Valibot checks JavaScript string length (`value.length`, UTF-16 code units), while JSON Schema `minLength` and `maxLength` count Unicode code points. This can differ for non-BMP code points such as emoji and for multi-code-point grapheme clusters such as combining marks or ZWJ sequences.\n\n## Configurations\n\n| Option         | Type                                                                  | Note                                                                                                                      |\n| -------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |\n| target         | `'draft-07' \\| 'draft-2020-12' \\| 'openapi-3.0'`                      | The target JSON Schema format. Defaults to `'draft-07'`.                                                                  |\n| typeMode       | `'ignore' \\| 'input' \\| 'output'`                                     | Whether to convert the input or output type of the Valibot schema to JSON Schema.                                         |\n| errorMode      | `'throw' \\| 'warn' \\| 'ignore'`                                       | The policy for handling incompatible schemas and actions.                                                                 |\n| definitions    | `Record<string, GenericSchema>`                                       | The schema definitions for constructing recursive schemas. If not specified, the definitions are generated automatically. |\n| overrideSchema | `(context: OverrideSchemaContext) => JsonSchema \\| null \\| undefined` | Overrides the JSON Schema conversion for a specific Valibot schema.                                                       |\n| ignoreActions  | `string[]`                                                            | The actions that should be ignored during the conversion.                                                                 |\n| overrideAction | `(context: OverrideActionContext) => JsonSchema \\| null \\| undefined` | Overrides the JSON Schema reference for a specific Valibot action.                                                        |\n| overrideRef    | `(context: OverrideRefContext) => string \\| null \\| undefined`        | Overrides the JSON Schema reference for a specific reference ID.                                                          |\n\n### Target format\n\nThe `target` configuration allows you to specify which JSON Schema format to generate. Different targets have different capabilities and syntax:\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst schema = v.nullable(v.string());\n\n// JSON Schema draft-07 (default)\ntoJsonSchema(schema);\n// { $schema: \"http://json-schema.org/draft-07/schema#\", anyOf: [{ type: \"string\" }, { type: \"null\" }] }\n\n// JSON Schema draft-2020-12\ntoJsonSchema(schema, { target: 'draft-2020-12' });\n// { $schema: \"https://json-schema.org/draft/2020-12/schema\", anyOf: [{ type: \"string\" }, { type: \"null\" }] }\n\n// OpenAPI 3.0 Schema Object\ntoJsonSchema(schema, { target: 'openapi-3.0' });\n// { type: \"string\", nullable: true }\n```\n\n**Note**: Some features like `propertyNames` for record schemas are not available in OpenAPI 3.0.\n\n### Type mode\n\nThe `typeMode` configuration controls whether to convert the input or output type of the Valibot schema to JSON Schema.\n\n- When set to `'input'`, conversion stops before the first potential type transformation action or second schema in any pipeline.\n- When set to `'output'`, conversion of any pipelines starts from the last schema in the pipeline. Therefore, the output type must be specified explicitly with a schema after the last type transformation action.\n- When set to `'ignore'` (default), the entire pipeline is converted.\n\nThis is particularly useful when defining API endpoints where external developers need different schema information for requests vs responses:\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst ValibotSchema = v.pipe(\n  v.string(),\n  v.decimal(),\n  v.transform(Number),\n  v.number(),\n  v.maxValue(100)\n);\n\ntoJsonSchema(ValibotSchema, { typeMode: 'input' });\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"string\",\n//   pattern: \"^[+-]?(?:\\\\d*\\\\.)?\\\\d+$\"\n// }\n\ntoJsonSchema(ValibotSchema, { typeMode: 'output' });\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"number\",\n//   maximum: 100\n// }\n```\n\n### Error mode\n\nThe `errorMode` configuration controls how the converter handles unsupported schemas and actions. By default, the error mode is set to `'throw'`. To force the conversion of unsupported Valibot features, you can set it to `'ignore'`.\n\n> Unsupported schemas usually return an empty JSON schema (`{}`) and unsupported actions are usually ignored.\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\ntoJsonSchema(v.file(), { errorMode: 'ignore' }); // {}\n\ntoJsonSchema(v.pipe(v.string(), v.creditCard()), { errorMode: 'ignore' }); // { type: \"string\" }\n```\n\n### Override functions\n\nThe package provides powerful override capabilities to customize the JSON Schema conversion process. You can override the conversion of specific schemas, actions, or references.\n\n#### Override schema conversion\n\nHandle unsupported schemas or customize conversion behavior:\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst ValibotSchema = v.object({ createdAt: v.date() });\n\ntoJsonSchema(ValibotSchema, {\n  overrideSchema(context) {\n    if (context.valibotSchema.type === 'date') {\n      return { type: 'string', format: 'date-time' };\n    }\n  },\n});\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"object\",\n//   properties: {\n//     createdAt: { type: \"string\" format: \"date-time\" }\n//   },\n//   required: [\"createdAt\"]\n// }\n```\n\n#### Override reference IDs\n\nCustomize reference IDs for OpenAPI or other specifications:\n\n```js\nimport { toJsonSchemaDefs } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst UserSchema = v.object({ name: v.string() });\n\ntoJsonSchemaDefs(\n  { UserSchema },\n  { overrideRef: (context) => `#/schemas/${context.referenceId}` }\n);\n```\n\n### Enhanced metadata support\n\nUse the generic `metadata` action to add title, description, and examples to your schemas or the individual `title` and `description` actions. Any other properties of the `metadata` action are added to the JSON Schema without further validation. This allows you to specify custom annotations and standard keywords such as `format`:\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst ValibotSchema = v.pipe(\n  v.string(),\n  v.email(),\n  v.metadata({\n    title: 'Email Schema',\n    description: 'A schema that validates email addresses.',\n    examples: ['jane@example.com'],\n    'x-category': 'auth',\n  })\n);\n\ntoJsonSchema(ValibotSchema);\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"string\",\n//   format: \"email\",\n//   title: \"Email Schema\",\n//   description: \"A schema that validates email addresses.\",\n//   examples: [\"jane@example.com\"],\n//   \"x-category\": \"auth\"\n// }\n```\n\n### Definitions\n\nNested and recursive schemas can be broken in multiple reusable definitions.\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst EmailSchema = v.pipe(v.string(), v.email());\ntoJsonSchema(v.object({ email: EmailSchema }), {\n  definitions: { EmailSchema },\n});\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"object\",\n//   properties: {\n//     email: {\n//       $ref: \"#/$defs/EmailSchema\"\n//     }\n//   },\n//   required: [\"email\"],\n//   $defs: {\n//     EmailSchema: {\n//       type: \"string\",\n//       format: \"email\"\n//     }\n//   }\n// }\n```\n\nDefinitions are not required for converting `lazy` schemas. Missing definitions will be generated automatically.\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst StringSchema = v.string();\ntoJsonSchema(v.object({ key: v.lazy(() => StringSchema) }));\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"object\",\n//   properties: {\n//     key: {\n//       $ref: \"#/$defs/0\"\n//     }\n//   },\n//   required: [\"key\"],\n//   $defs: {\n//     0: {\n//       type: \"string\"\n//     }\n//   }\n// }\n```\n\n## Additional functions\n\n### `toStandardJsonSchema`\n\nConverts a Valibot schema to the [Standard JSON Schema](https://standardschema.dev/) format. This format is useful when working with tools and libraries that support the Standard JSON Schema specification.\n\n```js\nimport { toStandardJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst schema = toStandardJsonSchema(\n  v.object({\n    id: v.pipe(v.string(), v.uuid()),\n    name: v.pipe(v.string(), v.nonEmpty()),\n    age: v.optional(v.number()),\n  })\n);\n```\n\n### `toJsonSchemaDefs`\n\nConverts only the provided Valibot schema definitions to JSON Schema definitions, without wrapping them in a root schema. This is particularly useful for OpenAPI specifications where you need only the schema definitions.\n\n```js\nimport { toJsonSchemaDefs } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst EmailSchema = v.pipe(v.string(), v.email());\nconst UserSchema = v.object({\n  name: v.string(),\n  email: EmailSchema,\n});\n\ntoJsonSchemaDefs({ EmailSchema, UserSchema });\n\n// {\n//   EmailSchema: {\n//     type: \"string\",\n//     format: \"email\"\n//   },\n//   UserSchema: {\n//     type: \"object\",\n//     properties: {\n//       name: {\n//         type: \"string\"\n//       },\n//       email: {\n//         $ref: \"#/$defs/EmailSchema\"\n//       }\n//     },\n//     required: [\"name\", \"email\"]\n//   }\n// }\n```\n\n#### OpenAPI integration\n\nFor OpenAPI specifications, you can customize reference IDs:\n\n```js\nimport { toJsonSchemaDefs } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst ValibotSchema1 = v.string();\nconst ValibotSchema2 = v.number();\nconst ValibotSchema3 = v.tuple([ValibotSchema1, ValibotSchema2]);\n\ntoJsonSchemaDefs(\n  { ValibotSchema1, ValibotSchema2, ValibotSchema3 },\n  { overrideRef: (context) => `#/schemas/${context.referenceId}` }\n);\n\n// {\n//   ValibotSchema1: { type: \"string\" },\n//   ValibotSchema2: { type: \"number\" },\n//   ValibotSchema3: {\n//     type: \"array\",\n//     items: [\n//       { $ref: \"#/schemas/ValibotSchema1\" },\n//       { $ref: \"#/schemas/ValibotSchema2\" }\n//     ],\n//     minItems: 2\n//   }\n// }\n```\n\n### Global definitions\n\nFor advanced use cases, you can manage global schema definitions that will be automatically used when converting schemas. This is particularly useful for larger projects with many reusable schemas.\n\n```js\nimport { addGlobalDefs, toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst ValibotSchema1 = v.string();\nconst ValibotSchema2 = v.number();\n\naddGlobalDefs({ ValibotSchema1, ValibotSchema2 });\n\nconst ValibotSchema3 = v.tuple([ValibotSchema1, ValibotSchema2]);\n\ntoJsonSchema(ValibotSchema3);\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"array\",\n//   items: [\n//     { $ref: \"#/$defs/ValibotSchema1\" },\n//     { $ref: \"#/$defs/ValibotSchema2\" }\n//   ],\n//   minItems: 2,\n//   $defs: {\n//     ValibotSchema1: { type: \"string\" },\n//     ValibotSchema2: { type: \"number\" }\n//   }\n// }\n```\n\nYou can also convert global definitions directly using `toJsonSchemaDefs`:\n\n```js\nconst globalDefs = getGlobalDefs();\nif (globalDefs) {\n  const schemaDefs = toJsonSchemaDefs(globalDefs);\n}\n```\n","website/public/.well-known/agent-skills/valibot/SKILL.md":"---\nname: valibot\ndescription: Schema validation with Valibot, the modular and type-safe schema library. Use when the user needs to validate data, create schemas, parse inputs, or work with Valibot in their project. Also use when migrating from Zod to Valibot.\nlicense: MIT\nmetadata:\n  author: open-circle\n  version: \"1.0\"\n---\n\n# Valibot\n\nThis skill helps you work effectively with [Valibot](https://valibot.dev), the modular and type-safe schema library for validating structural data.\n\n## When to use this skill\n\n- When the user asks about schema validation with Valibot\n- When creating or modifying Valibot schemas\n- When parsing or validating user input\n- When the user mentions Valibot, schema, or validation\n- When migrating from Zod to Valibot\n\n## CRITICAL: Valibot vs Zod — Do Not Confuse!\n\n**Valibot and Zod have different APIs. Never mix them up!**\n\n### Key Differences\n\n| Feature             | Zod ❌                                | Valibot ✅                                                |\n| ------------------- | ------------------------------------- | --------------------------------------------------------- |\n| Import              | `import { z } from 'zod'`             | `import * as v from 'valibot'`                            |\n| Validations         | Chained methods: `.email().min(5)`    | Pipeline: `v.pipe(v.string(), v.email(), v.minLength(5))` |\n| Parsing             | `schema.parse(data)`                  | `v.parse(schema, data)`                                   |\n| Safe parsing        | `schema.safeParse(data)`              | `v.safeParse(schema, data)`                               |\n| Optional            | `z.string().optional()`               | `v.optional(v.string())`                                  |\n| Nullable            | `z.string().nullable()`               | `v.nullable(v.string())`                                  |\n| Default             | `z.string().default('x')`             | `v.optional(v.string(), 'x')`                             |\n| Transform           | `z.string().transform(fn)`            | `v.pipe(v.string(), v.transform(fn))`                     |\n| Refine/Check        | `z.string().refine(fn)`               | `v.pipe(v.string(), v.check(fn))`                         |\n| Enum                | `z.enum(['a', 'b'])`                  | `v.picklist(['a', 'b'])`                                  |\n| Native enum         | `z.nativeEnum(MyEnum)`                | `v.enum(MyEnum)`                                          |\n| Union               | `z.union([a, b])`                     | `v.union([a, b])`                                         |\n| Discriminated union | `z.discriminatedUnion('type', [...])` | `v.variant('type', [...])`                                |\n| Intersection        | `z.intersection(a, b)`                | `v.intersect([a, b])`                                     |\n| Min/max length      | `.min(5).max(10)`                     | `v.minLength(5), v.maxLength(10)`                         |\n| Min/max value       | `.gte(5).lte(10)`                     | `v.minValue(5), v.maxValue(10)`                           |\n| Infer type          | `z.infer<typeof Schema>`              | `v.InferOutput<typeof Schema>`                            |\n| Infer input         | `z.input<typeof Schema>`              | `v.InferInput<typeof Schema>`                             |\n\n### Common Mistakes to Avoid\n\n```typescript\n// ❌ WRONG - This is Zod syntax, NOT Valibot!\nconst Schema = v.string().email().min(5);\nconst result = Schema.parse(data);\n\n// ✅ CORRECT - Valibot uses functions and pipelines\nconst Schema = v.pipe(v.string(), v.email(), v.minLength(5));\nconst result = v.parse(Schema, data);\n```\n\n```typescript\n// ❌ WRONG - Zod-style optional\nconst Schema = v.object({\n  name: v.string().optional(),\n});\n\n// ✅ CORRECT - Valibot wraps with optional()\nconst Schema = v.object({\n  name: v.optional(v.string()),\n});\n```\n\n```typescript\n// ❌ WRONG - Zod-style default\nconst Schema = v.string().default(\"hello\");\n\n// ✅ CORRECT - Valibot uses second argument\nconst Schema = v.optional(v.string(), \"hello\");\n```\n\n## Installation\n\n```bash\nnpm install valibot     # npm\nyarn add valibot        # yarn\npnpm add valibot        # pnpm\nbun add valibot         # bun\n```\n\nImport with a wildcard (recommended):\n\n```typescript\nimport * as v from \"valibot\";\n```\n\nOr with individual imports:\n\n```typescript\nimport { object, string, pipe, email, parse } from \"valibot\";\n```\n\n## Mental Model\n\nValibot's API is divided into three main concepts:\n\n### 1. Schemas\n\nSchemas define the expected data type. They are the starting point.\n\n```typescript\nimport * as v from \"valibot\";\n\n// Primitive schemas\nconst StringSchema = v.string();\nconst NumberSchema = v.number();\nconst BooleanSchema = v.boolean();\nconst DateSchema = v.date();\n\n// Complex schemas\nconst ArraySchema = v.array(v.string());\nconst ObjectSchema = v.object({\n  name: v.string(),\n  age: v.number(),\n});\n```\n\n### 2. Methods\n\nMethods help you use or modify schemas. The schema is always the first argument.\n\n```typescript\n// Parsing\nconst result = v.parse(StringSchema, \"hello\");\nconst safeResult = v.safeParse(StringSchema, \"hello\");\n\n// Type guard\nif (v.is(StringSchema, data)) {\n  // data is typed as string\n}\n```\n\n### 3. Actions\n\nActions validate or transform data within a `pipe()`. They MUST be used inside pipelines.\n\n```typescript\n// Actions are used in pipe()\nconst EmailSchema = v.pipe(\n  v.string(),\n  v.trim(),\n  v.email(),\n  v.endsWith(\"@example.com\"),\n);\n```\n\n## Pipelines\n\nPipelines extend schemas with validation and transformation actions. A pipeline always starts with a schema, followed by actions.\n\n```typescript\nimport * as v from \"valibot\";\n\nconst UsernameSchema = v.pipe(\n  v.string(),\n  v.trim(),\n  v.minLength(3, \"Username must be at least 3 characters\"),\n  v.maxLength(20, \"Username must be at most 20 characters\"),\n  v.regex(\n    /^[a-z0-9_]+$/i,\n    \"Username can only contain letters, numbers, and underscores\",\n  ),\n);\n\nconst AgeSchema = v.pipe(\n  v.number(),\n  v.integer(\"Age must be a whole number\"),\n  v.minValue(0, \"Age cannot be negative\"),\n  v.maxValue(150, \"Age cannot exceed 150\"),\n);\n```\n\n### Common Validation Actions\n\n**String validations:**\n\n- `v.email()` — Valid email format\n- `v.url()` — Valid URL format\n- `v.uuid()` — Valid UUID format\n- `v.regex(pattern)` — Match regex pattern\n- `v.minLength(n)` — Minimum length\n- `v.maxLength(n)` — Maximum length\n- `v.length(n)` — Exact length\n- `v.nonEmpty()` — Not empty string\n- `v.startsWith(str)` — Starts with string\n- `v.endsWith(str)` — Ends with string\n- `v.includes(str)` — Contains string\n\n**Number validations:**\n\n- `v.minValue(n)` — Minimum value (>=)\n- `v.maxValue(n)` — Maximum value (<=)\n- `v.gtValue(n)` — Greater than (>)\n- `v.ltValue(n)` — Less than (<)\n- `v.integer()` — Must be integer\n- `v.finite()` — Must be finite\n- `v.safeInteger()` — Safe integer range\n- `v.multipleOf(n)` — Must be multiple of n\n\n**Array validations:**\n\n- `v.minLength(n)` — Minimum items\n- `v.maxLength(n)` — Maximum items\n- `v.length(n)` — Exact item count\n- `v.nonEmpty()` — At least one item\n- `v.includes(item)` — Contains item\n- `v.excludes(item)` — Does not contain item\n\n### Custom Validation with check()\n\n```typescript\nconst PasswordSchema = v.pipe(\n  v.string(),\n  v.minLength(8),\n  v.check(\n    (input) => /[A-Z]/.test(input),\n    \"Password must contain an uppercase letter\",\n  ),\n  v.check((input) => /[0-9]/.test(input), \"Password must contain a number\"),\n);\n```\n\n### Value Transformations\n\nThese actions modify the value without changing its type:\n\n**String transformations:**\n\n- `v.trim()` — Remove leading/trailing whitespace\n- `v.trimStart()` — Remove leading whitespace\n- `v.trimEnd()` — Remove trailing whitespace\n- `v.toLowerCase()` — Convert to lowercase\n- `v.toUpperCase()` — Convert to uppercase\n\n**Number transformations:**\n\n- `v.toMinValue(n)` — Clamp to minimum value (if less than n, set to n)\n- `v.toMaxValue(n)` — Clamp to maximum value (if greater than n, set to n)\n\n```typescript\nconst NormalizedEmailSchema = v.pipe(\n  v.string(),\n  v.trim(),\n  v.toLowerCase(),\n  v.email(),\n);\n\n// Clamp number to range 0-100\nconst PercentageSchema = v.pipe(v.number(), v.toMinValue(0), v.toMaxValue(100));\n```\n\n### Type Transformations\n\nFor converting between data types, use these built-in transformation actions:\n\n- `v.toNumber()` — Convert to number\n- `v.toString()` — Convert to string\n- `v.toBoolean()` — Convert to boolean\n- `v.toBigint()` — Convert to bigint\n- `v.toDate()` — Convert to Date\n\n```typescript\n// Convert string to number\nconst PortSchema = v.pipe(v.string(), v.toNumber(), v.integer(), v.minValue(1));\n\n// Convert ISO string to Date\nconst TimestampSchema = v.pipe(v.string(), v.isoDateTime(), v.toDate());\n\n// Convert to boolean\nconst FlagSchema = v.pipe(v.string(), v.toBoolean());\n```\n\n### Custom Transformations\n\nFor custom transformations, use `v.transform()`:\n\n```typescript\nconst DateStringSchema = v.pipe(\n  v.string(),\n  v.isoDate(),\n  v.transform((input) => new Date(input)),\n);\n\n// Custom object transformation\nconst UserSchema = v.pipe(\n  v.object({\n    firstName: v.string(),\n    lastName: v.string(),\n  }),\n  v.transform((input) => ({\n    ...input,\n    fullName: `${input.firstName} ${input.lastName}`,\n  })),\n);\n```\n\n## Object Schemas\n\n### Basic Object\n\n```typescript\nconst UserSchema = v.object({\n  id: v.number(),\n  name: v.string(),\n  email: v.pipe(v.string(), v.email()),\n  age: v.optional(v.number()),\n});\n\ntype User = v.InferOutput<typeof UserSchema>;\n```\n\n### Object Variants\n\n```typescript\n// Regular object - strips unknown keys (default)\nconst ObjectSchema = v.object({ key: v.string() });\n\n// Loose object - allows and preserves unknown keys\nconst LooseObjectSchema = v.looseObject({ key: v.string() });\n\n// Strict object - throws on unknown keys\nconst StrictObjectSchema = v.strictObject({ key: v.string() });\n\n// Object with rest - validates unknown keys against a schema\nconst ObjectWithRestSchema = v.objectWithRest(\n  { key: v.string() },\n  v.number(), // unknown keys must be numbers\n);\n```\n\n### Optional and Nullable Fields\n\n```typescript\nconst ProfileSchema = v.object({\n  // Required\n  name: v.string(),\n\n  // Optional (can be undefined or missing)\n  nickname: v.optional(v.string()),\n\n  // Optional with default\n  role: v.optional(v.string(), \"user\"),\n\n  // Nullable (can be null)\n  avatar: v.nullable(v.string()),\n\n  // Nullish (can be null or undefined)\n  bio: v.nullish(v.string()),\n\n  // Nullish with default\n  theme: v.nullish(v.string(), \"light\"),\n});\n```\n\n### Object Methods\n\n```typescript\nconst BaseSchema = v.object({\n  id: v.number(),\n  name: v.string(),\n  email: v.string(),\n  password: v.string(),\n});\n\n// Pick specific keys\nconst PublicUserSchema = v.pick(BaseSchema, [\"id\", \"name\"]);\n\n// Omit specific keys\nconst UserWithoutPasswordSchema = v.omit(BaseSchema, [\"password\"]);\n\n// Make all optional\nconst PartialUserSchema = v.partial(BaseSchema);\n\n// Make all required\nconst RequiredUserSchema = v.required(PartialUserSchema);\n\n// Merge objects\nconst ExtendedUserSchema = v.object({\n  ...BaseSchema.entries,\n  createdAt: v.date(),\n});\n```\n\n### Cross-Field Validation\n\n```typescript\nconst RegistrationSchema = v.pipe(\n  v.object({\n    password: v.pipe(v.string(), v.minLength(8)),\n    confirmPassword: v.string(),\n  }),\n  v.forward(\n    v.partialCheck(\n      [[\"password\"], [\"confirmPassword\"]],\n      (input) => input.password === input.confirmPassword,\n      \"Passwords do not match\",\n    ),\n    [\"confirmPassword\"],\n  ),\n);\n```\n\n## Arrays and Tuples\n\n### Arrays\n\n```typescript\nconst TagsSchema = v.pipe(\n  v.array(v.string()),\n  v.minLength(1, \"At least one tag required\"),\n  v.maxLength(10, \"Maximum 10 tags allowed\"),\n);\n\n// Array of objects\nconst UsersSchema = v.array(\n  v.object({\n    id: v.number(),\n    name: v.string(),\n  }),\n);\n```\n\n### Tuples\n\n```typescript\n// Fixed-length array with specific types\nconst CoordinatesSchema = v.tuple([v.number(), v.number()]);\n// Type: [number, number]\n\n// Tuple with rest\nconst ArgsSchema = v.tupleWithRest(\n  [v.string()], // first arg is string\n  v.number(), // rest are numbers\n);\n// Type: [string, ...number[]]\n```\n\n## Unions and Variants\n\n### Union\n\n```typescript\nconst StringOrNumberSchema = v.union([v.string(), v.number()]);\n\nconst StatusSchema = v.union([\n  v.literal(\"pending\"),\n  v.literal(\"active\"),\n  v.literal(\"inactive\"),\n]);\n```\n\n### Picklist (for string/number literals)\n\n```typescript\n// Simpler than union of literals\nconst StatusSchema = v.picklist([\"pending\", \"active\", \"inactive\"]);\n\nconst PrioritySchema = v.picklist([1, 2, 3]);\n```\n\n### Variant (discriminated union)\n\nUse `variant` for better performance with discriminated unions:\n\n```typescript\nconst EventSchema = v.variant(\"type\", [\n  v.object({\n    type: v.literal(\"click\"),\n    x: v.number(),\n    y: v.number(),\n  }),\n  v.object({\n    type: v.literal(\"keypress\"),\n    key: v.string(),\n  }),\n  v.object({\n    type: v.literal(\"scroll\"),\n    direction: v.picklist([\"up\", \"down\"]),\n  }),\n]);\n```\n\n## Parsing Data\n\n### parse() — Throws on Error\n\n```typescript\nimport * as v from \"valibot\";\n\nconst EmailSchema = v.pipe(v.string(), v.email());\n\ntry {\n  const email = v.parse(EmailSchema, \"jane@example.com\");\n  console.log(email); // 'jane@example.com'\n} catch (error) {\n  console.error(error); // ValiError\n}\n```\n\n### safeParse() — Returns Result Object\n\n```typescript\nconst result = v.safeParse(EmailSchema, input);\n\nif (result.success) {\n  console.log(result.output); // Valid data\n} else {\n  console.log(result.issues); // Array of issues\n}\n```\n\n### is() — Type Guard\n\n```typescript\nif (v.is(EmailSchema, input)) {\n  // input is typed as string\n}\n```\n\n### Configuration Options\n\n```typescript\n// Abort early - stop at first error\nv.parse(Schema, data, { abortEarly: true });\n\n// Abort pipe early - stop pipeline at first error\nv.parse(Schema, data, { abortPipeEarly: true });\n```\n\n## Type Inference\n\n```typescript\nimport * as v from \"valibot\";\n\nconst UserSchema = v.object({\n  name: v.string(),\n  age: v.pipe(v.string(), v.transform(Number)),\n  role: v.optional(v.string(), \"user\"),\n});\n\n// Output type (after transformations and defaults)\ntype User = v.InferOutput<typeof UserSchema>;\n// { name: string; age: number; role: string }\n\n// Input type (before transformations)\ntype UserInput = v.InferInput<typeof UserSchema>;\n// { name: string; age: string; role?: string | undefined }\n\n// Issue type\ntype UserIssue = v.InferIssue<typeof UserSchema>;\n```\n\n## Error Handling\n\n### Custom Error Messages\n\n```typescript\nconst LoginSchema = v.object({\n  email: v.pipe(\n    v.string(\"Email must be a string\"),\n    v.nonEmpty(\"Please enter your email\"),\n    v.email(\"Invalid email format\"),\n  ),\n  password: v.pipe(\n    v.string(\"Password must be a string\"),\n    v.nonEmpty(\"Please enter your password\"),\n    v.minLength(8, \"Password must be at least 8 characters\"),\n  ),\n});\n```\n\n### Flattening Errors\n\n```typescript\nconst result = v.safeParse(LoginSchema, data);\n\nif (!result.success) {\n  const flat = v.flatten(result.issues);\n  // { nested: { email: ['Invalid email format'], password: ['...'] } }\n}\n```\n\n### Issue Structure\n\nEach issue contains:\n\n- `kind`: 'schema' | 'validation' | 'transformation'\n- `type`: Function name (e.g., 'string', 'email', 'min_length')\n- `input`: The problematic input\n- `expected`: What was expected\n- `received`: What was received\n- `message`: Human-readable message\n- `path`: Array of path items for nested issues\n\n## Fallback Values\n\n```typescript\n// Static fallback\nconst NumberSchema = v.fallback(v.number(), 0);\nv.parse(NumberSchema, \"invalid\"); // Returns 0\n\n// Dynamic fallback\nconst DateSchema = v.fallback(v.date(), () => new Date());\n```\n\n## Recursive Schemas\n\n```typescript\nimport * as v from \"valibot\";\n\ntype TreeNode = {\n  value: string;\n  children: TreeNode[];\n};\n\nconst TreeNodeSchema: v.GenericSchema<TreeNode> = v.object({\n  value: v.string(),\n  children: v.lazy(() => v.array(TreeNodeSchema)),\n});\n```\n\n## Async Validation\n\nFor async operations (e.g., database checks), use async variants:\n\n```typescript\nimport * as v from \"valibot\";\n\nconst isUsernameAvailable = async (username: string) => {\n  // Check database\n  return true;\n};\n\nconst UsernameSchema = v.pipeAsync(\n  v.string(),\n  v.minLength(3),\n  v.checkAsync(isUsernameAvailable, \"Username is already taken\"),\n);\n\n// Must use parseAsync\nconst username = await v.parseAsync(UsernameSchema, \"john\");\n```\n\n## JSON Schema Conversion\n\n```typescript\nimport { toJsonSchema } from \"@valibot/to-json-schema\";\nimport * as v from \"valibot\";\n\nconst EmailSchema = v.pipe(v.string(), v.email());\nconst jsonSchema = toJsonSchema(EmailSchema);\n// { type: 'string', format: 'email' }\n```\n\n## Naming Conventions\n\n### Convention 1: Same Name (Recommended for simplicity)\n\n```typescript\nexport const User = v.object({\n  name: v.string(),\n  email: v.pipe(v.string(), v.email()),\n});\n\nexport type User = v.InferOutput<typeof User>;\n\n// Usage\nconst users: User[] = [];\nusers.push(v.parse(User, data));\n```\n\n### Convention 2: With Suffixes (Recommended when input/output differ)\n\n```typescript\nexport const UserSchema = v.object({\n  name: v.string(),\n  age: v.pipe(v.string(), v.transform(Number)),\n});\n\nexport type UserInput = v.InferInput<typeof UserSchema>;\nexport type UserOutput = v.InferOutput<typeof UserSchema>;\n```\n\n## Common Patterns\n\n### Login Form\n\n```typescript\nconst LoginSchema = v.object({\n  email: v.pipe(\n    v.string(),\n    v.nonEmpty(\"Please enter your email\"),\n    v.email(\"Invalid email address\"),\n  ),\n  password: v.pipe(\n    v.string(),\n    v.nonEmpty(\"Please enter your password\"),\n    v.minLength(8, \"Password must be at least 8 characters\"),\n  ),\n});\n```\n\n### API Response\n\n```typescript\nconst ApiResponseSchema = v.variant(\"status\", [\n  v.object({\n    status: v.literal(\"success\"),\n    data: v.unknown(),\n  }),\n  v.object({\n    status: v.literal(\"error\"),\n    error: v.object({\n      code: v.string(),\n      message: v.string(),\n    }),\n  }),\n]);\n```\n\n### Environment Variables\n\n```typescript\nconst EnvSchema = v.object({\n  NODE_ENV: v.picklist([\"development\", \"production\", \"test\"]),\n  PORT: v.pipe(v.string(), v.transform(Number), v.integer(), v.minValue(1)),\n  DATABASE_URL: v.pipe(v.string(), v.url()),\n  API_KEY: v.pipe(v.string(), v.minLength(32)),\n});\n\nconst env = v.parse(EnvSchema, process.env);\n```\n\n### Date Handling\n\n```typescript\n// String to Date\nconst DateFromStringSchema = v.pipe(\n  v.string(),\n  v.isoDate(),\n  v.transform((input) => new Date(input)),\n);\n\n// Date validation\nconst FutureDateSchema = v.pipe(\n  v.date(),\n  v.minValue(new Date(), \"Date must be in the future\"),\n);\n```\n\n## Additional Resources\n\n- [Valibot Documentation](https://valibot.dev)\n- [Valibot GitHub](https://github.com/open-circle/valibot)\n- [API Reference](https://valibot.dev/api/)\n- [Migration from Zod](https://valibot.dev/guides/migrate-from-zod/)\n"},"files":{".agents/skills/repo-source-code-document/SKILL.md":"---\nname: repo-source-code-document\ndescription: Write JSDoc comments and inline documentation for Valibot library source code in /library/src/. Use when documenting schemas, actions, methods, or utilities. Covers interface documentation, function overloads, purity annotations, inline comment patterns, and terminology consistency.\n---\n\n# Valibot Source Code Documentation\n\nDocumentation patterns for library source code in `/library/src/`.\n\n## JSDoc Patterns\n\n### Interface Documentation\n\n```typescript\n/**\n * String issue interface.\n */\nexport interface StringIssue extends BaseIssue<unknown> {\n  /**\n   * The issue kind.\n   */\n  readonly kind: 'schema';\n  /**\n   * The issue type.\n   */\n  readonly type: 'string';\n}\n```\n\n**Rules:**\n\n- First line: `[Name] [category] interface.` (e.g., \"String issue interface.\")\n- Property comments: `The [description].` (always start with \"The\", end with period)\n- All properties use `readonly`\n- No blank lines between property and its comment\n\n### Variance Annotations\n\nInterfaces in `/library/src/types/` annotate every generic and explain it with a hint:\n\n```typescript\n/**\n * Success dataset interface.\n *\n * Hint: The explicit variance annotations of the generics spare TypeScript\n * from measuring the variance of this interface (see issue #1663).\n */\nexport interface SuccessDataset<out TValue> {}\n```\n\n**Rules:**\n\n- `out` or `in`, whichever `tsc` accepts, and `in out` only if it rejects both (give the reason in the hint)\n- Not for interfaces in `schemas/`, `actions/` or `methods/`\n\n### Function Overloads\n\nEach overload gets its own complete JSDoc:\n\n```typescript\n/**\n * Creates a string schema.\n *\n * @returns A string schema.\n */\nexport function string(): StringSchema<undefined>;\n\n/**\n * Creates a string schema.\n *\n * @param message The error message.\n *\n * @returns A string schema.\n */\nexport function string<\n  const TMessage extends ErrorMessage<StringIssue> | undefined,\n>(message: TMessage): StringSchema<TMessage>;\n```\n\n**Rules:**\n\n- First line: `Creates a [name] [category].` (use \"a\" vs \"an\" correctly)\n- Blank line after description\n- `@param name The [description].` (start with \"The\", end with period)\n- Blank line after params\n- `@returns A [name] [category].` or `@returns The [description].`\n\n### Hints\n\nAdd hints after the main description, before `@param`:\n\n```typescript\n/**\n * Creates an object schema.\n *\n * Hint: This schema removes unknown entries. To include unknown entries, use\n * `looseObject`. To reject unknown entries, use `strictObject`.\n *\n * @param entries The entries schema.\n *\n * @returns An object schema.\n */\n```\n\n### Links\n\nLink to external resources when relevant using markdown format:\n\n```typescript\n/**\n * Creates an [email](https://en.wikipedia.org/wiki/Email_address) validation action.\n */\n```\n\n### Implementation Function\n\nThe implementation has **NO JSDoc** but uses `// @__NO_SIDE_EFFECTS__`:\n\n```typescript\n// @__NO_SIDE_EFFECTS__\nexport function string(\n  message?: ErrorMessage<StringIssue>\n): StringSchema<ErrorMessage<StringIssue> | undefined> {\n  return {\n    /* ... */\n  };\n}\n```\n\n**`// @__NO_SIDE_EFFECTS__` rules:**\n\n- Add for pure functions (no external state mutation, no I/O)\n- Most schema/action/method factories are pure\n- **Do NOT add** for functions that mutate arguments (like `_addIssue`)\n- Used by bundlers for tree-shaking\n\n### Utility Functions\n\n```typescript\n/**\n * Stringifies an unknown input to a literal or type string.\n *\n * @param input The unknown input.\n *\n * @returns A literal or type string.\n *\n * @internal\n */\n// @__NO_SIDE_EFFECTS__\nexport function _stringify(input: unknown): string {\n  // ...\n}\n```\n\n**Rules:**\n\n- Use `@internal` tag for internal utilities\n- Prefix internal functions with `_`\n- Only add `// @__NO_SIDE_EFFECTS__` if function is pure\n\n## Inline Comment Patterns\n\n### Section Headers\n\n```typescript\n'~run'(dataset, config) {\n  // Get input value from dataset\n  const input = dataset.value;\n\n  // If root type is valid, check nested types\n  if (Array.isArray(input)) {\n    // Set typed to true and value to empty array\n    dataset.typed = true;\n    dataset.value = [];\n\n    // Parse schema of each array item\n    for (let key = 0; key < input.length; key++) {\n      // ...\n    }\n  }\n}\n```\n\n**Rules:**\n\n- Describe WHAT the next code block does\n- Present tense verbs: \"Get\", \"Parse\", \"Check\", \"Set\", \"Add\", \"Create\"\n- **Omit articles** (\"the\", \"a\", \"an\"): \"Get input value\" not \"Get the input value\"\n- No period at end\n- Blank line before comment, no blank line after\n\n### Conditional Logic\n\n```typescript\n// If root type is valid, check nested types\nif (input && typeof input === 'object') {\n  // ...\n}\n\n// Otherwise, add issue\nelse {\n  _addIssue(this, 'type', dataset, config);\n}\n```\n\n**Rules:**\n\n- Use \"If [condition], [action]\"\n- Use \"Otherwise, [action]\" for else branches\n- Omit articles\n\n### Hint Comments (Exception)\n\n```typescript\n// Hint: The issue is deliberately not constructed with the spread operator\n// for performance reasons\nconst issue: BaseIssue<unknown> = {\n  /* ... */\n};\n```\n\n**Rules:**\n\n- Start with \"Hint:\"\n- Explain WHY, not just what\n- **CAN use articles** (unlike other inline comments)\n- Document performance decisions, non-obvious logic\n\n### TODO Comments\n\n```typescript\n// TODO: Should we add \"n\" suffix to bigints?\nif (type === 'bigint') {\n  /* ... */\n}\n```\n\n### @ts-expect-error\n\nUsed for internal dataset mutations TypeScript can't track:\n\n```typescript\n// @ts-expect-error\ndataset.typed = true;\n```\n\n## File Type Patterns\n\n### Schema Files (`string.ts`, `object.ts`, etc.)\n\n1. Issue interface with JSDoc\n2. Schema interface with JSDoc\n3. Function overloads with full JSDoc each\n4. Implementation with `// @__NO_SIDE_EFFECTS__`\n5. Return object with `'~run'` method containing inline comments\n\n### Action Files (`email.ts`, `minLength.ts`, etc.)\n\n1. Issue interface (for validation actions)\n2. Action interface with JSDoc\n3. Function overloads with JSDoc\n4. Implementation with `// @__NO_SIDE_EFFECTS__`\n\n### Method Files (`parse.ts`, `pipe.ts`, etc.)\n\nMore complex logic, require more inline comments.\n\n### Utility Files (`_addIssue.ts`, `_stringify.ts`)\n\n1. Single function with JSDoc including `@internal`\n2. `// @__NO_SIDE_EFFECTS__` only if pure\n\n## Terminology Consistency\n\nJSDoc descriptions must match the `kind` property if present:\n\n| `kind` Property    | JSDoc Wording                          |\n| ------------------ | -------------------------------------- |\n| `'schema'`         | \"Creates a ... schema.\"                |\n| `'validation'`     | \"Creates a ... validation action.\"     |\n| `'transformation'` | \"Creates a ... transformation action.\" |\n\n## Quick Reference\n\n### JSDoc First Lines\n\n| Type      | Pattern                        |\n| --------- | ------------------------------ |\n| Interface | `[Name] [category] interface.` |\n| Type      | `[Name] [category] type.`      |\n| Function  | `Creates a [name] [category].` |\n| Utility   | `[Verb]s [description].`       |\n\n### Inline Comment Starters\n\n| Pattern                        | Example                                        |\n| ------------------------------ | ---------------------------------------------- |\n| `// Get [what]`                | `// Get input value from dataset`              |\n| `// If [condition], [action]`  | `// If root type is valid, check nested types` |\n| `// Otherwise, [action]`       | `// Otherwise, add issue`                      |\n| `// Create [what]`             | `// Create object path item`                   |\n| `// Add [what] to [where]`     | `// Add issues to dataset`                     |\n| `// Parse [what]`              | `// Parse schema of each array item`           |\n| `// Set [property] to [value]` | `// Set typed to true`                         |\n| `// Hint: [explanation]`       | `// Hint: This is for performance`             |\n| `// TODO: [task]`              | `// TODO: Add bigint suffix`                   |\n\n## Terminology\n\nUse consistently:\n\n- **Schema** (not \"validator\")\n- **Action** (not \"validation\" for the object)\n- **Issue** (not \"error\" in type names)\n- **Dataset** (internal data structure)\n- **Config/Configuration** (not \"options\")\n\n## Checklist\n\n- [ ] Interfaces: `[Name] [category] interface.`\n- [ ] Properties: `The [description].`\n- [ ] `types/` interfaces: Variance annotations with hint\n- [ ] Overloads: Complete JSDoc each\n- [ ] Implementation: NO JSDoc\n- [ ] Pure functions: `// @__NO_SIDE_EFFECTS__`\n- [ ] Impure functions (mutate args): NO `@__NO_SIDE_EFFECTS__`\n- [ ] Internal utilities: `@internal` tag\n- [ ] Inline comments: No articles (except Hint), no periods\n- [ ] JSDoc comments: End with periods\n",".agents/skills/repo-source-code-review/SKILL.md":"---\nname: repo-source-code-review\ndescription: Review pull requests and source code changes in /library/src/. Use when reviewing PRs, validating implementation patterns, or checking code quality before merging. Covers code quality checks, type safety, documentation review, test coverage, and common issues to watch for.\n---\n\n# Reviewing Source Code Changes\n\nGuide for reviewing PRs and source code changes in `/library/src/`.\n\n## When to Use This Guide\n\n- Reviewing pull requests modifying library source\n- Validating implementation patterns before merging\n- Checking code quality, types, documentation, and tests\n\n## Review Process\n\n1. **Understand the change** — Read PR description, identify affected files\n2. **Check patterns** — Verify code follows existing conventions\n3. **Verify types** — Ensure type safety and proper inference\n4. **Review docs** — Confirm JSDoc is complete and accurate\n5. **Check tests** — Validate runtime and type test coverage\n\n## What to Review\n\n### Code Quality\n\n| Check             | Requirement                                                           |\n| ----------------- | --------------------------------------------------------------------- |\n| Naming            | Matches existing patterns (`StringSchema`, `minLength`, `_parse`)     |\n| Purity annotation | `// @__NO_SIDE_EFFECTS__` before pure factory functions               |\n| Import extensions | All imports use `.ts` extension                                       |\n| Interface vs type | Use `interface` for object shapes, `type` for unions/aliases          |\n| Folder structure  | Each API has: `name.ts`, `name.test.ts`, `name.test-d.ts`, `index.ts` |\n\n**Good — purity annotation:**\n\n```typescript\n// @__NO_SIDE_EFFECTS__\nexport function string(message?: ErrorMessage<StringIssue>): StringSchema {\n  return {\n    /* ... */\n  };\n}\n```\n\n**Bad — missing annotation:**\n\n```typescript\nexport function string(message?: ErrorMessage<StringIssue>): StringSchema {\n  return {\n    /* ... */\n  };\n}\n```\n\n### Type Safety\n\n| Check             | Requirement                                           |\n| ----------------- | ----------------------------------------------------- |\n| Generic inference | Types infer correctly without explicit annotations    |\n| Constraints       | Generic parameters have appropriate `extends` clauses |\n| Return types      | Explicit return types on exported functions           |\n| Type tests        | `.test-d.ts` file covers type inference scenarios     |\n| Variance          | Interfaces in `types/` annotate every generic         |\n\n**Good — constrained generic:**\n\n```typescript\nexport function minLength<\n  TInput extends LengthInput,\n  TRequirement extends number,\n>(\n  requirement: TRequirement,\n  message?: ErrorMessage<MinLengthIssue<TInput, TRequirement>>\n): MinLengthAction<TInput, TRequirement>;\n```\n\n### Documentation\n\n| Check          | Requirement                                       |\n| -------------- | ------------------------------------------------- |\n| JSDoc present  | All exported functions have JSDoc                 |\n| First line     | Action verb matching function purpose (see below) |\n| `@param` tags  | Every parameter documented                        |\n| `@returns` tag | Return value documented                           |\n| Overloads      | Every overload has its own complete JSDoc block   |\n\n**First line patterns by category:**\n\n| Category       | Pattern                                        |\n| -------------- | ---------------------------------------------- |\n| Schemas        | `Creates a ... schema.`                        |\n| Actions        | `Creates a ... action.`                        |\n| Parse methods  | `Parses ...`                                   |\n| Type guards    | `Checks if ...`                                |\n| Unwrap methods | `Unwraps ...`                                  |\n| Other methods  | `Creates a ...`, `Returns ...`, `Forwards ...` |\n\nSee `repo-source-code-document` skill for full documentation rules.\n\n### Tests\n\n| Check          | Requirement                                                |\n| -------------- | ---------------------------------------------------------- |\n| Runtime tests  | `.test.ts` covers success cases, failure cases, edge cases |\n| Type tests     | `.test-d.ts` validates type inference with `expectTypeOf`  |\n| Issue messages | Tests verify correct error messages and issue structure    |\n\n## Common Issues\n\n| Issue                     | What to Look For                                             |\n| ------------------------- | ------------------------------------------------------------ |\n| Missing purity annotation | Factory function without `// @__NO_SIDE_EFFECTS__`           |\n| Incomplete JSDoc          | Missing `@param` or `@returns`, wrong description format     |\n| No type tests             | New API without `.test-d.ts` file                            |\n| Wrong import extension    | Imports without `.ts` suffix                                 |\n| Inconsistent naming       | Schema not ending in `Schema`, action not ending in `Action` |\n| Side effects in pure code | Mutations, I/O, or global state in schema/action creation    |\n\n## Checklist\n\n- [ ] Implementation follows existing patterns in similar files\n- [ ] `// @__NO_SIDE_EFFECTS__` on pure factory functions\n- [ ] All imports use `.ts` extension\n- [ ] `interface` used for object shapes\n- [ ] JSDoc complete on all exports\n- [ ] Runtime tests in `.test.ts`\n- [ ] Type tests in `.test-d.ts`\n- [ ] Naming conventions followed\n- [ ] Variance annotations on generics of `types/` interfaces\n\n## Related Skills\n\n- `repo-structure-navigate` — Navigate the codebase\n- `repo-source-code-document` — JSDoc requirements\n",".agents/skills/repo-structure-navigate/SKILL.md":"---\nname: repo-structure-navigate\ndescription: Navigate the Valibot repository structure. Use when looking for files, understanding the codebase layout, finding schema/action/method implementations, locating tests, API docs, or guide pages. Covers monorepo layout, library architecture, file naming conventions, and quick lookups.\n---\n\n# Valibot Repository Structure\n\n## Monorepo Layout\n\n```\nvalibot/\n├── library/          # Core valibot package (zero dependencies)\n├── packages/\n│   ├── i18n/         # Translated error messages (25+ languages)\n│   └── to-json-schema/  # JSON Schema converter\n├── codemod/\n│   ├── migrate-to-v0.31.0/  # Version migration\n│   └── zod-to-valibot/      # Zod converter\n├── website/          # valibot.dev (Qwik + Vite)\n├── brand/            # Brand assets\n├── skills/           # Agent skills (this folder)\n└── prompts/          # Legacy AI agent guides\n```\n\n## Core Library (`/library/src/`)\n\n### Directory Structure\n\n| Directory   | Purpose                         | Examples                                      |\n| ----------- | ------------------------------- | --------------------------------------------- |\n| `schemas/`  | Data type validators            | `string/`, `object/`, `array/`, `union/`      |\n| `actions/`  | Validation & transformation     | `email/`, `minLength/`, `trim/`, `transform/` |\n| `methods/`  | High-level API                  | `parse/`, `safeParse/`, `pipe/`, `partial/`   |\n| `types/`    | TypeScript definitions          | `schema.ts`, `issue.ts`, `dataset.ts`         |\n| `utils/`    | Internal helpers (prefixed `_`) | `_addIssue/`, `_stringify/`, `ValiError/`     |\n| `storages/` | Global state                    | Config, message storage                       |\n\n### Schema Categories\n\n- **Primitives**: `string`, `number`, `boolean`, `bigint`, `date`, `symbol`, `blob`, `file`\n- **Objects**: `object`, `strictObject`, `looseObject`, `objectWithRest`\n- **Arrays**: `array`, `tuple`, `strictTuple`, `looseTuple`, `tupleWithRest`\n- **Advanced**: `union`, `variant`, `intersect`, `record`, `map`, `set`, `lazy`, `custom`\n- **Modifiers**: `optional`, `nullable`, `nullish`, `nonNullable`, `nonNullish`, `nonOptional`\n\n### Action Types\n\n**Validation** (return issues): `email`, `url`, `uuid`, `regex`, `minLength`, `maxValue`, `check`\n\n**Transformation** (modify data): `trim`, `toLowerCase`, `toUpperCase`, `mapItems`, `transform`\n\n**Metadata**: `brand`, `flavor`, `metadata`, `description`, `title`\n\n### File Naming Convention\n\nEach schema/action/method has its own directory:\n\n```\nschemas/string/\n├── string.ts        # Implementation\n├── string.test.ts   # Runtime tests\n├── string.test-d.ts # Type tests\n└── index.ts         # Re-export\n```\n\n### Core Patterns\n\n**Schemas** define data types:\n\n```typescript\nexport interface StringSchema<TMessage> extends BaseSchema<...> {\n  readonly kind: 'schema';\n  readonly type: 'string';\n  // ...\n}\n```\n\n**Actions** validate/transform in pipelines:\n\n```typescript\nexport interface EmailAction<TInput, TMessage> extends BaseValidation<...> {\n  readonly kind: 'validation';\n  readonly type: 'email';\n  // ...\n}\n```\n\n**Methods** provide API functions:\n\n```typescript\nexport function parse<TSchema>(\n  schema: TSchema,\n  input: unknown\n): InferOutput<TSchema>;\n```\n\n### Key Types\n\n- `BaseSchema`, `BaseValidation`, `BaseTransformation` - Base interfaces\n- `InferOutput<T>`, `InferInput<T>`, `InferIssue<T>` - Type inference\n- `Config`, `ErrorMessage<T>`, `BaseIssue<T>` - Configuration and errors\n- `'~standard'` property - [Standard Schema](https://github.com/standard-schema/standard-schema) compatibility\n\n## Website (`/website/src/routes/`)\n\n### API Documentation\n\n```\nroutes/api/\n├── (schemas)/string/     # Schema docs\n│   ├── index.mdx         # MDX content\n│   └── properties.ts     # Type definitions\n├── (actions)/email/      # Action docs\n├── (methods)/parse/      # Method docs\n├── (types)/StringSchema/ # Type docs\n└── menu.md               # Navigation\n```\n\n### Guides\n\n```\nroutes/guides/\n├── (get-started)/       # Intro, installation\n├── (main-concepts)/     # Schemas, pipelines, parsing\n├── (schemas)/           # Objects, arrays, unions\n├── (advanced)/          # Async, i18n, JSON Schema\n├── (migration)/         # Version upgrades\n└── menu.md              # Navigation\n```\n\n## Development\n\n### Playground\n\nUse `library/playground.ts` for quick experimentation.\n\n### Adding a Schema/Action\n\n1. Create directory: `library/src/schemas/yourSchema/`\n2. Create files: `yourSchema.ts`, `yourSchema.test.ts`, `yourSchema.test-d.ts`, `index.ts`\n3. Follow existing patterns (copy similar implementation)\n4. Export from category `index.ts`\n5. Run `pnpm -C library test`\n\n### Modifying Core Types\n\n⚠️ Changes to `library/src/types/` affect the entire library. Always run full test suite.\n\n## Quick Lookups\n\n| Looking for...        | Location                                       |\n| --------------------- | ---------------------------------------------- |\n| Schema implementation | `library/src/schemas/[name]/[name].ts`         |\n| Action implementation | `library/src/actions/[name]/[name].ts`         |\n| Method implementation | `library/src/methods/[name]/[name].ts`         |\n| Type definitions      | `library/src/types/`                           |\n| Internal utilities    | `library/src/utils/`                           |\n| Error messages (i18n) | `packages/i18n/[lang]/`                        |\n| API docs page         | `website/src/routes/api/(category)/[name]/`    |\n| Guide page            | `website/src/routes/guides/(category)/[name]/` |\n| Tests                 | Same directory as source, `.test.ts` suffix    |\n| Type tests            | Same directory as source, `.test-d.ts` suffix  |\n\n## Commands\n\n```bash\n# Library\npnpm -C library build      # Build\npnpm -C library test       # Run tests\npnpm -C library lint       # Lint\npnpm -C library format     # Format\n\n# Website\npnpm -C website dev        # Dev server\npnpm -C website build      # Production build\n\n# Root\npnpm install               # Install all\npnpm format                # Format all\n```\n\n## Key Principles\n\n1. **Modularity** - Small, focused functions; one per file\n2. **Zero dependencies** - Core library has no runtime deps\n3. **100% test coverage** - Required for library\n4. **Tree-shakable** - Use `// @__NO_SIDE_EFFECTS__` annotation\n5. **Type-safe** - Full TypeScript with strict mode\n6. **ESM only** - Imports include `.ts` extensions\n\n## Do's and Don'ts\n\n**Do:**\n\n- Follow existing code patterns\n- Write runtime and type tests\n- Add JSDoc documentation\n- Keep functions small and focused\n- Check bundle size impact\n\n**Don't:**\n\n- Add external dependencies\n- Modify core types without full test run\n- Skip tests\n- Create large multi-purpose functions\n- Modify generated files (`dist/`, `coverage/`)\n",".agents/skills/repo-website-api-create/SKILL.md":"---\nname: repo-website-api-create\ndescription: Create new API reference pages for the Valibot website at website/src/routes/api/. Use when adding documentation for new schemas, actions, methods, or types. Covers reading source code, creating properties.ts and index.mdx files, updating menu.md, and cross-referencing related APIs.\n---\n\n# Adding API Documentation to Website\n\nGuide for creating new API reference pages at `website/src/routes/api/`.\n\n## Process Overview\n\n1. Read source code in `/library/src/`\n2. Create folder in `/website/src/routes/api/(category)/[name]/`\n3. Create `properties.ts` with type definitions\n4. Create `index.mdx` with documentation\n5. Update `menu.md`\n6. Create type documentation if needed (Issue, Schema/Action interfaces)\n\n## File Structure\n\n```\nwebsite/src/routes/api/\n├── (schemas)/string/\n│   ├── index.mdx        # Documentation content\n│   └── properties.ts    # Type definitions for Property component\n├── (actions)/email/\n├── (methods)/parse/\n├── (types)/StringSchema/\n└── menu.md              # Navigation (alphabetical order)\n```\n\nCategories: `(schemas)`, `(actions)`, `(methods)`, `(types)`, `(utils)`, `(async)`, `(storages)`\n\n## Reading Source Code\n\n### What to Extract\n\nFrom `/library/src/schemas/string/string.ts`:\n\n```typescript\n// 1. Issue interface → Document in (types)/StringIssue/\nexport interface StringIssue extends BaseIssue<unknown> { ... }\n\n// 2. Schema interface → Document in (types)/StringSchema/\nexport interface StringSchema<TMessage extends ErrorMessage<StringIssue> | undefined>\n  extends BaseSchema<string, string, StringIssue> { ... }\n\n// 3. Function overloads → Main documentation\nexport function string(): StringSchema<undefined>;\nexport function string<const TMessage>(message: TMessage): StringSchema<TMessage>;\n\n// 4. JSDoc → Description, hints, parameter docs\n/**\n * Creates a string schema.\n *\n * Hint: This is an example hint.\n *\n * @param message The error message.\n *\n * @returns A string schema.\n */\n```\n\n**JSDoc hints** become blockquotes in the Explanation section:\n\n```mdx\n> This is an example hint.\n```\n\n### Extract for properties.ts\n\n- Generic parameters and constraints (e.g., `TMessage extends ErrorMessage<...> | undefined`)\n- Function parameters and types\n- Return type\n\n## properties.ts\n\nImport and define properties matching source code:\n\n```typescript\nimport type { PropertyProps } from '~/components';\n\nexport const properties: Record<string, PropertyProps> = {\n  // Generics (use modifier: 'extends')\n  TMessage: {\n    modifier: 'extends',\n    type: {\n      type: 'union',\n      options: [\n        {\n          type: 'custom',\n          name: 'ErrorMessage',\n          href: '../ErrorMessage/',\n          generics: [\n            { type: 'custom', name: 'StringIssue', href: '../StringIssue/' },\n          ],\n        },\n        'undefined',\n      ],\n    },\n  },\n\n  // Parameters (reference generic or direct type)\n  message: {\n    type: { type: 'custom', name: 'TMessage' },\n  },\n\n  // Return type\n  Schema: {\n    type: {\n      type: 'custom',\n      name: 'StringSchema',\n      href: '../StringSchema/',\n      generics: [{ type: 'custom', name: 'TMessage' }],\n    },\n  },\n};\n```\n\n### Optional Object Keys\n\nFor optional object keys from TypeScript source such as `key?: string`, do not append `?` to the property name in `properties.ts`.\n\nUse the plain key name and represent optionality in the value type with `undefined` as the last union option:\n\n```typescript\npayload: {\n  type: {\n    type: 'object',\n    entries: [\n      {\n        key: 'key',\n        value: {\n          type: 'union',\n          options: ['string', 'undefined'],\n        },\n      },\n    ],\n  },\n},\n```\n\n### DefinitionData Types\n\n| Type            | Syntax                                                                         |\n| --------------- | ------------------------------------------------------------------------------ |\n| Primitive       | `'string'`, `'number'`, `'boolean'`, `'unknown'`, etc.                         |\n| Literal string  | `{ type: 'string', value: 'email' }`                                           |\n| Literal number  | `{ type: 'number', value: 5 }`                                                 |\n| Custom/Named    | `{ type: 'custom', name: 'TypeName', href: '../TypeName/', generics: [...] }`  |\n| Custom+modifier | `{ type: 'custom', modifier: 'typeof', name: 'string', href: '../string/' }`   |\n| Union           | `{ type: 'union', options: [type1, type2] }`                                   |\n| Intersect       | `{ type: 'intersect', options: [type1, type2] }`                               |\n| Array           | `{ type: 'array', item: elementType }`                                         |\n| Tuple           | `{ type: 'tuple', items: [type1, type2] }`                                     |\n| Object          | `{ type: 'object', entries: [{ key: 'name', value: type }] }`                   |\n| Function        | `{ type: 'function', params: [{ name: 'x', type: t }], return: retType }`      |\n| Template        | `{ type: 'template', parts: [{ type: 'string', value: '>=' }, otherType] }`    |\n\n## index.mdx Template\n\n```mdx\n---\ntitle: functionName\ndescription: One-line description from JSDoc.\nsource: /schemas/string/string.ts\ncontributors:\n  - github-username\n---\n\nimport { ApiList, Property } from '~/components';\nimport { properties } from './properties';\n\n# functionName\n\nCreates a string schema.\n\n\\`\\`\\`ts\nconst Schema = v.functionName<TMessage>(message);\n\\`\\`\\`\n\n## Generics\n\n- \\`TMessage\\` <Property {...properties.TMessage} />\n\n## Parameters\n\n- \\`message\\` <Property {...properties.message} />\n\n### Explanation\n\nWith \\`functionName\\` you can validate... If the input does not match, you can use \\`message\\` to customize the error message.\n\n## Returns\n\n- \\`Schema\\` <Property {...properties.Schema} />\n\n## Examples\n\nThe following examples show how \\`functionName\\` can be used.\n\n### Email schema\n\nSchema to validate an email.\n\n\\`\\`\\`ts\nconst EmailSchema = v.pipe(\nv.string(),\nv.nonEmpty('Please enter your email.'),\nv.email('The email is badly formatted.')\n);\n\\`\\`\\`\n\n## Related\n\nThe following APIs can be combined with \\`functionName\\`.\n\n### Schemas\n\n<ApiList items={['array', 'object', 'string']} />\n\n### Methods\n\n<ApiList items={['parse', 'pipe', 'safeParse']} />\n\n### Actions\n\n<ApiList items={['email', 'minLength']} />\n\n### Utils\n\n<ApiList items={['isOfKind', 'isOfType']} />\n```\n\n**Related section order:** Schemas → Methods → Actions → Utils (omit empty sections)\n\n## Key Conventions\n\n### Naming\n\n- Schema variables: `PascalCase` + `Schema` suffix: `EmailSchema`, `UserSchema`\n- Action variables: `PascalCase` + `Action`: `MinLengthAction`\n- Parse output: `output` or descriptive name\n\n### Examples\n\n- Always include error messages for validation actions\n- Progress from simple to complex\n- Use realistic, practical scenarios\n- Start with `import * as v from 'valibot';` pattern\n\n### Error Messages\n\nUse friendly, actionable messages:\n\n- ✅ \"Your password is too short.\"\n- ✅ \"Please enter your email.\"\n- ❌ \"Invalid\" or \"Error\"\n\n### Links\n\n- Use `href: '../TypeName/'` for type references (with trailing slash)\n- Use `<Link href=\"/api/parse/\">\\`parse\\`</Link>`in MDX prose (import from`~/components`)\n- Link to related guides when relevant: `<Link href=\"/guides/objects/\">object guide</Link>`\n\n## Update Related Files\n\n### menu.md\n\nAdd alphabetically to `/website/src/routes/api/menu.md`:\n\n```markdown\n## Schemas\n\n- [any](/api/any/)\n- [newSchema](/api/newSchema/) ← Add here\n- [string](/api/string/)\n```\n\n### Related Sections of Other API Docs\n\nExisting API pages have a `## Related` section with `<ApiList>` components. When adding a new API, update related APIs to include the new one.\n\n**Rule:** An API is \"related\" if:\n\n- It makes sense to use it as an argument of the other API, or vice versa\n- It makes sense to use them together in the same `pipe` (e.g., `v.pipe(v.string(), v.email())` → `string` and `email` are related)\n\nExamples:\n\n- `string` schema lists `email` action because they work together in a pipe\n- `email` action lists `string` schema because it validates string input\n- `pipe` method lists all schemas because any schema can be piped\n- `minLength` action lists `string`, `array`, `tuple` because it validates their length\n\n**Process:**\n\n1. Review a few existing API docs in the same category to understand the pattern\n2. Check `menu.md` to identify potentially related APIs\n3. For each related API, edit its `index.mdx` and add the new API to the appropriate `<ApiList>`\n\n**Shortcut:** If your new API is very similar to an existing one (e.g., `guard` is similar to `check`), add it everywhere the similar API appears. This ensures consistent coverage across all related docs.\n\n### Concept Guides\n\nAdd the new API to the appropriate guide in `/website/src/routes/guides/`:\n\n| API Category | Guide to Update                       |\n| ------------ | ------------------------------------- |\n| Schema       | `(main-concepts)/schemas/index.mdx`   |\n| Action       | `(main-concepts)/pipelines/index.mdx` |\n| Method       | `(main-concepts)/methods/index.mdx`   |\n\nAlso update topic-specific guides if relevant (e.g., `(schemas)/objects/`, `(schemas)/arrays/`, `(advanced)/async/`).\n\n### Type Documentation\n\nCreate pages for new types in `(types)/`:\n\n- Issue interfaces (e.g., `StringIssue`)\n- Schema/Action interfaces (e.g., `StringSchema`)\n\nType pages differ from function docs:\n\n- **No `source` field** in frontmatter\n- **No Examples or Related sections**\n- Use `## Definition` instead of `## Returns`\n\nType page structure:\n\n```mdx\n---\ntitle: StringSchema\ndescription: String schema interface.\ncontributors:\n  - github-username\n---\n\nimport { Property } from '~/components';\nimport { properties } from './properties';\n\n# StringSchema\n\nString schema interface.\n\n## Generics\n\n- \\`TMessage\\` <Property {...properties.TMessage} />\n\n## Definition\n\n- \\`StringSchema\\` <Property {...properties.BaseSchema} />\n  - \\`type\\` <Property {...properties.type} />\n  - \\`reference\\` <Property {...properties.reference} />\n  - \\`expects\\` <Property {...properties.expects} />\n  - \\`message\\` <Property {...properties.message} />\n```\n\n## Checklist\n\n- [ ] Read source file completely\n- [ ] `properties.ts` matches source types exactly\n- [ ] `index.mdx` signature matches source\n- [ ] All generics documented\n- [ ] All parameters documented\n- [ ] Examples are realistic with error messages\n- [ ] `menu.md` updated (alphabetically)\n- [ ] Related type pages created if needed\n- [ ] Related API docs updated (add new API to their `## Related` sections)\n- [ ] Concept guide updated (schemas/pipelines/methods)\n- [ ] All `href` links valid with trailing slashes\n",".agents/skills/repo-website-api-update/SKILL.md":"---\nname: repo-website-api-update\ndescription: Update existing API documentation pages after source code changes. Use when syncing docs with library changes like new parameters, type constraint changes, interface updates, or function renames. Covers common change patterns and verification steps.\n---\n\n# Updating API Documentation\n\nGuide for syncing API docs with source code changes.\n\n**Prerequisite:** Read the `repo-website-api-create` skill for `properties.ts` and `index.mdx` patterns.\n\n## When to Update\n\nUpdate documentation when source code changes:\n\n- Function signatures (parameters, generics, return types)\n- Interface properties\n- JSDoc descriptions or hints\n- Behavior changes affecting examples\n\n**Do NOT update for:** Internal implementation changes (`~run` method), test changes, non-JSDoc comments.\n\n## Process\n\n1. **Read full source file** - Don't just look at diff; understand complete current state\n2. **Identify changes** - Categorize as addition, removal, or modification\n3. **Update `properties.ts`** - Match types exactly to source; for optional object keys, keep the plain key name and use a union with `undefined` as the last option instead of appending `?`\n4. **Update `index.mdx`** - Signature, generics, parameters, examples\n5. **Update related files** - Type docs, `menu.md` if renamed\n\n## Common Change Types\n\n### New Parameter Added\n\n```typescript\n// Before: one overload\nexport function action<TInput>(requirement: TRequirement): Action<...>;\n\n// After: two overloads (message is optional)\nexport function action<TInput>(requirement: TRequirement): Action<..., undefined>;\nexport function action<TInput, TMessage>(requirement: TRequirement, message: TMessage): Action<..., TMessage>;\n```\n\nUpdate:\n\n1. Add `TMessage` generic to `properties.ts`\n2. Add `message` parameter to `properties.ts`\n3. Update signature in `index.mdx`\n4. Add generic and parameter documentation\n5. Update examples to show new parameter\n\n### Parameter Removed (Breaking)\n\n1. Remove from `properties.ts`\n2. Update signature in `index.mdx`\n3. Remove from Parameters section\n4. Update all examples\n5. Consider adding migration note in Explanation\n\n### Type Constraint Changed\n\n```typescript\n// Before\nTRequirement extends number\n\n// After\nTRequirement extends number | string\n```\n\nUpdate:\n\n1. Update type in `properties.ts`\n2. Update Explanation to mention both types\n3. Add examples for new type usage\n\n### Interface Property Added\n\n1. Update type documentation in `(types)/TypeName/`\n2. Add new property to `properties.ts`; if the source key is optional, do not append `?` to the key name and model it as a union with `undefined` last\n3. Document in Definition section\n\n### Function Renamed\n\n1. Rename folder\n2. Update all references in files\n3. Update `menu.md` (maintain alphabetical order)\n4. Update cross-references in related API docs\n5. Consider redirect if widely used\n\n### Deprecation\n\nAdd notice at top of `index.mdx` (import `Link` from `~/components`):\n\n```mdx\n> **⚠️ Deprecated**: Use <Link href=\"../newFunction/\">\\`newFunction\\`</Link> instead. Will be removed in v2.0.\n```\n\n### New Helper Type Introduced\n\nWhen source introduces a type alias:\n\n```typescript\n// Before: TInput extends string | unknown[]\n// After: TInput extends LengthInput\n```\n\n1. Update `properties.ts` to reference new type with `href`\n2. Create documentation for the new type in `(types)/`\n3. Update explanation if supported types changed\n\n### Multiple Overloads Added (Sync/Async)\n\nWhen sync and async variants are added:\n\n1. Update signature to show general pattern or both overloads\n2. Add explanation about sync vs async usage\n3. Add examples for both use cases\n4. Update Related section for async schemas if relevant\n\n## Related Files to Update\n\nWhen a function changes, check:\n\n- **Type docs** - If interfaces changed (`(types)/TypeName/`)\n- **Related API docs** - Other APIs that reference this function in their Related section\n- **Guide files** - If usage patterns changed significantly\n- **menu.md** - If function renamed or moved\n\n## Verification\n\nAfter updating, verify:\n\n- [ ] All types match source exactly\n- [ ] Function signature matches source\n- [ ] All examples work with new API\n- [ ] All `href` links are valid\n- [ ] Related type docs updated if interfaces changed\n- [ ] `menu.md` updated if renamed\n- [ ] Related API docs updated (their Related sections)\n\n## Best Practices\n\n- **Read full source file** - Don't just look at diff\n- **Update incrementally** - `properties.ts` → `index.mdx` → related files\n- **Don't over-document internals** - Only user-facing changes need docs\n- **Preserve example quality** - Keep realistic, demonstrate best practices\n- **Check related APIs** - They may reference the changed function\n\n## When to Ask for Help\n\n- Major breaking changes (complete signature overhaul)\n- Complex generic constraint changes\n- Unclear intent from source changes\n- Many related files affected\n- Need to document migration path\n\n## Quick Reference\n\n| Change            | Files to Update                                                      |\n| ----------------- | -------------------------------------------------------------------- |\n| New parameter     | `properties.ts`, `index.mdx` (signature, generics, params, examples) |\n| Removed parameter | `properties.ts`, `index.mdx`                                         |\n| Type change       | `properties.ts`, `index.mdx` (explanation, examples)                 |\n| Interface change  | `(types)/TypeName/properties.ts`, `(types)/TypeName/index.mdx`       |\n| Renamed function  | Folder name, all files, `menu.md`, cross-references                  |\n| Deprecation       | `index.mdx` (add warning)                                            |\n",".agents/skills/repo-website-guide-create/SKILL.md":"---\nname: repo-website-guide-create\ndescription: Create conceptual documentation and tutorial pages for the Valibot website at website/src/routes/guides/. Use when adding guides about schemas, pipelines, async validation, migration, or other topics. Covers directory structure, MDX templates, frontmatter, and content guidelines.\n---\n\n# Adding Guides to Website\n\nGuide for creating conceptual documentation at `website/src/routes/guides/`.\n\n## Directory Structure\n\n```\nwebsite/src/routes/guides/\n├── menu.md                    # Navigation menu\n├── (get-started)/             # Intro, installation, quick start\n├── (main-concepts)/           # Schemas, pipelines, parsing\n├── (schemas)/                 # Objects, arrays, unions\n├── (advanced)/                # Async, i18n, JSON Schema\n├── (migration)/               # Version upgrades, Zod migration\n└── (category)/guide-slug/\n    └── index.mdx              # Guide content\n```\n\nNote: Category folders use parentheses (Qwik route grouping).\n\n## Process\n\n1. Review 2-3 existing guides in the target category to understand style\n2. Choose category from existing or create new\n3. Create folder: `(category)/guide-slug/`\n4. Create `index.mdx` with content\n5. Update `menu.md`\n\n## index.mdx Template\n\n```mdx\n---\ntitle: Guide Title\ndescription: >-\n  A concise description of what this guide covers.\ncontributors:\n  - github-username\n---\n\nimport { ApiList, Link } from '~/components';\n\n# Guide Title\n\nOpening paragraph explaining what the reader will learn.\n\n## Section Heading\n\nContent with clear, concise language.\n\n\\`\\`\\`ts\nimport \\* as v from 'valibot';\n\nconst Schema = v.object({\nname: v.string(),\nemail: v.pipe(v.string(), v.email()),\n});\n\\`\\`\\`\n\n## Another Section\n\nContinue with additional sections as needed.\n\nUse <Link href=\"/api/pipe/\">\\`pipe\\`</Link> for internal links.\n```\n\n## Frontmatter\n\nRequired fields:\n\n- **title**: Page title and navigation label\n- **description**: SEO description (use `>-` for multi-line)\n- **contributors**: Array of GitHub usernames\n\n## Content Guidelines\n\n### Code Examples\n\n- Use TypeScript (`ts` language)\n- Import as `import * as v from 'valibot';`\n- Include comments for complex code\n\n### Links\n\nInternal links use the `Link` component:\n\n```mdx\n<Link href=\"/guides/schemas/\">schemas guide</Link>\n<Link href=\"/api/pipe/\">\\`pipe\\`</Link>\n```\n\n### Components\n\n```mdx\n<ApiList label=\"Related schemas\" items={['object', 'array', 'string']} />\n```\n\n### Formatting\n\n- `inline code` for API names, variables, file names\n- **bold** for genuine emphasis only — not as inline section labels\n- Proper heading hierarchy (h1 title, h2 sections, h3 subsections)\n\n### Writing tone\n\n- Write conversational prose, not terse reference-doc style\n- Use first-person plural: \"we recommend\" not \"you should\"\n- Do not use bold as inline section labels (e.g. avoid `**Label:** content`). Use a proper subheading instead\n- Do not prefix blockquotes with bold labels (e.g. avoid `> **Note:** ...`). A plain `>` is correct\n- Bullet list items do not need a bold prefix on each item\n\n### Images\n\nPlace images in the same folder as `index.mdx`:\n\n```mdx\n![Alt text](./diagram-light.jpg)\n```\n\nConsider light/dark theme variants if applicable (e.g., `diagram-light.jpg`, `diagram-dark.jpg`).\n\n## Update menu.md\n\nAdd to `/website/src/routes/guides/menu.md`:\n\n```markdown\n## Category Name\n\n- [Existing Guide](/guides/existing/)\n- [New Guide Title](/guides/guide-slug/)\n```\n\nMaintain logical ordering within categories.\n\n## Checklist\n\n- [ ] Reviewed existing guides in the same category\n- [ ] Folder structure: `(category)/guide-slug/index.mdx`\n- [ ] Frontmatter: title, description, contributors\n- [ ] Internal links use `Link` component\n- [ ] Code examples use `import * as v from 'valibot';`\n- [ ] Added to `menu.md`\n- [ ] Style matches existing guides\n","AGENTS.md":"# AI Instructions\n\nValibot is a modular, type-safe schema validation library with zero runtime dependencies.\n\n## Monorepo Layout\n\n| Directory                  | Purpose                                         |\n| -------------------------- | ----------------------------------------------- |\n| `library/`                 | Core `valibot` package — most work happens here |\n| `packages/to-json-schema/` | JSON Schema converter                           |\n| `packages/i18n/`           | Translated error messages                       |\n| `website/`                 | valibot.dev (Qwik + Vite)                       |\n| `codemod/`                 | Migration and conversion tools                  |\n\n## Essential Commands\n\n```bash\npnpm install                    # Install dependencies\npnpm test                       # Run tests (all packages)\npnpm lint                       # ESLint + tsc + deno check (all packages)\npnpm format                     # Format code with Prettier (all packages)\npnpm build                      # Build for publishing (all packages)\n```\n\n## Code Conventions\n\n- **ESM with `.ts` extensions** in imports (enforced by ESLint)\n- **`interface` over `type`** for object shapes\n- **JSDoc required** on exported functions (first overload only for overload sets)\n- **`// @__NO_SIDE_EFFECTS__`** before pure factory functions for tree-shaking\n\n## Other Rules\n\n- **Source code is the single source of truth.** All documentation must match `/library/src/`.\n- **Lint and format after modifying code.** Run `eslint --fix` and `prettier --write` on the files you changed so CI passes.\n- **Use the GitHub CLI for GitHub-related tasks.** Prefer `gh` for pull requests, issues, checks, and other GitHub operations.\n\n## Library Architecture\n\nSchemas, actions, and methods are plain objects with a `'~run'` method:\n\n```\nlibrary/src/\n├── schemas/   → Data types (string, object, array...)\n├── actions/   → Validations & transforms (email, minLength, trim...)\n├── methods/   → API functions (parse, pipe, partial...)\n├── types/     → TypeScript definitions\n└── utils/     → Internal helpers (prefixed with _)\n```\n\nEach has its own folder: `name.ts`, `name.test.ts`, `name.test-d.ts`, `index.ts`.\n\n## Agent Skills\n\nThis repository includes agent skills in `/skills/` following the [Agent Skills](https://agentskills.io) open standard.\n\n**Naming:** Skills prefixed with `repo-` are local repository skills\n","CLAUDE.md":"AGENTS.md","packages/to-json-schema/README.md":"# Valibot to JSON Schema\n\nUtility to convert [Valibot](https://valibot.dev) schemas to JSON Schema. Supports JSON Schema draft-07, draft-2020-12, and OpenAPI 3.0 Schema Object formats.\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\ntoJsonSchema(v.string()); // { $schema: \"http://json-schema.org/draft-07/schema#\", type: \"string\" }\n```\n\nThis package is particularly popular for:\n\n- **API Documentation**: Generate OpenAPI specifications from your Valibot schemas\n- **Code Generation**: Create client SDKs and types from your validation schemas\n- **LLM Integration**: Generate structured outputs for Large Language Models\n- **Schema Sharing**: Share validation logic between different programming languages\n\n> Some Valibot features can't be mapped to JSON schema. For example, transformation actions have no equivalent in JSON schema. Also, some Valibot schemas or validations are too JS-specific and do not have an equivalent JSON schema attribute.\n\n## Supported features\n\n**Note**: Converted schemas may behave slightly differently in JSON schema validators (especially for string format) because their implementation is different from Valibot's.\n\n| Schema           | Status | Note                                                                                                                                  |\n| ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------- |\n| `any`            | ✅     |                                                                                                                                       |\n| `array`          | ✅     |                                                                                                                                       |\n| `boolean`        | ✅     |                                                                                                                                       |\n| `enum`           | ⚠️     | Only JSON compatible values are supported                                                                                             |\n| `exactOptional`  | ✅     |                                                                                                                                       |\n| `intersect`      | ✅     |                                                                                                                                       |\n| `lazy`           | ⚠️     | The `.getter` function is always executed with `undefined` as input                                                                   |\n| `literal`        | ⚠️     | Only JSON compatible values are supported                                                                                             |\n| `looseObject`    | ✅     |                                                                                                                                       |\n| `looseTuple`     | ✅     |                                                                                                                                       |\n| `never`          | ✅     |                                                                                                                                       |\n| `null`           | ✅     |                                                                                                                                       |\n| `nullable`       | ✅     |                                                                                                                                       |\n| `nullish`        | ✅     |                                                                                                                                       |\n| `number`         | ✅     |                                                                                                                                       |\n| `objectWithRest` | ✅     |                                                                                                                                       |\n| `object`         | ✅     |                                                                                                                                       |\n| `optional`       | ✅     |                                                                                                                                       |\n| `picklist`       | ⚠️     | Only JSON compatible values are supported                                                                                             |\n| `record`         | ⚠️     | Only `string` schemas for the key of the record are supported. Adds `propertyNames` for key validation (not available in OpenAPI 3.0) |\n| `strictObject`   | ✅     |                                                                                                                                       |\n| `strictTuple`    | ✅     |                                                                                                                                       |\n| `string`         | ✅     |                                                                                                                                       |\n| `tupleWithRest`  | ✅     |                                                                                                                                       |\n| `tuple`          | ✅     |                                                                                                                                       |\n| `union`          | ✅     |                                                                                                                                       |\n| `undefinedable`  | ✅     |                                                                                                                                       |\n| `unknown`        | ✅     |                                                                                                                                       |\n| `variant`        | ⚠️     | The discriminator key will be ignored                                                                                                 |\n\n| Actions         | Status | Note                                                   |\n| --------------- | ------ | ------------------------------------------------------ |\n| `base64`        | ✅     |                                                        |\n| `bic`           | ✅     |                                                        |\n| `cuid2`         | ✅     |                                                        |\n| `decimal`       | ✅     |                                                        |\n| `description`   | ✅     |                                                        |\n| `digits`        | ✅     |                                                        |\n| `domain`        | ✅     |                                                        |\n| `email`         | ✅     |                                                        |\n| `emoji`         | ✅     |                                                        |\n| `empty`         | ✅     |                                                        |\n| `endsWith`      | ✅     |                                                        |\n| `entries`       | ✅     |                                                        |\n| `examples`      | ✅     |                                                        |\n| `gtValue`       | ⚠️     | Only in combination with `number` and `integer` schema |\n| `hash`          | ✅     |                                                        |\n| `hexadecimal`   | ✅     |                                                        |\n| `hexColor`      | ✅     |                                                        |\n| `includes`      | ✅     |                                                        |\n| `integer`       | ✅     |                                                        |\n| `ipv4`          | ✅     |                                                        |\n| `ipv6`          | ✅     |                                                        |\n| `isoDate`       | ✅     |                                                        |\n| `isoDateTime`   | ✅     |                                                        |\n| `isoTime`       | ✅     |                                                        |\n| `isoTimeSecond` | ✅     |                                                        |\n| `isoTimestamp`  | ✅     |                                                        |\n| `isoWeek`       | ✅     |                                                        |\n| `isrc`          | ✅     |                                                        |\n| `jwsCompact`    | ✅     |                                                        |\n| `ksuid`         | ✅     |                                                        |\n| `length`        | ⚠️     | Only in combination with `string` and `array` schema   |\n| `ltValue`       | ⚠️     | Only in combination with `number` and `integer` schema |\n| `mac`           | ✅     |                                                        |\n| `mac48`         | ✅     |                                                        |\n| `mac64`         | ✅     |                                                        |\n| `maxEntries`    | ✅     |                                                        |\n| `maxLength`     | ⚠️     | Only in combination with `string` and `array` schema   |\n| `maxValue`      | ⚠️     | Only in combination with `number` schema               |\n| `metadata`      | ✅     | Additional properties are added without validation     |\n| `minEntries`    | ✅     |                                                        |\n| `minLength`     | ⚠️     | Only in combination with `string` and `array` schema   |\n| `minValue`      | ⚠️     | Only in combination with `number` schema               |\n| `multipleOf`    | ✅     |                                                        |\n| `nanoid`        | ✅     |                                                        |\n| `nonEmpty`      | ✅     |                                                        |\n| `notValue`      | ⚠️     | Only JSON compatible values are supported              |\n| `notValues`     | ⚠️     | Only JSON compatible values are supported              |\n| `octal`         | ✅     |                                                        |\n| `regex`         | ⚠️     | RegExp flags are not supported in JSON Schema          |\n| `rfcEmail`      | ✅     |                                                        |\n| `safeInteger`   | ✅     |                                                        |\n| `slug`          | ✅     |                                                        |\n| `startsWith`    | ✅     |                                                        |\n| `title`         | ✅     |                                                        |\n| `ulid`          | ✅     |                                                        |\n| `url`           | ✅     |                                                        |\n| `uuid`          | ✅     |                                                        |\n| `value`         | ⚠️     | Only JSON compatible values are supported              |\n| `values`        | ⚠️     | Only JSON compatible values are supported              |\n\n> For `length`, `minLength`, and `maxLength`, string constraints have different length semantics in Valibot and JSON Schema. Valibot checks JavaScript string length (`value.length`, UTF-16 code units), while JSON Schema `minLength` and `maxLength` count Unicode code points. This can differ for non-BMP code points such as emoji and for multi-code-point grapheme clusters such as combining marks or ZWJ sequences.\n\n## Configurations\n\n| Option         | Type                                                                  | Note                                                                                                                      |\n| -------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |\n| target         | `'draft-07' \\| 'draft-2020-12' \\| 'openapi-3.0'`                      | The target JSON Schema format. Defaults to `'draft-07'`.                                                                  |\n| typeMode       | `'ignore' \\| 'input' \\| 'output'`                                     | Whether to convert the input or output type of the Valibot schema to JSON Schema.                                         |\n| errorMode      | `'throw' \\| 'warn' \\| 'ignore'`                                       | The policy for handling incompatible schemas and actions.                                                                 |\n| definitions    | `Record<string, GenericSchema>`                                       | The schema definitions for constructing recursive schemas. If not specified, the definitions are generated automatically. |\n| overrideSchema | `(context: OverrideSchemaContext) => JsonSchema \\| null \\| undefined` | Overrides the JSON Schema conversion for a specific Valibot schema.                                                       |\n| ignoreActions  | `string[]`                                                            | The actions that should be ignored during the conversion.                                                                 |\n| overrideAction | `(context: OverrideActionContext) => JsonSchema \\| null \\| undefined` | Overrides the JSON Schema reference for a specific Valibot action.                                                        |\n| overrideRef    | `(context: OverrideRefContext) => string \\| null \\| undefined`        | Overrides the JSON Schema reference for a specific reference ID.                                                          |\n\n### Target format\n\nThe `target` configuration allows you to specify which JSON Schema format to generate. Different targets have different capabilities and syntax:\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst schema = v.nullable(v.string());\n\n// JSON Schema draft-07 (default)\ntoJsonSchema(schema);\n// { $schema: \"http://json-schema.org/draft-07/schema#\", anyOf: [{ type: \"string\" }, { type: \"null\" }] }\n\n// JSON Schema draft-2020-12\ntoJsonSchema(schema, { target: 'draft-2020-12' });\n// { $schema: \"https://json-schema.org/draft/2020-12/schema\", anyOf: [{ type: \"string\" }, { type: \"null\" }] }\n\n// OpenAPI 3.0 Schema Object\ntoJsonSchema(schema, { target: 'openapi-3.0' });\n// { type: \"string\", nullable: true }\n```\n\n**Note**: Some features like `propertyNames` for record schemas are not available in OpenAPI 3.0.\n\n### Type mode\n\nThe `typeMode` configuration controls whether to convert the input or output type of the Valibot schema to JSON Schema.\n\n- When set to `'input'`, conversion stops before the first potential type transformation action or second schema in any pipeline.\n- When set to `'output'`, conversion of any pipelines starts from the last schema in the pipeline. Therefore, the output type must be specified explicitly with a schema after the last type transformation action.\n- When set to `'ignore'` (default), the entire pipeline is converted.\n\nThis is particularly useful when defining API endpoints where external developers need different schema information for requests vs responses:\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst ValibotSchema = v.pipe(\n  v.string(),\n  v.decimal(),\n  v.transform(Number),\n  v.number(),\n  v.maxValue(100)\n);\n\ntoJsonSchema(ValibotSchema, { typeMode: 'input' });\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"string\",\n//   pattern: \"^[+-]?(?:\\\\d*\\\\.)?\\\\d+$\"\n// }\n\ntoJsonSchema(ValibotSchema, { typeMode: 'output' });\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"number\",\n//   maximum: 100\n// }\n```\n\n### Error mode\n\nThe `errorMode` configuration controls how the converter handles unsupported schemas and actions. By default, the error mode is set to `'throw'`. To force the conversion of unsupported Valibot features, you can set it to `'ignore'`.\n\n> Unsupported schemas usually return an empty JSON schema (`{}`) and unsupported actions are usually ignored.\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\ntoJsonSchema(v.file(), { errorMode: 'ignore' }); // {}\n\ntoJsonSchema(v.pipe(v.string(), v.creditCard()), { errorMode: 'ignore' }); // { type: \"string\" }\n```\n\n### Override functions\n\nThe package provides powerful override capabilities to customize the JSON Schema conversion process. You can override the conversion of specific schemas, actions, or references.\n\n#### Override schema conversion\n\nHandle unsupported schemas or customize conversion behavior:\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst ValibotSchema = v.object({ createdAt: v.date() });\n\ntoJsonSchema(ValibotSchema, {\n  overrideSchema(context) {\n    if (context.valibotSchema.type === 'date') {\n      return { type: 'string', format: 'date-time' };\n    }\n  },\n});\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"object\",\n//   properties: {\n//     createdAt: { type: \"string\" format: \"date-time\" }\n//   },\n//   required: [\"createdAt\"]\n// }\n```\n\n#### Override reference IDs\n\nCustomize reference IDs for OpenAPI or other specifications:\n\n```js\nimport { toJsonSchemaDefs } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst UserSchema = v.object({ name: v.string() });\n\ntoJsonSchemaDefs(\n  { UserSchema },\n  { overrideRef: (context) => `#/schemas/${context.referenceId}` }\n);\n```\n\n### Enhanced metadata support\n\nUse the generic `metadata` action to add title, description, and examples to your schemas or the individual `title` and `description` actions. Any other properties of the `metadata` action are added to the JSON Schema without further validation. This allows you to specify custom annotations and standard keywords such as `format`:\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst ValibotSchema = v.pipe(\n  v.string(),\n  v.email(),\n  v.metadata({\n    title: 'Email Schema',\n    description: 'A schema that validates email addresses.',\n    examples: ['jane@example.com'],\n    'x-category': 'auth',\n  })\n);\n\ntoJsonSchema(ValibotSchema);\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"string\",\n//   format: \"email\",\n//   title: \"Email Schema\",\n//   description: \"A schema that validates email addresses.\",\n//   examples: [\"jane@example.com\"],\n//   \"x-category\": \"auth\"\n// }\n```\n\n### Definitions\n\nNested and recursive schemas can be broken in multiple reusable definitions.\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst EmailSchema = v.pipe(v.string(), v.email());\ntoJsonSchema(v.object({ email: EmailSchema }), {\n  definitions: { EmailSchema },\n});\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"object\",\n//   properties: {\n//     email: {\n//       $ref: \"#/$defs/EmailSchema\"\n//     }\n//   },\n//   required: [\"email\"],\n//   $defs: {\n//     EmailSchema: {\n//       type: \"string\",\n//       format: \"email\"\n//     }\n//   }\n// }\n```\n\nDefinitions are not required for converting `lazy` schemas. Missing definitions will be generated automatically.\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst StringSchema = v.string();\ntoJsonSchema(v.object({ key: v.lazy(() => StringSchema) }));\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"object\",\n//   properties: {\n//     key: {\n//       $ref: \"#/$defs/0\"\n//     }\n//   },\n//   required: [\"key\"],\n//   $defs: {\n//     0: {\n//       type: \"string\"\n//     }\n//   }\n// }\n```\n\n## Additional functions\n\n### `toStandardJsonSchema`\n\nConverts a Valibot schema to the [Standard JSON Schema](https://standardschema.dev/) format. This format is useful when working with tools and libraries that support the Standard JSON Schema specification.\n\n```js\nimport { toStandardJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst schema = toStandardJsonSchema(\n  v.object({\n    id: v.pipe(v.string(), v.uuid()),\n    name: v.pipe(v.string(), v.nonEmpty()),\n    age: v.optional(v.number()),\n  })\n);\n```\n\n### `toJsonSchemaDefs`\n\nConverts only the provided Valibot schema definitions to JSON Schema definitions, without wrapping them in a root schema. This is particularly useful for OpenAPI specifications where you need only the schema definitions.\n\n```js\nimport { toJsonSchemaDefs } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst EmailSchema = v.pipe(v.string(), v.email());\nconst UserSchema = v.object({\n  name: v.string(),\n  email: EmailSchema,\n});\n\ntoJsonSchemaDefs({ EmailSchema, UserSchema });\n\n// {\n//   EmailSchema: {\n//     type: \"string\",\n//     format: \"email\"\n//   },\n//   UserSchema: {\n//     type: \"object\",\n//     properties: {\n//       name: {\n//         type: \"string\"\n//       },\n//       email: {\n//         $ref: \"#/$defs/EmailSchema\"\n//       }\n//     },\n//     required: [\"name\", \"email\"]\n//   }\n// }\n```\n\n#### OpenAPI integration\n\nFor OpenAPI specifications, you can customize reference IDs:\n\n```js\nimport { toJsonSchemaDefs } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst ValibotSchema1 = v.string();\nconst ValibotSchema2 = v.number();\nconst ValibotSchema3 = v.tuple([ValibotSchema1, ValibotSchema2]);\n\ntoJsonSchemaDefs(\n  { ValibotSchema1, ValibotSchema2, ValibotSchema3 },\n  { overrideRef: (context) => `#/schemas/${context.referenceId}` }\n);\n\n// {\n//   ValibotSchema1: { type: \"string\" },\n//   ValibotSchema2: { type: \"number\" },\n//   ValibotSchema3: {\n//     type: \"array\",\n//     items: [\n//       { $ref: \"#/schemas/ValibotSchema1\" },\n//       { $ref: \"#/schemas/ValibotSchema2\" }\n//     ],\n//     minItems: 2\n//   }\n// }\n```\n\n### Global definitions\n\nFor advanced use cases, you can manage global schema definitions that will be automatically used when converting schemas. This is particularly useful for larger projects with many reusable schemas.\n\n```js\nimport { addGlobalDefs, toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst ValibotSchema1 = v.string();\nconst ValibotSchema2 = v.number();\n\naddGlobalDefs({ ValibotSchema1, ValibotSchema2 });\n\nconst ValibotSchema3 = v.tuple([ValibotSchema1, ValibotSchema2]);\n\ntoJsonSchema(ValibotSchema3);\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"array\",\n//   items: [\n//     { $ref: \"#/$defs/ValibotSchema1\" },\n//     { $ref: \"#/$defs/ValibotSchema2\" }\n//   ],\n//   minItems: 2,\n//   $defs: {\n//     ValibotSchema1: { type: \"string\" },\n//     ValibotSchema2: { type: \"number\" }\n//   }\n// }\n```\n\nYou can also convert global definitions directly using `toJsonSchemaDefs`:\n\n```js\nconst globalDefs = getGlobalDefs();\nif (globalDefs) {\n  const schemaDefs = toJsonSchemaDefs(globalDefs);\n}\n```\n","website/public/.well-known/agent-skills/valibot/SKILL.md":"---\nname: valibot\ndescription: Schema validation with Valibot, the modular and type-safe schema library. Use when the user needs to validate data, create schemas, parse inputs, or work with Valibot in their project. Also use when migrating from Zod to Valibot.\nlicense: MIT\nmetadata:\n  author: open-circle\n  version: \"1.0\"\n---\n\n# Valibot\n\nThis skill helps you work effectively with [Valibot](https://valibot.dev), the modular and type-safe schema library for validating structural data.\n\n## When to use this skill\n\n- When the user asks about schema validation with Valibot\n- When creating or modifying Valibot schemas\n- When parsing or validating user input\n- When the user mentions Valibot, schema, or validation\n- When migrating from Zod to Valibot\n\n## CRITICAL: Valibot vs Zod — Do Not Confuse!\n\n**Valibot and Zod have different APIs. Never mix them up!**\n\n### Key Differences\n\n| Feature             | Zod ❌                                | Valibot ✅                                                |\n| ------------------- | ------------------------------------- | --------------------------------------------------------- |\n| Import              | `import { z } from 'zod'`             | `import * as v from 'valibot'`                            |\n| Validations         | Chained methods: `.email().min(5)`    | Pipeline: `v.pipe(v.string(), v.email(), v.minLength(5))` |\n| Parsing             | `schema.parse(data)`                  | `v.parse(schema, data)`                                   |\n| Safe parsing        | `schema.safeParse(data)`              | `v.safeParse(schema, data)`                               |\n| Optional            | `z.string().optional()`               | `v.optional(v.string())`                                  |\n| Nullable            | `z.string().nullable()`               | `v.nullable(v.string())`                                  |\n| Default             | `z.string().default('x')`             | `v.optional(v.string(), 'x')`                             |\n| Transform           | `z.string().transform(fn)`            | `v.pipe(v.string(), v.transform(fn))`                     |\n| Refine/Check        | `z.string().refine(fn)`               | `v.pipe(v.string(), v.check(fn))`                         |\n| Enum                | `z.enum(['a', 'b'])`                  | `v.picklist(['a', 'b'])`                                  |\n| Native enum         | `z.nativeEnum(MyEnum)`                | `v.enum(MyEnum)`                                          |\n| Union               | `z.union([a, b])`                     | `v.union([a, b])`                                         |\n| Discriminated union | `z.discriminatedUnion('type', [...])` | `v.variant('type', [...])`                                |\n| Intersection        | `z.intersection(a, b)`                | `v.intersect([a, b])`                                     |\n| Min/max length      | `.min(5).max(10)`                     | `v.minLength(5), v.maxLength(10)`                         |\n| Min/max value       | `.gte(5).lte(10)`                     | `v.minValue(5), v.maxValue(10)`                           |\n| Infer type          | `z.infer<typeof Schema>`              | `v.InferOutput<typeof Schema>`                            |\n| Infer input         | `z.input<typeof Schema>`              | `v.InferInput<typeof Schema>`                             |\n\n### Common Mistakes to Avoid\n\n```typescript\n// ❌ WRONG - This is Zod syntax, NOT Valibot!\nconst Schema = v.string().email().min(5);\nconst result = Schema.parse(data);\n\n// ✅ CORRECT - Valibot uses functions and pipelines\nconst Schema = v.pipe(v.string(), v.email(), v.minLength(5));\nconst result = v.parse(Schema, data);\n```\n\n```typescript\n// ❌ WRONG - Zod-style optional\nconst Schema = v.object({\n  name: v.string().optional(),\n});\n\n// ✅ CORRECT - Valibot wraps with optional()\nconst Schema = v.object({\n  name: v.optional(v.string()),\n});\n```\n\n```typescript\n// ❌ WRONG - Zod-style default\nconst Schema = v.string().default(\"hello\");\n\n// ✅ CORRECT - Valibot uses second argument\nconst Schema = v.optional(v.string(), \"hello\");\n```\n\n## Installation\n\n```bash\nnpm install valibot     # npm\nyarn add valibot        # yarn\npnpm add valibot        # pnpm\nbun add valibot         # bun\n```\n\nImport with a wildcard (recommended):\n\n```typescript\nimport * as v from \"valibot\";\n```\n\nOr with individual imports:\n\n```typescript\nimport { object, string, pipe, email, parse } from \"valibot\";\n```\n\n## Mental Model\n\nValibot's API is divided into three main concepts:\n\n### 1. Schemas\n\nSchemas define the expected data type. They are the starting point.\n\n```typescript\nimport * as v from \"valibot\";\n\n// Primitive schemas\nconst StringSchema = v.string();\nconst NumberSchema = v.number();\nconst BooleanSchema = v.boolean();\nconst DateSchema = v.date();\n\n// Complex schemas\nconst ArraySchema = v.array(v.string());\nconst ObjectSchema = v.object({\n  name: v.string(),\n  age: v.number(),\n});\n```\n\n### 2. Methods\n\nMethods help you use or modify schemas. The schema is always the first argument.\n\n```typescript\n// Parsing\nconst result = v.parse(StringSchema, \"hello\");\nconst safeResult = v.safeParse(StringSchema, \"hello\");\n\n// Type guard\nif (v.is(StringSchema, data)) {\n  // data is typed as string\n}\n```\n\n### 3. Actions\n\nActions validate or transform data within a `pipe()`. They MUST be used inside pipelines.\n\n```typescript\n// Actions are used in pipe()\nconst EmailSchema = v.pipe(\n  v.string(),\n  v.trim(),\n  v.email(),\n  v.endsWith(\"@example.com\"),\n);\n```\n\n## Pipelines\n\nPipelines extend schemas with validation and transformation actions. A pipeline always starts with a schema, followed by actions.\n\n```typescript\nimport * as v from \"valibot\";\n\nconst UsernameSchema = v.pipe(\n  v.string(),\n  v.trim(),\n  v.minLength(3, \"Username must be at least 3 characters\"),\n  v.maxLength(20, \"Username must be at most 20 characters\"),\n  v.regex(\n    /^[a-z0-9_]+$/i,\n    \"Username can only contain letters, numbers, and underscores\",\n  ),\n);\n\nconst AgeSchema = v.pipe(\n  v.number(),\n  v.integer(\"Age must be a whole number\"),\n  v.minValue(0, \"Age cannot be negative\"),\n  v.maxValue(150, \"Age cannot exceed 150\"),\n);\n```\n\n### Common Validation Actions\n\n**String validations:**\n\n- `v.email()` — Valid email format\n- `v.url()` — Valid URL format\n- `v.uuid()` — Valid UUID format\n- `v.regex(pattern)` — Match regex pattern\n- `v.minLength(n)` — Minimum length\n- `v.maxLength(n)` — Maximum length\n- `v.length(n)` — Exact length\n- `v.nonEmpty()` — Not empty string\n- `v.startsWith(str)` — Starts with string\n- `v.endsWith(str)` — Ends with string\n- `v.includes(str)` — Contains string\n\n**Number validations:**\n\n- `v.minValue(n)` — Minimum value (>=)\n- `v.maxValue(n)` — Maximum value (<=)\n- `v.gtValue(n)` — Greater than (>)\n- `v.ltValue(n)` — Less than (<)\n- `v.integer()` — Must be integer\n- `v.finite()` — Must be finite\n- `v.safeInteger()` — Safe integer range\n- `v.multipleOf(n)` — Must be multiple of n\n\n**Array validations:**\n\n- `v.minLength(n)` — Minimum items\n- `v.maxLength(n)` — Maximum items\n- `v.length(n)` — Exact item count\n- `v.nonEmpty()` — At least one item\n- `v.includes(item)` — Contains item\n- `v.excludes(item)` — Does not contain item\n\n### Custom Validation with check()\n\n```typescript\nconst PasswordSchema = v.pipe(\n  v.string(),\n  v.minLength(8),\n  v.check(\n    (input) => /[A-Z]/.test(input),\n    \"Password must contain an uppercase letter\",\n  ),\n  v.check((input) => /[0-9]/.test(input), \"Password must contain a number\"),\n);\n```\n\n### Value Transformations\n\nThese actions modify the value without changing its type:\n\n**String transformations:**\n\n- `v.trim()` — Remove leading/trailing whitespace\n- `v.trimStart()` — Remove leading whitespace\n- `v.trimEnd()` — Remove trailing whitespace\n- `v.toLowerCase()` — Convert to lowercase\n- `v.toUpperCase()` — Convert to uppercase\n\n**Number transformations:**\n\n- `v.toMinValue(n)` — Clamp to minimum value (if less than n, set to n)\n- `v.toMaxValue(n)` — Clamp to maximum value (if greater than n, set to n)\n\n```typescript\nconst NormalizedEmailSchema = v.pipe(\n  v.string(),\n  v.trim(),\n  v.toLowerCase(),\n  v.email(),\n);\n\n// Clamp number to range 0-100\nconst PercentageSchema = v.pipe(v.number(), v.toMinValue(0), v.toMaxValue(100));\n```\n\n### Type Transformations\n\nFor converting between data types, use these built-in transformation actions:\n\n- `v.toNumber()` — Convert to number\n- `v.toString()` — Convert to string\n- `v.toBoolean()` — Convert to boolean\n- `v.toBigint()` — Convert to bigint\n- `v.toDate()` — Convert to Date\n\n```typescript\n// Convert string to number\nconst PortSchema = v.pipe(v.string(), v.toNumber(), v.integer(), v.minValue(1));\n\n// Convert ISO string to Date\nconst TimestampSchema = v.pipe(v.string(), v.isoDateTime(), v.toDate());\n\n// Convert to boolean\nconst FlagSchema = v.pipe(v.string(), v.toBoolean());\n```\n\n### Custom Transformations\n\nFor custom transformations, use `v.transform()`:\n\n```typescript\nconst DateStringSchema = v.pipe(\n  v.string(),\n  v.isoDate(),\n  v.transform((input) => new Date(input)),\n);\n\n// Custom object transformation\nconst UserSchema = v.pipe(\n  v.object({\n    firstName: v.string(),\n    lastName: v.string(),\n  }),\n  v.transform((input) => ({\n    ...input,\n    fullName: `${input.firstName} ${input.lastName}`,\n  })),\n);\n```\n\n## Object Schemas\n\n### Basic Object\n\n```typescript\nconst UserSchema = v.object({\n  id: v.number(),\n  name: v.string(),\n  email: v.pipe(v.string(), v.email()),\n  age: v.optional(v.number()),\n});\n\ntype User = v.InferOutput<typeof UserSchema>;\n```\n\n### Object Variants\n\n```typescript\n// Regular object - strips unknown keys (default)\nconst ObjectSchema = v.object({ key: v.string() });\n\n// Loose object - allows and preserves unknown keys\nconst LooseObjectSchema = v.looseObject({ key: v.string() });\n\n// Strict object - throws on unknown keys\nconst StrictObjectSchema = v.strictObject({ key: v.string() });\n\n// Object with rest - validates unknown keys against a schema\nconst ObjectWithRestSchema = v.objectWithRest(\n  { key: v.string() },\n  v.number(), // unknown keys must be numbers\n);\n```\n\n### Optional and Nullable Fields\n\n```typescript\nconst ProfileSchema = v.object({\n  // Required\n  name: v.string(),\n\n  // Optional (can be undefined or missing)\n  nickname: v.optional(v.string()),\n\n  // Optional with default\n  role: v.optional(v.string(), \"user\"),\n\n  // Nullable (can be null)\n  avatar: v.nullable(v.string()),\n\n  // Nullish (can be null or undefined)\n  bio: v.nullish(v.string()),\n\n  // Nullish with default\n  theme: v.nullish(v.string(), \"light\"),\n});\n```\n\n### Object Methods\n\n```typescript\nconst BaseSchema = v.object({\n  id: v.number(),\n  name: v.string(),\n  email: v.string(),\n  password: v.string(),\n});\n\n// Pick specific keys\nconst PublicUserSchema = v.pick(BaseSchema, [\"id\", \"name\"]);\n\n// Omit specific keys\nconst UserWithoutPasswordSchema = v.omit(BaseSchema, [\"password\"]);\n\n// Make all optional\nconst PartialUserSchema = v.partial(BaseSchema);\n\n// Make all required\nconst RequiredUserSchema = v.required(PartialUserSchema);\n\n// Merge objects\nconst ExtendedUserSchema = v.object({\n  ...BaseSchema.entries,\n  createdAt: v.date(),\n});\n```\n\n### Cross-Field Validation\n\n```typescript\nconst RegistrationSchema = v.pipe(\n  v.object({\n    password: v.pipe(v.string(), v.minLength(8)),\n    confirmPassword: v.string(),\n  }),\n  v.forward(\n    v.partialCheck(\n      [[\"password\"], [\"confirmPassword\"]],\n      (input) => input.password === input.confirmPassword,\n      \"Passwords do not match\",\n    ),\n    [\"confirmPassword\"],\n  ),\n);\n```\n\n## Arrays and Tuples\n\n### Arrays\n\n```typescript\nconst TagsSchema = v.pipe(\n  v.array(v.string()),\n  v.minLength(1, \"At least one tag required\"),\n  v.maxLength(10, \"Maximum 10 tags allowed\"),\n);\n\n// Array of objects\nconst UsersSchema = v.array(\n  v.object({\n    id: v.number(),\n    name: v.string(),\n  }),\n);\n```\n\n### Tuples\n\n```typescript\n// Fixed-length array with specific types\nconst CoordinatesSchema = v.tuple([v.number(), v.number()]);\n// Type: [number, number]\n\n// Tuple with rest\nconst ArgsSchema = v.tupleWithRest(\n  [v.string()], // first arg is string\n  v.number(), // rest are numbers\n);\n// Type: [string, ...number[]]\n```\n\n## Unions and Variants\n\n### Union\n\n```typescript\nconst StringOrNumberSchema = v.union([v.string(), v.number()]);\n\nconst StatusSchema = v.union([\n  v.literal(\"pending\"),\n  v.literal(\"active\"),\n  v.literal(\"inactive\"),\n]);\n```\n\n### Picklist (for string/number literals)\n\n```typescript\n// Simpler than union of literals\nconst StatusSchema = v.picklist([\"pending\", \"active\", \"inactive\"]);\n\nconst PrioritySchema = v.picklist([1, 2, 3]);\n```\n\n### Variant (discriminated union)\n\nUse `variant` for better performance with discriminated unions:\n\n```typescript\nconst EventSchema = v.variant(\"type\", [\n  v.object({\n    type: v.literal(\"click\"),\n    x: v.number(),\n    y: v.number(),\n  }),\n  v.object({\n    type: v.literal(\"keypress\"),\n    key: v.string(),\n  }),\n  v.object({\n    type: v.literal(\"scroll\"),\n    direction: v.picklist([\"up\", \"down\"]),\n  }),\n]);\n```\n\n## Parsing Data\n\n### parse() — Throws on Error\n\n```typescript\nimport * as v from \"valibot\";\n\nconst EmailSchema = v.pipe(v.string(), v.email());\n\ntry {\n  const email = v.parse(EmailSchema, \"jane@example.com\");\n  console.log(email); // 'jane@example.com'\n} catch (error) {\n  console.error(error); // ValiError\n}\n```\n\n### safeParse() — Returns Result Object\n\n```typescript\nconst result = v.safeParse(EmailSchema, input);\n\nif (result.success) {\n  console.log(result.output); // Valid data\n} else {\n  console.log(result.issues); // Array of issues\n}\n```\n\n### is() — Type Guard\n\n```typescript\nif (v.is(EmailSchema, input)) {\n  // input is typed as string\n}\n```\n\n### Configuration Options\n\n```typescript\n// Abort early - stop at first error\nv.parse(Schema, data, { abortEarly: true });\n\n// Abort pipe early - stop pipeline at first error\nv.parse(Schema, data, { abortPipeEarly: true });\n```\n\n## Type Inference\n\n```typescript\nimport * as v from \"valibot\";\n\nconst UserSchema = v.object({\n  name: v.string(),\n  age: v.pipe(v.string(), v.transform(Number)),\n  role: v.optional(v.string(), \"user\"),\n});\n\n// Output type (after transformations and defaults)\ntype User = v.InferOutput<typeof UserSchema>;\n// { name: string; age: number; role: string }\n\n// Input type (before transformations)\ntype UserInput = v.InferInput<typeof UserSchema>;\n// { name: string; age: string; role?: string | undefined }\n\n// Issue type\ntype UserIssue = v.InferIssue<typeof UserSchema>;\n```\n\n## Error Handling\n\n### Custom Error Messages\n\n```typescript\nconst LoginSchema = v.object({\n  email: v.pipe(\n    v.string(\"Email must be a string\"),\n    v.nonEmpty(\"Please enter your email\"),\n    v.email(\"Invalid email format\"),\n  ),\n  password: v.pipe(\n    v.string(\"Password must be a string\"),\n    v.nonEmpty(\"Please enter your password\"),\n    v.minLength(8, \"Password must be at least 8 characters\"),\n  ),\n});\n```\n\n### Flattening Errors\n\n```typescript\nconst result = v.safeParse(LoginSchema, data);\n\nif (!result.success) {\n  const flat = v.flatten(result.issues);\n  // { nested: { email: ['Invalid email format'], password: ['...'] } }\n}\n```\n\n### Issue Structure\n\nEach issue contains:\n\n- `kind`: 'schema' | 'validation' | 'transformation'\n- `type`: Function name (e.g., 'string', 'email', 'min_length')\n- `input`: The problematic input\n- `expected`: What was expected\n- `received`: What was received\n- `message`: Human-readable message\n- `path`: Array of path items for nested issues\n\n## Fallback Values\n\n```typescript\n// Static fallback\nconst NumberSchema = v.fallback(v.number(), 0);\nv.parse(NumberSchema, \"invalid\"); // Returns 0\n\n// Dynamic fallback\nconst DateSchema = v.fallback(v.date(), () => new Date());\n```\n\n## Recursive Schemas\n\n```typescript\nimport * as v from \"valibot\";\n\ntype TreeNode = {\n  value: string;\n  children: TreeNode[];\n};\n\nconst TreeNodeSchema: v.GenericSchema<TreeNode> = v.object({\n  value: v.string(),\n  children: v.lazy(() => v.array(TreeNodeSchema)),\n});\n```\n\n## Async Validation\n\nFor async operations (e.g., database checks), use async variants:\n\n```typescript\nimport * as v from \"valibot\";\n\nconst isUsernameAvailable = async (username: string) => {\n  // Check database\n  return true;\n};\n\nconst UsernameSchema = v.pipeAsync(\n  v.string(),\n  v.minLength(3),\n  v.checkAsync(isUsernameAvailable, \"Username is already taken\"),\n);\n\n// Must use parseAsync\nconst username = await v.parseAsync(UsernameSchema, \"john\");\n```\n\n## JSON Schema Conversion\n\n```typescript\nimport { toJsonSchema } from \"@valibot/to-json-schema\";\nimport * as v from \"valibot\";\n\nconst EmailSchema = v.pipe(v.string(), v.email());\nconst jsonSchema = toJsonSchema(EmailSchema);\n// { type: 'string', format: 'email' }\n```\n\n## Naming Conventions\n\n### Convention 1: Same Name (Recommended for simplicity)\n\n```typescript\nexport const User = v.object({\n  name: v.string(),\n  email: v.pipe(v.string(), v.email()),\n});\n\nexport type User = v.InferOutput<typeof User>;\n\n// Usage\nconst users: User[] = [];\nusers.push(v.parse(User, data));\n```\n\n### Convention 2: With Suffixes (Recommended when input/output differ)\n\n```typescript\nexport const UserSchema = v.object({\n  name: v.string(),\n  age: v.pipe(v.string(), v.transform(Number)),\n});\n\nexport type UserInput = v.InferInput<typeof UserSchema>;\nexport type UserOutput = v.InferOutput<typeof UserSchema>;\n```\n\n## Common Patterns\n\n### Login Form\n\n```typescript\nconst LoginSchema = v.object({\n  email: v.pipe(\n    v.string(),\n    v.nonEmpty(\"Please enter your email\"),\n    v.email(\"Invalid email address\"),\n  ),\n  password: v.pipe(\n    v.string(),\n    v.nonEmpty(\"Please enter your password\"),\n    v.minLength(8, \"Password must be at least 8 characters\"),\n  ),\n});\n```\n\n### API Response\n\n```typescript\nconst ApiResponseSchema = v.variant(\"status\", [\n  v.object({\n    status: v.literal(\"success\"),\n    data: v.unknown(),\n  }),\n  v.object({\n    status: v.literal(\"error\"),\n    error: v.object({\n      code: v.string(),\n      message: v.string(),\n    }),\n  }),\n]);\n```\n\n### Environment Variables\n\n```typescript\nconst EnvSchema = v.object({\n  NODE_ENV: v.picklist([\"development\", \"production\", \"test\"]),\n  PORT: v.pipe(v.string(), v.transform(Number), v.integer(), v.minValue(1)),\n  DATABASE_URL: v.pipe(v.string(), v.url()),\n  API_KEY: v.pipe(v.string(), v.minLength(32)),\n});\n\nconst env = v.parse(EnvSchema, process.env);\n```\n\n### Date Handling\n\n```typescript\n// String to Date\nconst DateFromStringSchema = v.pipe(\n  v.string(),\n  v.isoDate(),\n  v.transform((input) => new Date(input)),\n);\n\n// Date validation\nconst FutureDateSchema = v.pipe(\n  v.date(),\n  v.minValue(new Date(), \"Date must be in the future\"),\n);\n```\n\n## Additional Resources\n\n- [Valibot Documentation](https://valibot.dev)\n- [Valibot GitHub](https://github.com/open-circle/valibot)\n- [API Reference](https://valibot.dev/api/)\n- [Migration from Zod](https://valibot.dev/guides/migrate-from-zod/)\n"},"items":[{"name":"AGENTS.md","path":"AGENTS.md","rawUrl":"https://raw.githubusercontent.com/open-circle/valibot/HEAD/AGENTS.md","title":"AI Agent Protocol & Instructions","category":"root-instruction","format":"markdown","content":"# AI Instructions\n\nValibot is a modular, type-safe schema validation library with zero runtime dependencies.\n\n## Monorepo Layout\n\n| Directory                  | Purpose                                         |\n| -------------------------- | ----------------------------------------------- |\n| `library/`                 | Core `valibot` package — most work happens here |\n| `packages/to-json-schema/` | JSON Schema converter                           |\n| `packages/i18n/`           | Translated error messages                       |\n| `website/`                 | valibot.dev (Qwik + Vite)                       |\n| `codemod/`                 | Migration and conversion tools                  |\n\n## Essential Commands\n\n```bash\npnpm install                    # Install dependencies\npnpm test                       # Run tests (all packages)\npnpm lint                       # ESLint + tsc + deno check (all packages)\npnpm format                     # Format code with Prettier (all packages)\npnpm build                      # Build for publishing (all packages)\n```\n\n## Code Conventions\n\n- **ESM with `.ts` extensions** in imports (enforced by ESLint)\n- **`interface` over `type`** for object shapes\n- **JSDoc required** on exported functions (first overload only for overload sets)\n- **`// @__NO_SIDE_EFFECTS__`** before pure factory functions for tree-shaking\n\n## Other Rules\n\n- **Source code is the single source of truth.** All documentation must match `/library/src/`.\n- **Lint and format after modifying code.** Run `eslint --fix` and `prettier --write` on the files you changed so CI passes.\n- **Use the GitHub CLI for GitHub-related tasks.** Prefer `gh` for pull requests, issues, checks, and other GitHub operations.\n\n## Library Architecture\n\nSchemas, actions, and methods are plain objects with a `'~run'` method:\n\n```\nlibrary/src/\n├── schemas/   → Data types (string, object, array...)\n├── actions/   → Validations & transforms (email, minLength, trim...)\n├── methods/   → API functions (parse, pipe, partial...)\n├── types/     → TypeScript definitions\n└── utils/     → Internal helpers (prefixed with _)\n```\n\nEach has its own folder: `name.ts`, `name.test.ts`, `name.test-d.ts`, `index.ts`.\n\n## Agent Skills\n\nThis repository includes agent skills in `/skills/` following the [Agent Skills](https://agentskills.io) open standard.\n\n**Naming:** Skills prefixed with `repo-` are local repository skills\n","isInternal":false,"tokens":538,"sizeBytes":2454},{"name":"CLAUDE.md","path":"CLAUDE.md","rawUrl":"https://raw.githubusercontent.com/open-circle/valibot/HEAD/CLAUDE.md","title":"Claude Agent Guidelines & System Prompt","category":"claude-rule","format":"markdown","content":"AGENTS.md","isInternal":false,"tokens":3,"sizeBytes":9},{"name":"SKILL.md","path":".agents/skills/repo-source-code-document/SKILL.md","rawUrl":"https://raw.githubusercontent.com/open-circle/valibot/HEAD/.agents/skills/repo-source-code-document/SKILL.md","title":"repo-source-code-document","category":"anthropic-skill","format":"markdown","content":"---\nname: repo-source-code-document\ndescription: Write JSDoc comments and inline documentation for Valibot library source code in /library/src/. Use when documenting schemas, actions, methods, or utilities. Covers interface documentation, function overloads, purity annotations, inline comment patterns, and terminology consistency.\n---\n\n# Valibot Source Code Documentation\n\nDocumentation patterns for library source code in `/library/src/`.\n\n## JSDoc Patterns\n\n### Interface Documentation\n\n```typescript\n/**\n * String issue interface.\n */\nexport interface StringIssue extends BaseIssue<unknown> {\n  /**\n   * The issue kind.\n   */\n  readonly kind: 'schema';\n  /**\n   * The issue type.\n   */\n  readonly type: 'string';\n}\n```\n\n**Rules:**\n\n- First line: `[Name] [category] interface.` (e.g., \"String issue interface.\")\n- Property comments: `The [description].` (always start with \"The\", end with period)\n- All properties use `readonly`\n- No blank lines between property and its comment\n\n### Variance Annotations\n\nInterfaces in `/library/src/types/` annotate every generic and explain it with a hint:\n\n```typescript\n/**\n * Success dataset interface.\n *\n * Hint: The explicit variance annotations of the generics spare TypeScript\n * from measuring the variance of this interface (see issue #1663).\n */\nexport interface SuccessDataset<out TValue> {}\n```\n\n**Rules:**\n\n- `out` or `in`, whichever `tsc` accepts, and `in out` only if it rejects both (give the reason in the hint)\n- Not for interfaces in `schemas/`, `actions/` or `methods/`\n\n### Function Overloads\n\nEach overload gets its own complete JSDoc:\n\n```typescript\n/**\n * Creates a string schema.\n *\n * @returns A string schema.\n */\nexport function string(): StringSchema<undefined>;\n\n/**\n * Creates a string schema.\n *\n * @param message The error message.\n *\n * @returns A string schema.\n */\nexport function string<\n  const TMessage extends ErrorMessage<StringIssue> | undefined,\n>(message: TMessage): StringSchema<TMessage>;\n```\n\n**Rules:**\n\n- First line: `Creates a [name] [category].` (use \"a\" vs \"an\" correctly)\n- Blank line after description\n- `@param name The [description].` (start with \"The\", end with period)\n- Blank line after params\n- `@returns A [name] [category].` or `@returns The [description].`\n\n### Hints\n\nAdd hints after the main description, before `@param`:\n\n```typescript\n/**\n * Creates an object schema.\n *\n * Hint: This schema removes unknown entries. To include unknown entries, use\n * `looseObject`. To reject unknown entries, use `strictObject`.\n *\n * @param entries The entries schema.\n *\n * @returns An object schema.\n */\n```\n\n### Links\n\nLink to external resources when relevant using markdown format:\n\n```typescript\n/**\n * Creates an [email](https://en.wikipedia.org/wiki/Email_address) validation action.\n */\n```\n\n### Implementation Function\n\nThe implementation has **NO JSDoc** but uses `// @__NO_SIDE_EFFECTS__`:\n\n```typescript\n// @__NO_SIDE_EFFECTS__\nexport function string(\n  message?: ErrorMessage<StringIssue>\n): StringSchema<ErrorMessage<StringIssue> | undefined> {\n  return {\n    /* ... */\n  };\n}\n```\n\n**`// @__NO_SIDE_EFFECTS__` rules:**\n\n- Add for pure functions (no external state mutation, no I/O)\n- Most schema/action/method factories are pure\n- **Do NOT add** for functions that mutate arguments (like `_addIssue`)\n- Used by bundlers for tree-shaking\n\n### Utility Functions\n\n```typescript\n/**\n * Stringifies an unknown input to a literal or type string.\n *\n * @param input The unknown input.\n *\n * @returns A literal or type string.\n *\n * @internal\n */\n// @__NO_SIDE_EFFECTS__\nexport function _stringify(input: unknown): string {\n  // ...\n}\n```\n\n**Rules:**\n\n- Use `@internal` tag for internal utilities\n- Prefix internal functions with `_`\n- Only add `// @__NO_SIDE_EFFECTS__` if function is pure\n\n## Inline Comment Patterns\n\n### Section Headers\n\n```typescript\n'~run'(dataset, config) {\n  // Get input value from dataset\n  const input = dataset.value;\n\n  // If root type is valid, check nested types\n  if (Array.isArray(input)) {\n    // Set typed to true and value to empty array\n    dataset.typed = true;\n    dataset.value = [];\n\n    // Parse schema of each array item\n    for (let key = 0; key < input.length; key++) {\n      // ...\n    }\n  }\n}\n```\n\n**Rules:**\n\n- Describe WHAT the next code block does\n- Present tense verbs: \"Get\", \"Parse\", \"Check\", \"Set\", \"Add\", \"Create\"\n- **Omit articles** (\"the\", \"a\", \"an\"): \"Get input value\" not \"Get the input value\"\n- No period at end\n- Blank line before comment, no blank line after\n\n### Conditional Logic\n\n```typescript\n// If root type is valid, check nested types\nif (input && typeof input === 'object') {\n  // ...\n}\n\n// Otherwise, add issue\nelse {\n  _addIssue(this, 'type', dataset, config);\n}\n```\n\n**Rules:**\n\n- Use \"If [condition], [action]\"\n- Use \"Otherwise, [action]\" for else branches\n- Omit articles\n\n### Hint Comments (Exception)\n\n```typescript\n// Hint: The issue is deliberately not constructed with the spread operator\n// for performance reasons\nconst issue: BaseIssue<unknown> = {\n  /* ... */\n};\n```\n\n**Rules:**\n\n- Start with \"Hint:\"\n- Explain WHY, not just what\n- **CAN use articles** (unlike other inline comments)\n- Document performance decisions, non-obvious logic\n\n### TODO Comments\n\n```typescript\n// TODO: Should we add \"n\" suffix to bigints?\nif (type === 'bigint') {\n  /* ... */\n}\n```\n\n### @ts-expect-error\n\nUsed for internal dataset mutations TypeScript can't track:\n\n```typescript\n// @ts-expect-error\ndataset.typed = true;\n```\n\n## File Type Patterns\n\n### Schema Files (`string.ts`, `object.ts`, etc.)\n\n1. Issue interface with JSDoc\n2. Schema interface with JSDoc\n3. Function overloads with full JSDoc each\n4. Implementation with `// @__NO_SIDE_EFFECTS__`\n5. Return object with `'~run'` method containing inline comments\n\n### Action Files (`email.ts`, `minLength.ts`, etc.)\n\n1. Issue interface (for validation actions)\n2. Action interface with JSDoc\n3. Function overloads with JSDoc\n4. Implementation with `// @__NO_SIDE_EFFECTS__`\n\n### Method Files (`parse.ts`, `pipe.ts`, etc.)\n\nMore complex logic, require more inline comments.\n\n### Utility Files (`_addIssue.ts`, `_stringify.ts`)\n\n1. Single function with JSDoc including `@internal`\n2. `// @__NO_SIDE_EFFECTS__` only if pure\n\n## Terminology Consistency\n\nJSDoc descriptions must match the `kind` property if present:\n\n| `kind` Property    | JSDoc Wording                          |\n| ------------------ | -------------------------------------- |\n| `'schema'`         | \"Creates a ... schema.\"                |\n| `'validation'`     | \"Creates a ... validation action.\"     |\n| `'transformation'` | \"Creates a ... transformation action.\" |\n\n## Quick Reference\n\n### JSDoc First Lines\n\n| Type      | Pattern                        |\n| --------- | ------------------------------ |\n| Interface | `[Name] [category] interface.` |\n| Type      | `[Name] [category] type.`      |\n| Function  | `Creates a [name] [category].` |\n| Utility   | `[Verb]s [description].`       |\n\n### Inline Comment Starters\n\n| Pattern                        | Example                                        |\n| ------------------------------ | ---------------------------------------------- |\n| `// Get [what]`                | `// Get input value from dataset`              |\n| `// If [condition], [action]`  | `// If root type is valid, check nested types` |\n| `// Otherwise, [action]`       | `// Otherwise, add issue`                      |\n| `// Create [what]`             | `// Create object path item`                   |\n| `// Add [what] to [where]`     | `// Add issues to dataset`                     |\n| `// Parse [what]`              | `// Parse schema of each array item`           |\n| `// Set [property] to [value]` | `// Set typed to true`                         |\n| `// Hint: [explanation]`       | `// Hint: This is for performance`             |\n| `// TODO: [task]`              | `// TODO: Add bigint suffix`                   |\n\n## Terminology\n\nUse consistently:\n\n- **Schema** (not \"validator\")\n- **Action** (not \"validation\" for the object)\n- **Issue** (not \"error\" in type names)\n- **Dataset** (internal data structure)\n- **Config/Configuration** (not \"options\")\n\n## Checklist\n\n- [ ] Interfaces: `[Name] [category] interface.`\n- [ ] Properties: `The [description].`\n- [ ] `types/` interfaces: Variance annotations with hint\n- [ ] Overloads: Complete JSDoc each\n- [ ] Implementation: NO JSDoc\n- [ ] Pure functions: `// @__NO_SIDE_EFFECTS__`\n- [ ] Impure functions (mutate args): NO `@__NO_SIDE_EFFECTS__`\n- [ ] Internal utilities: `@internal` tag\n- [ ] Inline comments: No articles (except Hint), no periods\n- [ ] JSDoc comments: End with periods\n","frontmatter":{"name":"repo-source-code-document","description":"Write JSDoc comments and inline documentation for Valibot library source code in /library/src/. Use when documenting schemas, actions, methods, or utilities. Covers interface documentation, function overloads, purity annotations, inline comment patterns, and terminology consistency."},"isInternal":false,"tokens":2111,"sizeBytes":8650},{"name":"SKILL.md","path":".agents/skills/repo-source-code-review/SKILL.md","rawUrl":"https://raw.githubusercontent.com/open-circle/valibot/HEAD/.agents/skills/repo-source-code-review/SKILL.md","title":"repo-source-code-review","category":"anthropic-skill","format":"markdown","content":"---\nname: repo-source-code-review\ndescription: Review pull requests and source code changes in /library/src/. Use when reviewing PRs, validating implementation patterns, or checking code quality before merging. Covers code quality checks, type safety, documentation review, test coverage, and common issues to watch for.\n---\n\n# Reviewing Source Code Changes\n\nGuide for reviewing PRs and source code changes in `/library/src/`.\n\n## When to Use This Guide\n\n- Reviewing pull requests modifying library source\n- Validating implementation patterns before merging\n- Checking code quality, types, documentation, and tests\n\n## Review Process\n\n1. **Understand the change** — Read PR description, identify affected files\n2. **Check patterns** — Verify code follows existing conventions\n3. **Verify types** — Ensure type safety and proper inference\n4. **Review docs** — Confirm JSDoc is complete and accurate\n5. **Check tests** — Validate runtime and type test coverage\n\n## What to Review\n\n### Code Quality\n\n| Check             | Requirement                                                           |\n| ----------------- | --------------------------------------------------------------------- |\n| Naming            | Matches existing patterns (`StringSchema`, `minLength`, `_parse`)     |\n| Purity annotation | `// @__NO_SIDE_EFFECTS__` before pure factory functions               |\n| Import extensions | All imports use `.ts` extension                                       |\n| Interface vs type | Use `interface` for object shapes, `type` for unions/aliases          |\n| Folder structure  | Each API has: `name.ts`, `name.test.ts`, `name.test-d.ts`, `index.ts` |\n\n**Good — purity annotation:**\n\n```typescript\n// @__NO_SIDE_EFFECTS__\nexport function string(message?: ErrorMessage<StringIssue>): StringSchema {\n  return {\n    /* ... */\n  };\n}\n```\n\n**Bad — missing annotation:**\n\n```typescript\nexport function string(message?: ErrorMessage<StringIssue>): StringSchema {\n  return {\n    /* ... */\n  };\n}\n```\n\n### Type Safety\n\n| Check             | Requirement                                           |\n| ----------------- | ----------------------------------------------------- |\n| Generic inference | Types infer correctly without explicit annotations    |\n| Constraints       | Generic parameters have appropriate `extends` clauses |\n| Return types      | Explicit return types on exported functions           |\n| Type tests        | `.test-d.ts` file covers type inference scenarios     |\n| Variance          | Interfaces in `types/` annotate every generic         |\n\n**Good — constrained generic:**\n\n```typescript\nexport function minLength<\n  TInput extends LengthInput,\n  TRequirement extends number,\n>(\n  requirement: TRequirement,\n  message?: ErrorMessage<MinLengthIssue<TInput, TRequirement>>\n): MinLengthAction<TInput, TRequirement>;\n```\n\n### Documentation\n\n| Check          | Requirement                                       |\n| -------------- | ------------------------------------------------- |\n| JSDoc present  | All exported functions have JSDoc                 |\n| First line     | Action verb matching function purpose (see below) |\n| `@param` tags  | Every parameter documented                        |\n| `@returns` tag | Return value documented                           |\n| Overloads      | Every overload has its own complete JSDoc block   |\n\n**First line patterns by category:**\n\n| Category       | Pattern                                        |\n| -------------- | ---------------------------------------------- |\n| Schemas        | `Creates a ... schema.`                        |\n| Actions        | `Creates a ... action.`                        |\n| Parse methods  | `Parses ...`                                   |\n| Type guards    | `Checks if ...`                                |\n| Unwrap methods | `Unwraps ...`                                  |\n| Other methods  | `Creates a ...`, `Returns ...`, `Forwards ...` |\n\nSee `repo-source-code-document` skill for full documentation rules.\n\n### Tests\n\n| Check          | Requirement                                                |\n| -------------- | ---------------------------------------------------------- |\n| Runtime tests  | `.test.ts` covers success cases, failure cases, edge cases |\n| Type tests     | `.test-d.ts` validates type inference with `expectTypeOf`  |\n| Issue messages | Tests verify correct error messages and issue structure    |\n\n## Common Issues\n\n| Issue                     | What to Look For                                             |\n| ------------------------- | ------------------------------------------------------------ |\n| Missing purity annotation | Factory function without `// @__NO_SIDE_EFFECTS__`           |\n| Incomplete JSDoc          | Missing `@param` or `@returns`, wrong description format     |\n| No type tests             | New API without `.test-d.ts` file                            |\n| Wrong import extension    | Imports without `.ts` suffix                                 |\n| Inconsistent naming       | Schema not ending in `Schema`, action not ending in `Action` |\n| Side effects in pure code | Mutations, I/O, or global state in schema/action creation    |\n\n## Checklist\n\n- [ ] Implementation follows existing patterns in similar files\n- [ ] `// @__NO_SIDE_EFFECTS__` on pure factory functions\n- [ ] All imports use `.ts` extension\n- [ ] `interface` used for object shapes\n- [ ] JSDoc complete on all exports\n- [ ] Runtime tests in `.test.ts`\n- [ ] Type tests in `.test-d.ts`\n- [ ] Naming conventions followed\n- [ ] Variance annotations on generics of `types/` interfaces\n\n## Related Skills\n\n- `repo-structure-navigate` — Navigate the codebase\n- `repo-source-code-document` — JSDoc requirements\n","frontmatter":{"name":"repo-source-code-review","description":"Review pull requests and source code changes in /library/src/. Use when reviewing PRs, validating implementation patterns, or checking code quality before merging. Covers code quality checks, type safety, documentation review, test coverage, and common issues to watch for."},"isInternal":false,"tokens":1105,"sizeBytes":5738},{"name":"SKILL.md","path":".agents/skills/repo-structure-navigate/SKILL.md","rawUrl":"https://raw.githubusercontent.com/open-circle/valibot/HEAD/.agents/skills/repo-structure-navigate/SKILL.md","title":"repo-structure-navigate","category":"anthropic-skill","format":"markdown","content":"---\nname: repo-structure-navigate\ndescription: Navigate the Valibot repository structure. Use when looking for files, understanding the codebase layout, finding schema/action/method implementations, locating tests, API docs, or guide pages. Covers monorepo layout, library architecture, file naming conventions, and quick lookups.\n---\n\n# Valibot Repository Structure\n\n## Monorepo Layout\n\n```\nvalibot/\n├── library/          # Core valibot package (zero dependencies)\n├── packages/\n│   ├── i18n/         # Translated error messages (25+ languages)\n│   └── to-json-schema/  # JSON Schema converter\n├── codemod/\n│   ├── migrate-to-v0.31.0/  # Version migration\n│   └── zod-to-valibot/      # Zod converter\n├── website/          # valibot.dev (Qwik + Vite)\n├── brand/            # Brand assets\n├── skills/           # Agent skills (this folder)\n└── prompts/          # Legacy AI agent guides\n```\n\n## Core Library (`/library/src/`)\n\n### Directory Structure\n\n| Directory   | Purpose                         | Examples                                      |\n| ----------- | ------------------------------- | --------------------------------------------- |\n| `schemas/`  | Data type validators            | `string/`, `object/`, `array/`, `union/`      |\n| `actions/`  | Validation & transformation     | `email/`, `minLength/`, `trim/`, `transform/` |\n| `methods/`  | High-level API                  | `parse/`, `safeParse/`, `pipe/`, `partial/`   |\n| `types/`    | TypeScript definitions          | `schema.ts`, `issue.ts`, `dataset.ts`         |\n| `utils/`    | Internal helpers (prefixed `_`) | `_addIssue/`, `_stringify/`, `ValiError/`     |\n| `storages/` | Global state                    | Config, message storage                       |\n\n### Schema Categories\n\n- **Primitives**: `string`, `number`, `boolean`, `bigint`, `date`, `symbol`, `blob`, `file`\n- **Objects**: `object`, `strictObject`, `looseObject`, `objectWithRest`\n- **Arrays**: `array`, `tuple`, `strictTuple`, `looseTuple`, `tupleWithRest`\n- **Advanced**: `union`, `variant`, `intersect`, `record`, `map`, `set`, `lazy`, `custom`\n- **Modifiers**: `optional`, `nullable`, `nullish`, `nonNullable`, `nonNullish`, `nonOptional`\n\n### Action Types\n\n**Validation** (return issues): `email`, `url`, `uuid`, `regex`, `minLength`, `maxValue`, `check`\n\n**Transformation** (modify data): `trim`, `toLowerCase`, `toUpperCase`, `mapItems`, `transform`\n\n**Metadata**: `brand`, `flavor`, `metadata`, `description`, `title`\n\n### File Naming Convention\n\nEach schema/action/method has its own directory:\n\n```\nschemas/string/\n├── string.ts        # Implementation\n├── string.test.ts   # Runtime tests\n├── string.test-d.ts # Type tests\n└── index.ts         # Re-export\n```\n\n### Core Patterns\n\n**Schemas** define data types:\n\n```typescript\nexport interface StringSchema<TMessage> extends BaseSchema<...> {\n  readonly kind: 'schema';\n  readonly type: 'string';\n  // ...\n}\n```\n\n**Actions** validate/transform in pipelines:\n\n```typescript\nexport interface EmailAction<TInput, TMessage> extends BaseValidation<...> {\n  readonly kind: 'validation';\n  readonly type: 'email';\n  // ...\n}\n```\n\n**Methods** provide API functions:\n\n```typescript\nexport function parse<TSchema>(\n  schema: TSchema,\n  input: unknown\n): InferOutput<TSchema>;\n```\n\n### Key Types\n\n- `BaseSchema`, `BaseValidation`, `BaseTransformation` - Base interfaces\n- `InferOutput<T>`, `InferInput<T>`, `InferIssue<T>` - Type inference\n- `Config`, `ErrorMessage<T>`, `BaseIssue<T>` - Configuration and errors\n- `'~standard'` property - [Standard Schema](https://github.com/standard-schema/standard-schema) compatibility\n\n## Website (`/website/src/routes/`)\n\n### API Documentation\n\n```\nroutes/api/\n├── (schemas)/string/     # Schema docs\n│   ├── index.mdx         # MDX content\n│   └── properties.ts     # Type definitions\n├── (actions)/email/      # Action docs\n├── (methods)/parse/      # Method docs\n├── (types)/StringSchema/ # Type docs\n└── menu.md               # Navigation\n```\n\n### Guides\n\n```\nroutes/guides/\n├── (get-started)/       # Intro, installation\n├── (main-concepts)/     # Schemas, pipelines, parsing\n├── (schemas)/           # Objects, arrays, unions\n├── (advanced)/          # Async, i18n, JSON Schema\n├── (migration)/         # Version upgrades\n└── menu.md              # Navigation\n```\n\n## Development\n\n### Playground\n\nUse `library/playground.ts` for quick experimentation.\n\n### Adding a Schema/Action\n\n1. Create directory: `library/src/schemas/yourSchema/`\n2. Create files: `yourSchema.ts`, `yourSchema.test.ts`, `yourSchema.test-d.ts`, `index.ts`\n3. Follow existing patterns (copy similar implementation)\n4. Export from category `index.ts`\n5. Run `pnpm -C library test`\n\n### Modifying Core Types\n\n⚠️ Changes to `library/src/types/` affect the entire library. Always run full test suite.\n\n## Quick Lookups\n\n| Looking for...        | Location                                       |\n| --------------------- | ---------------------------------------------- |\n| Schema implementation | `library/src/schemas/[name]/[name].ts`         |\n| Action implementation | `library/src/actions/[name]/[name].ts`         |\n| Method implementation | `library/src/methods/[name]/[name].ts`         |\n| Type definitions      | `library/src/types/`                           |\n| Internal utilities    | `library/src/utils/`                           |\n| Error messages (i18n) | `packages/i18n/[lang]/`                        |\n| API docs page         | `website/src/routes/api/(category)/[name]/`    |\n| Guide page            | `website/src/routes/guides/(category)/[name]/` |\n| Tests                 | Same directory as source, `.test.ts` suffix    |\n| Type tests            | Same directory as source, `.test-d.ts` suffix  |\n\n## Commands\n\n```bash\n# Library\npnpm -C library build      # Build\npnpm -C library test       # Run tests\npnpm -C library lint       # Lint\npnpm -C library format     # Format\n\n# Website\npnpm -C website dev        # Dev server\npnpm -C website build      # Production build\n\n# Root\npnpm install               # Install all\npnpm format                # Format all\n```\n\n## Key Principles\n\n1. **Modularity** - Small, focused functions; one per file\n2. **Zero dependencies** - Core library has no runtime deps\n3. **100% test coverage** - Required for library\n4. **Tree-shakable** - Use `// @__NO_SIDE_EFFECTS__` annotation\n5. **Type-safe** - Full TypeScript with strict mode\n6. **ESM only** - Imports include `.ts` extensions\n\n## Do's and Don'ts\n\n**Do:**\n\n- Follow existing code patterns\n- Write runtime and type tests\n- Add JSDoc documentation\n- Keep functions small and focused\n- Check bundle size impact\n\n**Don't:**\n\n- Add external dependencies\n- Modify core types without full test run\n- Skip tests\n- Create large multi-purpose functions\n- Modify generated files (`dist/`, `coverage/`)\n","frontmatter":{"name":"repo-structure-navigate","description":"Navigate the Valibot repository structure. Use when looking for files, understanding the codebase layout, finding schema/action/method implementations, locating tests, API docs, or guide pages. Covers monorepo layout, library architecture, file naming conventions, and quick lookups."},"isInternal":false,"tokens":1732,"sizeBytes":6994},{"name":"SKILL.md","path":".agents/skills/repo-website-api-create/SKILL.md","rawUrl":"https://raw.githubusercontent.com/open-circle/valibot/HEAD/.agents/skills/repo-website-api-create/SKILL.md","title":"repo-website-api-create","category":"anthropic-skill","format":"markdown","content":"---\nname: repo-website-api-create\ndescription: Create new API reference pages for the Valibot website at website/src/routes/api/. Use when adding documentation for new schemas, actions, methods, or types. Covers reading source code, creating properties.ts and index.mdx files, updating menu.md, and cross-referencing related APIs.\n---\n\n# Adding API Documentation to Website\n\nGuide for creating new API reference pages at `website/src/routes/api/`.\n\n## Process Overview\n\n1. Read source code in `/library/src/`\n2. Create folder in `/website/src/routes/api/(category)/[name]/`\n3. Create `properties.ts` with type definitions\n4. Create `index.mdx` with documentation\n5. Update `menu.md`\n6. Create type documentation if needed (Issue, Schema/Action interfaces)\n\n## File Structure\n\n```\nwebsite/src/routes/api/\n├── (schemas)/string/\n│   ├── index.mdx        # Documentation content\n│   └── properties.ts    # Type definitions for Property component\n├── (actions)/email/\n├── (methods)/parse/\n├── (types)/StringSchema/\n└── menu.md              # Navigation (alphabetical order)\n```\n\nCategories: `(schemas)`, `(actions)`, `(methods)`, `(types)`, `(utils)`, `(async)`, `(storages)`\n\n## Reading Source Code\n\n### What to Extract\n\nFrom `/library/src/schemas/string/string.ts`:\n\n```typescript\n// 1. Issue interface → Document in (types)/StringIssue/\nexport interface StringIssue extends BaseIssue<unknown> { ... }\n\n// 2. Schema interface → Document in (types)/StringSchema/\nexport interface StringSchema<TMessage extends ErrorMessage<StringIssue> | undefined>\n  extends BaseSchema<string, string, StringIssue> { ... }\n\n// 3. Function overloads → Main documentation\nexport function string(): StringSchema<undefined>;\nexport function string<const TMessage>(message: TMessage): StringSchema<TMessage>;\n\n// 4. JSDoc → Description, hints, parameter docs\n/**\n * Creates a string schema.\n *\n * Hint: This is an example hint.\n *\n * @param message The error message.\n *\n * @returns A string schema.\n */\n```\n\n**JSDoc hints** become blockquotes in the Explanation section:\n\n```mdx\n> This is an example hint.\n```\n\n### Extract for properties.ts\n\n- Generic parameters and constraints (e.g., `TMessage extends ErrorMessage<...> | undefined`)\n- Function parameters and types\n- Return type\n\n## properties.ts\n\nImport and define properties matching source code:\n\n```typescript\nimport type { PropertyProps } from '~/components';\n\nexport const properties: Record<string, PropertyProps> = {\n  // Generics (use modifier: 'extends')\n  TMessage: {\n    modifier: 'extends',\n    type: {\n      type: 'union',\n      options: [\n        {\n          type: 'custom',\n          name: 'ErrorMessage',\n          href: '../ErrorMessage/',\n          generics: [\n            { type: 'custom', name: 'StringIssue', href: '../StringIssue/' },\n          ],\n        },\n        'undefined',\n      ],\n    },\n  },\n\n  // Parameters (reference generic or direct type)\n  message: {\n    type: { type: 'custom', name: 'TMessage' },\n  },\n\n  // Return type\n  Schema: {\n    type: {\n      type: 'custom',\n      name: 'StringSchema',\n      href: '../StringSchema/',\n      generics: [{ type: 'custom', name: 'TMessage' }],\n    },\n  },\n};\n```\n\n### Optional Object Keys\n\nFor optional object keys from TypeScript source such as `key?: string`, do not append `?` to the property name in `properties.ts`.\n\nUse the plain key name and represent optionality in the value type with `undefined` as the last union option:\n\n```typescript\npayload: {\n  type: {\n    type: 'object',\n    entries: [\n      {\n        key: 'key',\n        value: {\n          type: 'union',\n          options: ['string', 'undefined'],\n        },\n      },\n    ],\n  },\n},\n```\n\n### DefinitionData Types\n\n| Type            | Syntax                                                                         |\n| --------------- | ------------------------------------------------------------------------------ |\n| Primitive       | `'string'`, `'number'`, `'boolean'`, `'unknown'`, etc.                         |\n| Literal string  | `{ type: 'string', value: 'email' }`                                           |\n| Literal number  | `{ type: 'number', value: 5 }`                                                 |\n| Custom/Named    | `{ type: 'custom', name: 'TypeName', href: '../TypeName/', generics: [...] }`  |\n| Custom+modifier | `{ type: 'custom', modifier: 'typeof', name: 'string', href: '../string/' }`   |\n| Union           | `{ type: 'union', options: [type1, type2] }`                                   |\n| Intersect       | `{ type: 'intersect', options: [type1, type2] }`                               |\n| Array           | `{ type: 'array', item: elementType }`                                         |\n| Tuple           | `{ type: 'tuple', items: [type1, type2] }`                                     |\n| Object          | `{ type: 'object', entries: [{ key: 'name', value: type }] }`                   |\n| Function        | `{ type: 'function', params: [{ name: 'x', type: t }], return: retType }`      |\n| Template        | `{ type: 'template', parts: [{ type: 'string', value: '>=' }, otherType] }`    |\n\n## index.mdx Template\n\n```mdx\n---\ntitle: functionName\ndescription: One-line description from JSDoc.\nsource: /schemas/string/string.ts\ncontributors:\n  - github-username\n---\n\nimport { ApiList, Property } from '~/components';\nimport { properties } from './properties';\n\n# functionName\n\nCreates a string schema.\n\n\\`\\`\\`ts\nconst Schema = v.functionName<TMessage>(message);\n\\`\\`\\`\n\n## Generics\n\n- \\`TMessage\\` <Property {...properties.TMessage} />\n\n## Parameters\n\n- \\`message\\` <Property {...properties.message} />\n\n### Explanation\n\nWith \\`functionName\\` you can validate... If the input does not match, you can use \\`message\\` to customize the error message.\n\n## Returns\n\n- \\`Schema\\` <Property {...properties.Schema} />\n\n## Examples\n\nThe following examples show how \\`functionName\\` can be used.\n\n### Email schema\n\nSchema to validate an email.\n\n\\`\\`\\`ts\nconst EmailSchema = v.pipe(\nv.string(),\nv.nonEmpty('Please enter your email.'),\nv.email('The email is badly formatted.')\n);\n\\`\\`\\`\n\n## Related\n\nThe following APIs can be combined with \\`functionName\\`.\n\n### Schemas\n\n<ApiList items={['array', 'object', 'string']} />\n\n### Methods\n\n<ApiList items={['parse', 'pipe', 'safeParse']} />\n\n### Actions\n\n<ApiList items={['email', 'minLength']} />\n\n### Utils\n\n<ApiList items={['isOfKind', 'isOfType']} />\n```\n\n**Related section order:** Schemas → Methods → Actions → Utils (omit empty sections)\n\n## Key Conventions\n\n### Naming\n\n- Schema variables: `PascalCase` + `Schema` suffix: `EmailSchema`, `UserSchema`\n- Action variables: `PascalCase` + `Action`: `MinLengthAction`\n- Parse output: `output` or descriptive name\n\n### Examples\n\n- Always include error messages for validation actions\n- Progress from simple to complex\n- Use realistic, practical scenarios\n- Start with `import * as v from 'valibot';` pattern\n\n### Error Messages\n\nUse friendly, actionable messages:\n\n- ✅ \"Your password is too short.\"\n- ✅ \"Please enter your email.\"\n- ❌ \"Invalid\" or \"Error\"\n\n### Links\n\n- Use `href: '../TypeName/'` for type references (with trailing slash)\n- Use `<Link href=\"/api/parse/\">\\`parse\\`</Link>`in MDX prose (import from`~/components`)\n- Link to related guides when relevant: `<Link href=\"/guides/objects/\">object guide</Link>`\n\n## Update Related Files\n\n### menu.md\n\nAdd alphabetically to `/website/src/routes/api/menu.md`:\n\n```markdown\n## Schemas\n\n- [any](/api/any/)\n- [newSchema](/api/newSchema/) ← Add here\n- [string](/api/string/)\n```\n\n### Related Sections of Other API Docs\n\nExisting API pages have a `## Related` section with `<ApiList>` components. When adding a new API, update related APIs to include the new one.\n\n**Rule:** An API is \"related\" if:\n\n- It makes sense to use it as an argument of the other API, or vice versa\n- It makes sense to use them together in the same `pipe` (e.g., `v.pipe(v.string(), v.email())` → `string` and `email` are related)\n\nExamples:\n\n- `string` schema lists `email` action because they work together in a pipe\n- `email` action lists `string` schema because it validates string input\n- `pipe` method lists all schemas because any schema can be piped\n- `minLength` action lists `string`, `array`, `tuple` because it validates their length\n\n**Process:**\n\n1. Review a few existing API docs in the same category to understand the pattern\n2. Check `menu.md` to identify potentially related APIs\n3. For each related API, edit its `index.mdx` and add the new API to the appropriate `<ApiList>`\n\n**Shortcut:** If your new API is very similar to an existing one (e.g., `guard` is similar to `check`), add it everywhere the similar API appears. This ensures consistent coverage across all related docs.\n\n### Concept Guides\n\nAdd the new API to the appropriate guide in `/website/src/routes/guides/`:\n\n| API Category | Guide to Update                       |\n| ------------ | ------------------------------------- |\n| Schema       | `(main-concepts)/schemas/index.mdx`   |\n| Action       | `(main-concepts)/pipelines/index.mdx` |\n| Method       | `(main-concepts)/methods/index.mdx`   |\n\nAlso update topic-specific guides if relevant (e.g., `(schemas)/objects/`, `(schemas)/arrays/`, `(advanced)/async/`).\n\n### Type Documentation\n\nCreate pages for new types in `(types)/`:\n\n- Issue interfaces (e.g., `StringIssue`)\n- Schema/Action interfaces (e.g., `StringSchema`)\n\nType pages differ from function docs:\n\n- **No `source` field** in frontmatter\n- **No Examples or Related sections**\n- Use `## Definition` instead of `## Returns`\n\nType page structure:\n\n```mdx\n---\ntitle: StringSchema\ndescription: String schema interface.\ncontributors:\n  - github-username\n---\n\nimport { Property } from '~/components';\nimport { properties } from './properties';\n\n# StringSchema\n\nString schema interface.\n\n## Generics\n\n- \\`TMessage\\` <Property {...properties.TMessage} />\n\n## Definition\n\n- \\`StringSchema\\` <Property {...properties.BaseSchema} />\n  - \\`type\\` <Property {...properties.type} />\n  - \\`reference\\` <Property {...properties.reference} />\n  - \\`expects\\` <Property {...properties.expects} />\n  - \\`message\\` <Property {...properties.message} />\n```\n\n## Checklist\n\n- [ ] Read source file completely\n- [ ] `properties.ts` matches source types exactly\n- [ ] `index.mdx` signature matches source\n- [ ] All generics documented\n- [ ] All parameters documented\n- [ ] Examples are realistic with error messages\n- [ ] `menu.md` updated (alphabetically)\n- [ ] Related type pages created if needed\n- [ ] Related API docs updated (add new API to their `## Related` sections)\n- [ ] Concept guide updated (schemas/pipelines/methods)\n- [ ] All `href` links valid with trailing slashes\n","frontmatter":{"name":"repo-website-api-create","description":"Create new API reference pages for the Valibot website at website/src/routes/api/. Use when adding documentation for new schemas, actions, methods, or types. Covers reading source code, creating properties.ts and index.mdx files, updating menu.md, and cross-referencing related APIs."},"isInternal":false,"tokens":2549,"sizeBytes":10752},{"name":"SKILL.md","path":".agents/skills/repo-website-api-update/SKILL.md","rawUrl":"https://raw.githubusercontent.com/open-circle/valibot/HEAD/.agents/skills/repo-website-api-update/SKILL.md","title":"repo-website-api-update","category":"anthropic-skill","format":"markdown","content":"---\nname: repo-website-api-update\ndescription: Update existing API documentation pages after source code changes. Use when syncing docs with library changes like new parameters, type constraint changes, interface updates, or function renames. Covers common change patterns and verification steps.\n---\n\n# Updating API Documentation\n\nGuide for syncing API docs with source code changes.\n\n**Prerequisite:** Read the `repo-website-api-create` skill for `properties.ts` and `index.mdx` patterns.\n\n## When to Update\n\nUpdate documentation when source code changes:\n\n- Function signatures (parameters, generics, return types)\n- Interface properties\n- JSDoc descriptions or hints\n- Behavior changes affecting examples\n\n**Do NOT update for:** Internal implementation changes (`~run` method), test changes, non-JSDoc comments.\n\n## Process\n\n1. **Read full source file** - Don't just look at diff; understand complete current state\n2. **Identify changes** - Categorize as addition, removal, or modification\n3. **Update `properties.ts`** - Match types exactly to source; for optional object keys, keep the plain key name and use a union with `undefined` as the last option instead of appending `?`\n4. **Update `index.mdx`** - Signature, generics, parameters, examples\n5. **Update related files** - Type docs, `menu.md` if renamed\n\n## Common Change Types\n\n### New Parameter Added\n\n```typescript\n// Before: one overload\nexport function action<TInput>(requirement: TRequirement): Action<...>;\n\n// After: two overloads (message is optional)\nexport function action<TInput>(requirement: TRequirement): Action<..., undefined>;\nexport function action<TInput, TMessage>(requirement: TRequirement, message: TMessage): Action<..., TMessage>;\n```\n\nUpdate:\n\n1. Add `TMessage` generic to `properties.ts`\n2. Add `message` parameter to `properties.ts`\n3. Update signature in `index.mdx`\n4. Add generic and parameter documentation\n5. Update examples to show new parameter\n\n### Parameter Removed (Breaking)\n\n1. Remove from `properties.ts`\n2. Update signature in `index.mdx`\n3. Remove from Parameters section\n4. Update all examples\n5. Consider adding migration note in Explanation\n\n### Type Constraint Changed\n\n```typescript\n// Before\nTRequirement extends number\n\n// After\nTRequirement extends number | string\n```\n\nUpdate:\n\n1. Update type in `properties.ts`\n2. Update Explanation to mention both types\n3. Add examples for new type usage\n\n### Interface Property Added\n\n1. Update type documentation in `(types)/TypeName/`\n2. Add new property to `properties.ts`; if the source key is optional, do not append `?` to the key name and model it as a union with `undefined` last\n3. Document in Definition section\n\n### Function Renamed\n\n1. Rename folder\n2. Update all references in files\n3. Update `menu.md` (maintain alphabetical order)\n4. Update cross-references in related API docs\n5. Consider redirect if widely used\n\n### Deprecation\n\nAdd notice at top of `index.mdx` (import `Link` from `~/components`):\n\n```mdx\n> **⚠️ Deprecated**: Use <Link href=\"../newFunction/\">\\`newFunction\\`</Link> instead. Will be removed in v2.0.\n```\n\n### New Helper Type Introduced\n\nWhen source introduces a type alias:\n\n```typescript\n// Before: TInput extends string | unknown[]\n// After: TInput extends LengthInput\n```\n\n1. Update `properties.ts` to reference new type with `href`\n2. Create documentation for the new type in `(types)/`\n3. Update explanation if supported types changed\n\n### Multiple Overloads Added (Sync/Async)\n\nWhen sync and async variants are added:\n\n1. Update signature to show general pattern or both overloads\n2. Add explanation about sync vs async usage\n3. Add examples for both use cases\n4. Update Related section for async schemas if relevant\n\n## Related Files to Update\n\nWhen a function changes, check:\n\n- **Type docs** - If interfaces changed (`(types)/TypeName/`)\n- **Related API docs** - Other APIs that reference this function in their Related section\n- **Guide files** - If usage patterns changed significantly\n- **menu.md** - If function renamed or moved\n\n## Verification\n\nAfter updating, verify:\n\n- [ ] All types match source exactly\n- [ ] Function signature matches source\n- [ ] All examples work with new API\n- [ ] All `href` links are valid\n- [ ] Related type docs updated if interfaces changed\n- [ ] `menu.md` updated if renamed\n- [ ] Related API docs updated (their Related sections)\n\n## Best Practices\n\n- **Read full source file** - Don't just look at diff\n- **Update incrementally** - `properties.ts` → `index.mdx` → related files\n- **Don't over-document internals** - Only user-facing changes need docs\n- **Preserve example quality** - Keep realistic, demonstrate best practices\n- **Check related APIs** - They may reference the changed function\n\n## When to Ask for Help\n\n- Major breaking changes (complete signature overhaul)\n- Complex generic constraint changes\n- Unclear intent from source changes\n- Many related files affected\n- Need to document migration path\n\n## Quick Reference\n\n| Change            | Files to Update                                                      |\n| ----------------- | -------------------------------------------------------------------- |\n| New parameter     | `properties.ts`, `index.mdx` (signature, generics, params, examples) |\n| Removed parameter | `properties.ts`, `index.mdx`                                         |\n| Type change       | `properties.ts`, `index.mdx` (explanation, examples)                 |\n| Interface change  | `(types)/TypeName/properties.ts`, `(types)/TypeName/index.mdx`       |\n| Renamed function  | Folder name, all files, `menu.md`, cross-references                  |\n| Deprecation       | `index.mdx` (add warning)                                            |\n","frontmatter":{"name":"repo-website-api-update","description":"Update existing API documentation pages after source code changes. Use when syncing docs with library changes like new parameters, type constraint changes, interface updates, or function renames. Covers common change patterns and verification steps."},"isInternal":false,"tokens":1269,"sizeBytes":5720},{"name":"SKILL.md","path":".agents/skills/repo-website-guide-create/SKILL.md","rawUrl":"https://raw.githubusercontent.com/open-circle/valibot/HEAD/.agents/skills/repo-website-guide-create/SKILL.md","title":"repo-website-guide-create","category":"anthropic-skill","format":"markdown","content":"---\nname: repo-website-guide-create\ndescription: Create conceptual documentation and tutorial pages for the Valibot website at website/src/routes/guides/. Use when adding guides about schemas, pipelines, async validation, migration, or other topics. Covers directory structure, MDX templates, frontmatter, and content guidelines.\n---\n\n# Adding Guides to Website\n\nGuide for creating conceptual documentation at `website/src/routes/guides/`.\n\n## Directory Structure\n\n```\nwebsite/src/routes/guides/\n├── menu.md                    # Navigation menu\n├── (get-started)/             # Intro, installation, quick start\n├── (main-concepts)/           # Schemas, pipelines, parsing\n├── (schemas)/                 # Objects, arrays, unions\n├── (advanced)/                # Async, i18n, JSON Schema\n├── (migration)/               # Version upgrades, Zod migration\n└── (category)/guide-slug/\n    └── index.mdx              # Guide content\n```\n\nNote: Category folders use parentheses (Qwik route grouping).\n\n## Process\n\n1. Review 2-3 existing guides in the target category to understand style\n2. Choose category from existing or create new\n3. Create folder: `(category)/guide-slug/`\n4. Create `index.mdx` with content\n5. Update `menu.md`\n\n## index.mdx Template\n\n```mdx\n---\ntitle: Guide Title\ndescription: >-\n  A concise description of what this guide covers.\ncontributors:\n  - github-username\n---\n\nimport { ApiList, Link } from '~/components';\n\n# Guide Title\n\nOpening paragraph explaining what the reader will learn.\n\n## Section Heading\n\nContent with clear, concise language.\n\n\\`\\`\\`ts\nimport \\* as v from 'valibot';\n\nconst Schema = v.object({\nname: v.string(),\nemail: v.pipe(v.string(), v.email()),\n});\n\\`\\`\\`\n\n## Another Section\n\nContinue with additional sections as needed.\n\nUse <Link href=\"/api/pipe/\">\\`pipe\\`</Link> for internal links.\n```\n\n## Frontmatter\n\nRequired fields:\n\n- **title**: Page title and navigation label\n- **description**: SEO description (use `>-` for multi-line)\n- **contributors**: Array of GitHub usernames\n\n## Content Guidelines\n\n### Code Examples\n\n- Use TypeScript (`ts` language)\n- Import as `import * as v from 'valibot';`\n- Include comments for complex code\n\n### Links\n\nInternal links use the `Link` component:\n\n```mdx\n<Link href=\"/guides/schemas/\">schemas guide</Link>\n<Link href=\"/api/pipe/\">\\`pipe\\`</Link>\n```\n\n### Components\n\n```mdx\n<ApiList label=\"Related schemas\" items={['object', 'array', 'string']} />\n```\n\n### Formatting\n\n- `inline code` for API names, variables, file names\n- **bold** for genuine emphasis only — not as inline section labels\n- Proper heading hierarchy (h1 title, h2 sections, h3 subsections)\n\n### Writing tone\n\n- Write conversational prose, not terse reference-doc style\n- Use first-person plural: \"we recommend\" not \"you should\"\n- Do not use bold as inline section labels (e.g. avoid `**Label:** content`). Use a proper subheading instead\n- Do not prefix blockquotes with bold labels (e.g. avoid `> **Note:** ...`). A plain `>` is correct\n- Bullet list items do not need a bold prefix on each item\n\n### Images\n\nPlace images in the same folder as `index.mdx`:\n\n```mdx\n![Alt text](./diagram-light.jpg)\n```\n\nConsider light/dark theme variants if applicable (e.g., `diagram-light.jpg`, `diagram-dark.jpg`).\n\n## Update menu.md\n\nAdd to `/website/src/routes/guides/menu.md`:\n\n```markdown\n## Category Name\n\n- [Existing Guide](/guides/existing/)\n- [New Guide Title](/guides/guide-slug/)\n```\n\nMaintain logical ordering within categories.\n\n## Checklist\n\n- [ ] Reviewed existing guides in the same category\n- [ ] Folder structure: `(category)/guide-slug/index.mdx`\n- [ ] Frontmatter: title, description, contributors\n- [ ] Internal links use `Link` component\n- [ ] Code examples use `import * as v from 'valibot';`\n- [ ] Added to `menu.md`\n- [ ] Style matches existing guides\n","frontmatter":{"name":"repo-website-guide-create","description":"Create conceptual documentation and tutorial pages for the Valibot website at website/src/routes/guides/. Use when adding guides about schemas, pipelines, async validation, migration, or other topics. Covers directory structure, MDX templates, frontmatter, and content guidelines."},"isInternal":false,"tokens":944,"sizeBytes":3861},{"name":"SKILL.md","path":"website/public/.well-known/agent-skills/valibot/SKILL.md","rawUrl":"https://raw.githubusercontent.com/open-circle/valibot/HEAD/website/public/.well-known/agent-skills/valibot/SKILL.md","title":"valibot","category":"anthropic-skill","format":"markdown","content":"---\nname: valibot\ndescription: Schema validation with Valibot, the modular and type-safe schema library. Use when the user needs to validate data, create schemas, parse inputs, or work with Valibot in their project. Also use when migrating from Zod to Valibot.\nlicense: MIT\nmetadata:\n  author: open-circle\n  version: \"1.0\"\n---\n\n# Valibot\n\nThis skill helps you work effectively with [Valibot](https://valibot.dev), the modular and type-safe schema library for validating structural data.\n\n## When to use this skill\n\n- When the user asks about schema validation with Valibot\n- When creating or modifying Valibot schemas\n- When parsing or validating user input\n- When the user mentions Valibot, schema, or validation\n- When migrating from Zod to Valibot\n\n## CRITICAL: Valibot vs Zod — Do Not Confuse!\n\n**Valibot and Zod have different APIs. Never mix them up!**\n\n### Key Differences\n\n| Feature             | Zod ❌                                | Valibot ✅                                                |\n| ------------------- | ------------------------------------- | --------------------------------------------------------- |\n| Import              | `import { z } from 'zod'`             | `import * as v from 'valibot'`                            |\n| Validations         | Chained methods: `.email().min(5)`    | Pipeline: `v.pipe(v.string(), v.email(), v.minLength(5))` |\n| Parsing             | `schema.parse(data)`                  | `v.parse(schema, data)`                                   |\n| Safe parsing        | `schema.safeParse(data)`              | `v.safeParse(schema, data)`                               |\n| Optional            | `z.string().optional()`               | `v.optional(v.string())`                                  |\n| Nullable            | `z.string().nullable()`               | `v.nullable(v.string())`                                  |\n| Default             | `z.string().default('x')`             | `v.optional(v.string(), 'x')`                             |\n| Transform           | `z.string().transform(fn)`            | `v.pipe(v.string(), v.transform(fn))`                     |\n| Refine/Check        | `z.string().refine(fn)`               | `v.pipe(v.string(), v.check(fn))`                         |\n| Enum                | `z.enum(['a', 'b'])`                  | `v.picklist(['a', 'b'])`                                  |\n| Native enum         | `z.nativeEnum(MyEnum)`                | `v.enum(MyEnum)`                                          |\n| Union               | `z.union([a, b])`                     | `v.union([a, b])`                                         |\n| Discriminated union | `z.discriminatedUnion('type', [...])` | `v.variant('type', [...])`                                |\n| Intersection        | `z.intersection(a, b)`                | `v.intersect([a, b])`                                     |\n| Min/max length      | `.min(5).max(10)`                     | `v.minLength(5), v.maxLength(10)`                         |\n| Min/max value       | `.gte(5).lte(10)`                     | `v.minValue(5), v.maxValue(10)`                           |\n| Infer type          | `z.infer<typeof Schema>`              | `v.InferOutput<typeof Schema>`                            |\n| Infer input         | `z.input<typeof Schema>`              | `v.InferInput<typeof Schema>`                             |\n\n### Common Mistakes to Avoid\n\n```typescript\n// ❌ WRONG - This is Zod syntax, NOT Valibot!\nconst Schema = v.string().email().min(5);\nconst result = Schema.parse(data);\n\n// ✅ CORRECT - Valibot uses functions and pipelines\nconst Schema = v.pipe(v.string(), v.email(), v.minLength(5));\nconst result = v.parse(Schema, data);\n```\n\n```typescript\n// ❌ WRONG - Zod-style optional\nconst Schema = v.object({\n  name: v.string().optional(),\n});\n\n// ✅ CORRECT - Valibot wraps with optional()\nconst Schema = v.object({\n  name: v.optional(v.string()),\n});\n```\n\n```typescript\n// ❌ WRONG - Zod-style default\nconst Schema = v.string().default(\"hello\");\n\n// ✅ CORRECT - Valibot uses second argument\nconst Schema = v.optional(v.string(), \"hello\");\n```\n\n## Installation\n\n```bash\nnpm install valibot     # npm\nyarn add valibot        # yarn\npnpm add valibot        # pnpm\nbun add valibot         # bun\n```\n\nImport with a wildcard (recommended):\n\n```typescript\nimport * as v from \"valibot\";\n```\n\nOr with individual imports:\n\n```typescript\nimport { object, string, pipe, email, parse } from \"valibot\";\n```\n\n## Mental Model\n\nValibot's API is divided into three main concepts:\n\n### 1. Schemas\n\nSchemas define the expected data type. They are the starting point.\n\n```typescript\nimport * as v from \"valibot\";\n\n// Primitive schemas\nconst StringSchema = v.string();\nconst NumberSchema = v.number();\nconst BooleanSchema = v.boolean();\nconst DateSchema = v.date();\n\n// Complex schemas\nconst ArraySchema = v.array(v.string());\nconst ObjectSchema = v.object({\n  name: v.string(),\n  age: v.number(),\n});\n```\n\n### 2. Methods\n\nMethods help you use or modify schemas. The schema is always the first argument.\n\n```typescript\n// Parsing\nconst result = v.parse(StringSchema, \"hello\");\nconst safeResult = v.safeParse(StringSchema, \"hello\");\n\n// Type guard\nif (v.is(StringSchema, data)) {\n  // data is typed as string\n}\n```\n\n### 3. Actions\n\nActions validate or transform data within a `pipe()`. They MUST be used inside pipelines.\n\n```typescript\n// Actions are used in pipe()\nconst EmailSchema = v.pipe(\n  v.string(),\n  v.trim(),\n  v.email(),\n  v.endsWith(\"@example.com\"),\n);\n```\n\n## Pipelines\n\nPipelines extend schemas with validation and transformation actions. A pipeline always starts with a schema, followed by actions.\n\n```typescript\nimport * as v from \"valibot\";\n\nconst UsernameSchema = v.pipe(\n  v.string(),\n  v.trim(),\n  v.minLength(3, \"Username must be at least 3 characters\"),\n  v.maxLength(20, \"Username must be at most 20 characters\"),\n  v.regex(\n    /^[a-z0-9_]+$/i,\n    \"Username can only contain letters, numbers, and underscores\",\n  ),\n);\n\nconst AgeSchema = v.pipe(\n  v.number(),\n  v.integer(\"Age must be a whole number\"),\n  v.minValue(0, \"Age cannot be negative\"),\n  v.maxValue(150, \"Age cannot exceed 150\"),\n);\n```\n\n### Common Validation Actions\n\n**String validations:**\n\n- `v.email()` — Valid email format\n- `v.url()` — Valid URL format\n- `v.uuid()` — Valid UUID format\n- `v.regex(pattern)` — Match regex pattern\n- `v.minLength(n)` — Minimum length\n- `v.maxLength(n)` — Maximum length\n- `v.length(n)` — Exact length\n- `v.nonEmpty()` — Not empty string\n- `v.startsWith(str)` — Starts with string\n- `v.endsWith(str)` — Ends with string\n- `v.includes(str)` — Contains string\n\n**Number validations:**\n\n- `v.minValue(n)` — Minimum value (>=)\n- `v.maxValue(n)` — Maximum value (<=)\n- `v.gtValue(n)` — Greater than (>)\n- `v.ltValue(n)` — Less than (<)\n- `v.integer()` — Must be integer\n- `v.finite()` — Must be finite\n- `v.safeInteger()` — Safe integer range\n- `v.multipleOf(n)` — Must be multiple of n\n\n**Array validations:**\n\n- `v.minLength(n)` — Minimum items\n- `v.maxLength(n)` — Maximum items\n- `v.length(n)` — Exact item count\n- `v.nonEmpty()` — At least one item\n- `v.includes(item)` — Contains item\n- `v.excludes(item)` — Does not contain item\n\n### Custom Validation with check()\n\n```typescript\nconst PasswordSchema = v.pipe(\n  v.string(),\n  v.minLength(8),\n  v.check(\n    (input) => /[A-Z]/.test(input),\n    \"Password must contain an uppercase letter\",\n  ),\n  v.check((input) => /[0-9]/.test(input), \"Password must contain a number\"),\n);\n```\n\n### Value Transformations\n\nThese actions modify the value without changing its type:\n\n**String transformations:**\n\n- `v.trim()` — Remove leading/trailing whitespace\n- `v.trimStart()` — Remove leading whitespace\n- `v.trimEnd()` — Remove trailing whitespace\n- `v.toLowerCase()` — Convert to lowercase\n- `v.toUpperCase()` — Convert to uppercase\n\n**Number transformations:**\n\n- `v.toMinValue(n)` — Clamp to minimum value (if less than n, set to n)\n- `v.toMaxValue(n)` — Clamp to maximum value (if greater than n, set to n)\n\n```typescript\nconst NormalizedEmailSchema = v.pipe(\n  v.string(),\n  v.trim(),\n  v.toLowerCase(),\n  v.email(),\n);\n\n// Clamp number to range 0-100\nconst PercentageSchema = v.pipe(v.number(), v.toMinValue(0), v.toMaxValue(100));\n```\n\n### Type Transformations\n\nFor converting between data types, use these built-in transformation actions:\n\n- `v.toNumber()` — Convert to number\n- `v.toString()` — Convert to string\n- `v.toBoolean()` — Convert to boolean\n- `v.toBigint()` — Convert to bigint\n- `v.toDate()` — Convert to Date\n\n```typescript\n// Convert string to number\nconst PortSchema = v.pipe(v.string(), v.toNumber(), v.integer(), v.minValue(1));\n\n// Convert ISO string to Date\nconst TimestampSchema = v.pipe(v.string(), v.isoDateTime(), v.toDate());\n\n// Convert to boolean\nconst FlagSchema = v.pipe(v.string(), v.toBoolean());\n```\n\n### Custom Transformations\n\nFor custom transformations, use `v.transform()`:\n\n```typescript\nconst DateStringSchema = v.pipe(\n  v.string(),\n  v.isoDate(),\n  v.transform((input) => new Date(input)),\n);\n\n// Custom object transformation\nconst UserSchema = v.pipe(\n  v.object({\n    firstName: v.string(),\n    lastName: v.string(),\n  }),\n  v.transform((input) => ({\n    ...input,\n    fullName: `${input.firstName} ${input.lastName}`,\n  })),\n);\n```\n\n## Object Schemas\n\n### Basic Object\n\n```typescript\nconst UserSchema = v.object({\n  id: v.number(),\n  name: v.string(),\n  email: v.pipe(v.string(), v.email()),\n  age: v.optional(v.number()),\n});\n\ntype User = v.InferOutput<typeof UserSchema>;\n```\n\n### Object Variants\n\n```typescript\n// Regular object - strips unknown keys (default)\nconst ObjectSchema = v.object({ key: v.string() });\n\n// Loose object - allows and preserves unknown keys\nconst LooseObjectSchema = v.looseObject({ key: v.string() });\n\n// Strict object - throws on unknown keys\nconst StrictObjectSchema = v.strictObject({ key: v.string() });\n\n// Object with rest - validates unknown keys against a schema\nconst ObjectWithRestSchema = v.objectWithRest(\n  { key: v.string() },\n  v.number(), // unknown keys must be numbers\n);\n```\n\n### Optional and Nullable Fields\n\n```typescript\nconst ProfileSchema = v.object({\n  // Required\n  name: v.string(),\n\n  // Optional (can be undefined or missing)\n  nickname: v.optional(v.string()),\n\n  // Optional with default\n  role: v.optional(v.string(), \"user\"),\n\n  // Nullable (can be null)\n  avatar: v.nullable(v.string()),\n\n  // Nullish (can be null or undefined)\n  bio: v.nullish(v.string()),\n\n  // Nullish with default\n  theme: v.nullish(v.string(), \"light\"),\n});\n```\n\n### Object Methods\n\n```typescript\nconst BaseSchema = v.object({\n  id: v.number(),\n  name: v.string(),\n  email: v.string(),\n  password: v.string(),\n});\n\n// Pick specific keys\nconst PublicUserSchema = v.pick(BaseSchema, [\"id\", \"name\"]);\n\n// Omit specific keys\nconst UserWithoutPasswordSchema = v.omit(BaseSchema, [\"password\"]);\n\n// Make all optional\nconst PartialUserSchema = v.partial(BaseSchema);\n\n// Make all required\nconst RequiredUserSchema = v.required(PartialUserSchema);\n\n// Merge objects\nconst ExtendedUserSchema = v.object({\n  ...BaseSchema.entries,\n  createdAt: v.date(),\n});\n```\n\n### Cross-Field Validation\n\n```typescript\nconst RegistrationSchema = v.pipe(\n  v.object({\n    password: v.pipe(v.string(), v.minLength(8)),\n    confirmPassword: v.string(),\n  }),\n  v.forward(\n    v.partialCheck(\n      [[\"password\"], [\"confirmPassword\"]],\n      (input) => input.password === input.confirmPassword,\n      \"Passwords do not match\",\n    ),\n    [\"confirmPassword\"],\n  ),\n);\n```\n\n## Arrays and Tuples\n\n### Arrays\n\n```typescript\nconst TagsSchema = v.pipe(\n  v.array(v.string()),\n  v.minLength(1, \"At least one tag required\"),\n  v.maxLength(10, \"Maximum 10 tags allowed\"),\n);\n\n// Array of objects\nconst UsersSchema = v.array(\n  v.object({\n    id: v.number(),\n    name: v.string(),\n  }),\n);\n```\n\n### Tuples\n\n```typescript\n// Fixed-length array with specific types\nconst CoordinatesSchema = v.tuple([v.number(), v.number()]);\n// Type: [number, number]\n\n// Tuple with rest\nconst ArgsSchema = v.tupleWithRest(\n  [v.string()], // first arg is string\n  v.number(), // rest are numbers\n);\n// Type: [string, ...number[]]\n```\n\n## Unions and Variants\n\n### Union\n\n```typescript\nconst StringOrNumberSchema = v.union([v.string(), v.number()]);\n\nconst StatusSchema = v.union([\n  v.literal(\"pending\"),\n  v.literal(\"active\"),\n  v.literal(\"inactive\"),\n]);\n```\n\n### Picklist (for string/number literals)\n\n```typescript\n// Simpler than union of literals\nconst StatusSchema = v.picklist([\"pending\", \"active\", \"inactive\"]);\n\nconst PrioritySchema = v.picklist([1, 2, 3]);\n```\n\n### Variant (discriminated union)\n\nUse `variant` for better performance with discriminated unions:\n\n```typescript\nconst EventSchema = v.variant(\"type\", [\n  v.object({\n    type: v.literal(\"click\"),\n    x: v.number(),\n    y: v.number(),\n  }),\n  v.object({\n    type: v.literal(\"keypress\"),\n    key: v.string(),\n  }),\n  v.object({\n    type: v.literal(\"scroll\"),\n    direction: v.picklist([\"up\", \"down\"]),\n  }),\n]);\n```\n\n## Parsing Data\n\n### parse() — Throws on Error\n\n```typescript\nimport * as v from \"valibot\";\n\nconst EmailSchema = v.pipe(v.string(), v.email());\n\ntry {\n  const email = v.parse(EmailSchema, \"jane@example.com\");\n  console.log(email); // 'jane@example.com'\n} catch (error) {\n  console.error(error); // ValiError\n}\n```\n\n### safeParse() — Returns Result Object\n\n```typescript\nconst result = v.safeParse(EmailSchema, input);\n\nif (result.success) {\n  console.log(result.output); // Valid data\n} else {\n  console.log(result.issues); // Array of issues\n}\n```\n\n### is() — Type Guard\n\n```typescript\nif (v.is(EmailSchema, input)) {\n  // input is typed as string\n}\n```\n\n### Configuration Options\n\n```typescript\n// Abort early - stop at first error\nv.parse(Schema, data, { abortEarly: true });\n\n// Abort pipe early - stop pipeline at first error\nv.parse(Schema, data, { abortPipeEarly: true });\n```\n\n## Type Inference\n\n```typescript\nimport * as v from \"valibot\";\n\nconst UserSchema = v.object({\n  name: v.string(),\n  age: v.pipe(v.string(), v.transform(Number)),\n  role: v.optional(v.string(), \"user\"),\n});\n\n// Output type (after transformations and defaults)\ntype User = v.InferOutput<typeof UserSchema>;\n// { name: string; age: number; role: string }\n\n// Input type (before transformations)\ntype UserInput = v.InferInput<typeof UserSchema>;\n// { name: string; age: string; role?: string | undefined }\n\n// Issue type\ntype UserIssue = v.InferIssue<typeof UserSchema>;\n```\n\n## Error Handling\n\n### Custom Error Messages\n\n```typescript\nconst LoginSchema = v.object({\n  email: v.pipe(\n    v.string(\"Email must be a string\"),\n    v.nonEmpty(\"Please enter your email\"),\n    v.email(\"Invalid email format\"),\n  ),\n  password: v.pipe(\n    v.string(\"Password must be a string\"),\n    v.nonEmpty(\"Please enter your password\"),\n    v.minLength(8, \"Password must be at least 8 characters\"),\n  ),\n});\n```\n\n### Flattening Errors\n\n```typescript\nconst result = v.safeParse(LoginSchema, data);\n\nif (!result.success) {\n  const flat = v.flatten(result.issues);\n  // { nested: { email: ['Invalid email format'], password: ['...'] } }\n}\n```\n\n### Issue Structure\n\nEach issue contains:\n\n- `kind`: 'schema' | 'validation' | 'transformation'\n- `type`: Function name (e.g., 'string', 'email', 'min_length')\n- `input`: The problematic input\n- `expected`: What was expected\n- `received`: What was received\n- `message`: Human-readable message\n- `path`: Array of path items for nested issues\n\n## Fallback Values\n\n```typescript\n// Static fallback\nconst NumberSchema = v.fallback(v.number(), 0);\nv.parse(NumberSchema, \"invalid\"); // Returns 0\n\n// Dynamic fallback\nconst DateSchema = v.fallback(v.date(), () => new Date());\n```\n\n## Recursive Schemas\n\n```typescript\nimport * as v from \"valibot\";\n\ntype TreeNode = {\n  value: string;\n  children: TreeNode[];\n};\n\nconst TreeNodeSchema: v.GenericSchema<TreeNode> = v.object({\n  value: v.string(),\n  children: v.lazy(() => v.array(TreeNodeSchema)),\n});\n```\n\n## Async Validation\n\nFor async operations (e.g., database checks), use async variants:\n\n```typescript\nimport * as v from \"valibot\";\n\nconst isUsernameAvailable = async (username: string) => {\n  // Check database\n  return true;\n};\n\nconst UsernameSchema = v.pipeAsync(\n  v.string(),\n  v.minLength(3),\n  v.checkAsync(isUsernameAvailable, \"Username is already taken\"),\n);\n\n// Must use parseAsync\nconst username = await v.parseAsync(UsernameSchema, \"john\");\n```\n\n## JSON Schema Conversion\n\n```typescript\nimport { toJsonSchema } from \"@valibot/to-json-schema\";\nimport * as v from \"valibot\";\n\nconst EmailSchema = v.pipe(v.string(), v.email());\nconst jsonSchema = toJsonSchema(EmailSchema);\n// { type: 'string', format: 'email' }\n```\n\n## Naming Conventions\n\n### Convention 1: Same Name (Recommended for simplicity)\n\n```typescript\nexport const User = v.object({\n  name: v.string(),\n  email: v.pipe(v.string(), v.email()),\n});\n\nexport type User = v.InferOutput<typeof User>;\n\n// Usage\nconst users: User[] = [];\nusers.push(v.parse(User, data));\n```\n\n### Convention 2: With Suffixes (Recommended when input/output differ)\n\n```typescript\nexport const UserSchema = v.object({\n  name: v.string(),\n  age: v.pipe(v.string(), v.transform(Number)),\n});\n\nexport type UserInput = v.InferInput<typeof UserSchema>;\nexport type UserOutput = v.InferOutput<typeof UserSchema>;\n```\n\n## Common Patterns\n\n### Login Form\n\n```typescript\nconst LoginSchema = v.object({\n  email: v.pipe(\n    v.string(),\n    v.nonEmpty(\"Please enter your email\"),\n    v.email(\"Invalid email address\"),\n  ),\n  password: v.pipe(\n    v.string(),\n    v.nonEmpty(\"Please enter your password\"),\n    v.minLength(8, \"Password must be at least 8 characters\"),\n  ),\n});\n```\n\n### API Response\n\n```typescript\nconst ApiResponseSchema = v.variant(\"status\", [\n  v.object({\n    status: v.literal(\"success\"),\n    data: v.unknown(),\n  }),\n  v.object({\n    status: v.literal(\"error\"),\n    error: v.object({\n      code: v.string(),\n      message: v.string(),\n    }),\n  }),\n]);\n```\n\n### Environment Variables\n\n```typescript\nconst EnvSchema = v.object({\n  NODE_ENV: v.picklist([\"development\", \"production\", \"test\"]),\n  PORT: v.pipe(v.string(), v.transform(Number), v.integer(), v.minValue(1)),\n  DATABASE_URL: v.pipe(v.string(), v.url()),\n  API_KEY: v.pipe(v.string(), v.minLength(32)),\n});\n\nconst env = v.parse(EnvSchema, process.env);\n```\n\n### Date Handling\n\n```typescript\n// String to Date\nconst DateFromStringSchema = v.pipe(\n  v.string(),\n  v.isoDate(),\n  v.transform((input) => new Date(input)),\n);\n\n// Date validation\nconst FutureDateSchema = v.pipe(\n  v.date(),\n  v.minValue(new Date(), \"Date must be in the future\"),\n);\n```\n\n## Additional Resources\n\n- [Valibot Documentation](https://valibot.dev)\n- [Valibot GitHub](https://github.com/open-circle/valibot)\n- [API Reference](https://valibot.dev/api/)\n- [Migration from Zod](https://valibot.dev/guides/migrate-from-zod/)\n","frontmatter":{"name":"valibot","description":"Schema validation with Valibot, the modular and type-safe schema library. Use when the user needs to validate data, create schemas, parse inputs, or work with Valibot in their project. Also use when migrating from Zod to Valibot.","license":"MIT","metadata":{"author":"open-circle","version":"1.0"}},"isInternal":false,"tokens":4669,"sizeBytes":18962},{"name":"README.md","path":"packages/to-json-schema/README.md","rawUrl":"https://raw.githubusercontent.com/open-circle/valibot/HEAD/packages/to-json-schema/README.md","title":"to-json-schema Documentation","category":"plugin-manifest","format":"markdown","content":"# Valibot to JSON Schema\n\nUtility to convert [Valibot](https://valibot.dev) schemas to JSON Schema. Supports JSON Schema draft-07, draft-2020-12, and OpenAPI 3.0 Schema Object formats.\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\ntoJsonSchema(v.string()); // { $schema: \"http://json-schema.org/draft-07/schema#\", type: \"string\" }\n```\n\nThis package is particularly popular for:\n\n- **API Documentation**: Generate OpenAPI specifications from your Valibot schemas\n- **Code Generation**: Create client SDKs and types from your validation schemas\n- **LLM Integration**: Generate structured outputs for Large Language Models\n- **Schema Sharing**: Share validation logic between different programming languages\n\n> Some Valibot features can't be mapped to JSON schema. For example, transformation actions have no equivalent in JSON schema. Also, some Valibot schemas or validations are too JS-specific and do not have an equivalent JSON schema attribute.\n\n## Supported features\n\n**Note**: Converted schemas may behave slightly differently in JSON schema validators (especially for string format) because their implementation is different from Valibot's.\n\n| Schema           | Status | Note                                                                                                                                  |\n| ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------- |\n| `any`            | ✅     |                                                                                                                                       |\n| `array`          | ✅     |                                                                                                                                       |\n| `boolean`        | ✅     |                                                                                                                                       |\n| `enum`           | ⚠️     | Only JSON compatible values are supported                                                                                             |\n| `exactOptional`  | ✅     |                                                                                                                                       |\n| `intersect`      | ✅     |                                                                                                                                       |\n| `lazy`           | ⚠️     | The `.getter` function is always executed with `undefined` as input                                                                   |\n| `literal`        | ⚠️     | Only JSON compatible values are supported                                                                                             |\n| `looseObject`    | ✅     |                                                                                                                                       |\n| `looseTuple`     | ✅     |                                                                                                                                       |\n| `never`          | ✅     |                                                                                                                                       |\n| `null`           | ✅     |                                                                                                                                       |\n| `nullable`       | ✅     |                                                                                                                                       |\n| `nullish`        | ✅     |                                                                                                                                       |\n| `number`         | ✅     |                                                                                                                                       |\n| `objectWithRest` | ✅     |                                                                                                                                       |\n| `object`         | ✅     |                                                                                                                                       |\n| `optional`       | ✅     |                                                                                                                                       |\n| `picklist`       | ⚠️     | Only JSON compatible values are supported                                                                                             |\n| `record`         | ⚠️     | Only `string` schemas for the key of the record are supported. Adds `propertyNames` for key validation (not available in OpenAPI 3.0) |\n| `strictObject`   | ✅     |                                                                                                                                       |\n| `strictTuple`    | ✅     |                                                                                                                                       |\n| `string`         | ✅     |                                                                                                                                       |\n| `tupleWithRest`  | ✅     |                                                                                                                                       |\n| `tuple`          | ✅     |                                                                                                                                       |\n| `union`          | ✅     |                                                                                                                                       |\n| `undefinedable`  | ✅     |                                                                                                                                       |\n| `unknown`        | ✅     |                                                                                                                                       |\n| `variant`        | ⚠️     | The discriminator key will be ignored                                                                                                 |\n\n| Actions         | Status | Note                                                   |\n| --------------- | ------ | ------------------------------------------------------ |\n| `base64`        | ✅     |                                                        |\n| `bic`           | ✅     |                                                        |\n| `cuid2`         | ✅     |                                                        |\n| `decimal`       | ✅     |                                                        |\n| `description`   | ✅     |                                                        |\n| `digits`        | ✅     |                                                        |\n| `domain`        | ✅     |                                                        |\n| `email`         | ✅     |                                                        |\n| `emoji`         | ✅     |                                                        |\n| `empty`         | ✅     |                                                        |\n| `endsWith`      | ✅     |                                                        |\n| `entries`       | ✅     |                                                        |\n| `examples`      | ✅     |                                                        |\n| `gtValue`       | ⚠️     | Only in combination with `number` and `integer` schema |\n| `hash`          | ✅     |                                                        |\n| `hexadecimal`   | ✅     |                                                        |\n| `hexColor`      | ✅     |                                                        |\n| `includes`      | ✅     |                                                        |\n| `integer`       | ✅     |                                                        |\n| `ipv4`          | ✅     |                                                        |\n| `ipv6`          | ✅     |                                                        |\n| `isoDate`       | ✅     |                                                        |\n| `isoDateTime`   | ✅     |                                                        |\n| `isoTime`       | ✅     |                                                        |\n| `isoTimeSecond` | ✅     |                                                        |\n| `isoTimestamp`  | ✅     |                                                        |\n| `isoWeek`       | ✅     |                                                        |\n| `isrc`          | ✅     |                                                        |\n| `jwsCompact`    | ✅     |                                                        |\n| `ksuid`         | ✅     |                                                        |\n| `length`        | ⚠️     | Only in combination with `string` and `array` schema   |\n| `ltValue`       | ⚠️     | Only in combination with `number` and `integer` schema |\n| `mac`           | ✅     |                                                        |\n| `mac48`         | ✅     |                                                        |\n| `mac64`         | ✅     |                                                        |\n| `maxEntries`    | ✅     |                                                        |\n| `maxLength`     | ⚠️     | Only in combination with `string` and `array` schema   |\n| `maxValue`      | ⚠️     | Only in combination with `number` schema               |\n| `metadata`      | ✅     | Additional properties are added without validation     |\n| `minEntries`    | ✅     |                                                        |\n| `minLength`     | ⚠️     | Only in combination with `string` and `array` schema   |\n| `minValue`      | ⚠️     | Only in combination with `number` schema               |\n| `multipleOf`    | ✅     |                                                        |\n| `nanoid`        | ✅     |                                                        |\n| `nonEmpty`      | ✅     |                                                        |\n| `notValue`      | ⚠️     | Only JSON compatible values are supported              |\n| `notValues`     | ⚠️     | Only JSON compatible values are supported              |\n| `octal`         | ✅     |                                                        |\n| `regex`         | ⚠️     | RegExp flags are not supported in JSON Schema          |\n| `rfcEmail`      | ✅     |                                                        |\n| `safeInteger`   | ✅     |                                                        |\n| `slug`          | ✅     |                                                        |\n| `startsWith`    | ✅     |                                                        |\n| `title`         | ✅     |                                                        |\n| `ulid`          | ✅     |                                                        |\n| `url`           | ✅     |                                                        |\n| `uuid`          | ✅     |                                                        |\n| `value`         | ⚠️     | Only JSON compatible values are supported              |\n| `values`        | ⚠️     | Only JSON compatible values are supported              |\n\n> For `length`, `minLength`, and `maxLength`, string constraints have different length semantics in Valibot and JSON Schema. Valibot checks JavaScript string length (`value.length`, UTF-16 code units), while JSON Schema `minLength` and `maxLength` count Unicode code points. This can differ for non-BMP code points such as emoji and for multi-code-point grapheme clusters such as combining marks or ZWJ sequences.\n\n## Configurations\n\n| Option         | Type                                                                  | Note                                                                                                                      |\n| -------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |\n| target         | `'draft-07' \\| 'draft-2020-12' \\| 'openapi-3.0'`                      | The target JSON Schema format. Defaults to `'draft-07'`.                                                                  |\n| typeMode       | `'ignore' \\| 'input' \\| 'output'`                                     | Whether to convert the input or output type of the Valibot schema to JSON Schema.                                         |\n| errorMode      | `'throw' \\| 'warn' \\| 'ignore'`                                       | The policy for handling incompatible schemas and actions.                                                                 |\n| definitions    | `Record<string, GenericSchema>`                                       | The schema definitions for constructing recursive schemas. If not specified, the definitions are generated automatically. |\n| overrideSchema | `(context: OverrideSchemaContext) => JsonSchema \\| null \\| undefined` | Overrides the JSON Schema conversion for a specific Valibot schema.                                                       |\n| ignoreActions  | `string[]`                                                            | The actions that should be ignored during the conversion.                                                                 |\n| overrideAction | `(context: OverrideActionContext) => JsonSchema \\| null \\| undefined` | Overrides the JSON Schema reference for a specific Valibot action.                                                        |\n| overrideRef    | `(context: OverrideRefContext) => string \\| null \\| undefined`        | Overrides the JSON Schema reference for a specific reference ID.                                                          |\n\n### Target format\n\nThe `target` configuration allows you to specify which JSON Schema format to generate. Different targets have different capabilities and syntax:\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst schema = v.nullable(v.string());\n\n// JSON Schema draft-07 (default)\ntoJsonSchema(schema);\n// { $schema: \"http://json-schema.org/draft-07/schema#\", anyOf: [{ type: \"string\" }, { type: \"null\" }] }\n\n// JSON Schema draft-2020-12\ntoJsonSchema(schema, { target: 'draft-2020-12' });\n// { $schema: \"https://json-schema.org/draft/2020-12/schema\", anyOf: [{ type: \"string\" }, { type: \"null\" }] }\n\n// OpenAPI 3.0 Schema Object\ntoJsonSchema(schema, { target: 'openapi-3.0' });\n// { type: \"string\", nullable: true }\n```\n\n**Note**: Some features like `propertyNames` for record schemas are not available in OpenAPI 3.0.\n\n### Type mode\n\nThe `typeMode` configuration controls whether to convert the input or output type of the Valibot schema to JSON Schema.\n\n- When set to `'input'`, conversion stops before the first potential type transformation action or second schema in any pipeline.\n- When set to `'output'`, conversion of any pipelines starts from the last schema in the pipeline. Therefore, the output type must be specified explicitly with a schema after the last type transformation action.\n- When set to `'ignore'` (default), the entire pipeline is converted.\n\nThis is particularly useful when defining API endpoints where external developers need different schema information for requests vs responses:\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst ValibotSchema = v.pipe(\n  v.string(),\n  v.decimal(),\n  v.transform(Number),\n  v.number(),\n  v.maxValue(100)\n);\n\ntoJsonSchema(ValibotSchema, { typeMode: 'input' });\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"string\",\n//   pattern: \"^[+-]?(?:\\\\d*\\\\.)?\\\\d+$\"\n// }\n\ntoJsonSchema(ValibotSchema, { typeMode: 'output' });\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"number\",\n//   maximum: 100\n// }\n```\n\n### Error mode\n\nThe `errorMode` configuration controls how the converter handles unsupported schemas and actions. By default, the error mode is set to `'throw'`. To force the conversion of unsupported Valibot features, you can set it to `'ignore'`.\n\n> Unsupported schemas usually return an empty JSON schema (`{}`) and unsupported actions are usually ignored.\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\ntoJsonSchema(v.file(), { errorMode: 'ignore' }); // {}\n\ntoJsonSchema(v.pipe(v.string(), v.creditCard()), { errorMode: 'ignore' }); // { type: \"string\" }\n```\n\n### Override functions\n\nThe package provides powerful override capabilities to customize the JSON Schema conversion process. You can override the conversion of specific schemas, actions, or references.\n\n#### Override schema conversion\n\nHandle unsupported schemas or customize conversion behavior:\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst ValibotSchema = v.object({ createdAt: v.date() });\n\ntoJsonSchema(ValibotSchema, {\n  overrideSchema(context) {\n    if (context.valibotSchema.type === 'date') {\n      return { type: 'string', format: 'date-time' };\n    }\n  },\n});\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"object\",\n//   properties: {\n//     createdAt: { type: \"string\" format: \"date-time\" }\n//   },\n//   required: [\"createdAt\"]\n// }\n```\n\n#### Override reference IDs\n\nCustomize reference IDs for OpenAPI or other specifications:\n\n```js\nimport { toJsonSchemaDefs } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst UserSchema = v.object({ name: v.string() });\n\ntoJsonSchemaDefs(\n  { UserSchema },\n  { overrideRef: (context) => `#/schemas/${context.referenceId}` }\n);\n```\n\n### Enhanced metadata support\n\nUse the generic `metadata` action to add title, description, and examples to your schemas or the individual `title` and `description` actions. Any other properties of the `metadata` action are added to the JSON Schema without further validation. This allows you to specify custom annotations and standard keywords such as `format`:\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst ValibotSchema = v.pipe(\n  v.string(),\n  v.email(),\n  v.metadata({\n    title: 'Email Schema',\n    description: 'A schema that validates email addresses.',\n    examples: ['jane@example.com'],\n    'x-category': 'auth',\n  })\n);\n\ntoJsonSchema(ValibotSchema);\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"string\",\n//   format: \"email\",\n//   title: \"Email Schema\",\n//   description: \"A schema that validates email addresses.\",\n//   examples: [\"jane@example.com\"],\n//   \"x-category\": \"auth\"\n// }\n```\n\n### Definitions\n\nNested and recursive schemas can be broken in multiple reusable definitions.\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst EmailSchema = v.pipe(v.string(), v.email());\ntoJsonSchema(v.object({ email: EmailSchema }), {\n  definitions: { EmailSchema },\n});\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"object\",\n//   properties: {\n//     email: {\n//       $ref: \"#/$defs/EmailSchema\"\n//     }\n//   },\n//   required: [\"email\"],\n//   $defs: {\n//     EmailSchema: {\n//       type: \"string\",\n//       format: \"email\"\n//     }\n//   }\n// }\n```\n\nDefinitions are not required for converting `lazy` schemas. Missing definitions will be generated automatically.\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst StringSchema = v.string();\ntoJsonSchema(v.object({ key: v.lazy(() => StringSchema) }));\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"object\",\n//   properties: {\n//     key: {\n//       $ref: \"#/$defs/0\"\n//     }\n//   },\n//   required: [\"key\"],\n//   $defs: {\n//     0: {\n//       type: \"string\"\n//     }\n//   }\n// }\n```\n\n## Additional functions\n\n### `toStandardJsonSchema`\n\nConverts a Valibot schema to the [Standard JSON Schema](https://standardschema.dev/) format. This format is useful when working with tools and libraries that support the Standard JSON Schema specification.\n\n```js\nimport { toStandardJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst schema = toStandardJsonSchema(\n  v.object({\n    id: v.pipe(v.string(), v.uuid()),\n    name: v.pipe(v.string(), v.nonEmpty()),\n    age: v.optional(v.number()),\n  })\n);\n```\n\n### `toJsonSchemaDefs`\n\nConverts only the provided Valibot schema definitions to JSON Schema definitions, without wrapping them in a root schema. This is particularly useful for OpenAPI specifications where you need only the schema definitions.\n\n```js\nimport { toJsonSchemaDefs } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst EmailSchema = v.pipe(v.string(), v.email());\nconst UserSchema = v.object({\n  name: v.string(),\n  email: EmailSchema,\n});\n\ntoJsonSchemaDefs({ EmailSchema, UserSchema });\n\n// {\n//   EmailSchema: {\n//     type: \"string\",\n//     format: \"email\"\n//   },\n//   UserSchema: {\n//     type: \"object\",\n//     properties: {\n//       name: {\n//         type: \"string\"\n//       },\n//       email: {\n//         $ref: \"#/$defs/EmailSchema\"\n//       }\n//     },\n//     required: [\"name\", \"email\"]\n//   }\n// }\n```\n\n#### OpenAPI integration\n\nFor OpenAPI specifications, you can customize reference IDs:\n\n```js\nimport { toJsonSchemaDefs } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst ValibotSchema1 = v.string();\nconst ValibotSchema2 = v.number();\nconst ValibotSchema3 = v.tuple([ValibotSchema1, ValibotSchema2]);\n\ntoJsonSchemaDefs(\n  { ValibotSchema1, ValibotSchema2, ValibotSchema3 },\n  { overrideRef: (context) => `#/schemas/${context.referenceId}` }\n);\n\n// {\n//   ValibotSchema1: { type: \"string\" },\n//   ValibotSchema2: { type: \"number\" },\n//   ValibotSchema3: {\n//     type: \"array\",\n//     items: [\n//       { $ref: \"#/schemas/ValibotSchema1\" },\n//       { $ref: \"#/schemas/ValibotSchema2\" }\n//     ],\n//     minItems: 2\n//   }\n// }\n```\n\n### Global definitions\n\nFor advanced use cases, you can manage global schema definitions that will be automatically used when converting schemas. This is particularly useful for larger projects with many reusable schemas.\n\n```js\nimport { addGlobalDefs, toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst ValibotSchema1 = v.string();\nconst ValibotSchema2 = v.number();\n\naddGlobalDefs({ ValibotSchema1, ValibotSchema2 });\n\nconst ValibotSchema3 = v.tuple([ValibotSchema1, ValibotSchema2]);\n\ntoJsonSchema(ValibotSchema3);\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"array\",\n//   items: [\n//     { $ref: \"#/$defs/ValibotSchema1\" },\n//     { $ref: \"#/$defs/ValibotSchema2\" }\n//   ],\n//   minItems: 2,\n//   $defs: {\n//     ValibotSchema1: { type: \"string\" },\n//     ValibotSchema2: { type: \"number\" }\n//   }\n// }\n```\n\nYou can also convert global definitions directly using `toJsonSchemaDefs`:\n\n```js\nconst globalDefs = getGlobalDefs();\nif (globalDefs) {\n  const schemaDefs = toJsonSchemaDefs(globalDefs);\n}\n```\n","isInternal":false,"tokens":4461,"sizeBytes":23622}],"systemPromptSnippet":"<yakaai_skills repo=\"open-circle/valibot\">\n<!-- File: AGENTS.md (Tokens: ~538 | Category: root-instruction) -->\n# AI Instructions\n\nValibot is a modular, type-safe schema validation library with zero runtime dependencies.\n\n## Monorepo Layout\n\n| Directory                  | Purpose                                         |\n| -------------------------- | ----------------------------------------------- |\n| `library/`                 | Core `valibot` package — most work happens here |\n| `packages/to-json-schema/` | JSON Schema converter                           |\n| `packages/i18n/`           | Translated error messages                       |\n| `website/`                 | valibot.dev (Qwik + Vite)                       |\n| `codemod/`                 | Migration and conversion tools                  |\n\n## Essential Commands\n\n```bash\npnpm install                    # Install dependencies\npnpm test                       # Run tests (all packages)\npnpm lint                       # ESLint + tsc + deno check (all packages)\npnpm format                     # Format code with Prettier (all packages)\npnpm build                      # Build for publishing (all packages)\n```\n\n## Code Conventions\n\n- **ESM with `.ts` extensions** in imports (enforced by ESLint)\n- **`interface` over `type`** for object shapes\n- **JSDoc required** on exported functions (first overload only for overload sets)\n- **`// @__NO_SIDE_EFFECTS__`** before pure factory functions for tree-shaking\n\n## Other Rules\n\n- **Source code is the single source of truth.** All documentation must match `/library/src/`.\n- **Lint and format after modifying code.** Run `eslint --fix` and `prettier --write` on the files you changed so CI passes.\n- **Use the GitHub CLI for GitHub-related tasks.** Prefer `gh` for pull requests, issues, checks, and other GitHub operations.\n\n## Library Architecture\n\nSchemas, actions, and methods are plain objects with a `'~run'` method:\n\n```\nlibrary/src/\n├── schemas/   → Data types (string, object, array...)\n├── actions/   → Validations & transforms (email, minLength, trim...)\n├── methods/   → API functions (parse, pipe, partial...)\n├── types/     → TypeScript definitions\n└── utils/     → Internal helpers (prefixed with _)\n```\n\nEach has its own folder: `name.ts`, `name.test.ts`, `name.test-d.ts`, `index.ts`.\n\n## Agent Skills\n\nThis repository includes agent skills in `/skills/` following the [Agent Skills](https://agentskills.io) open standard.\n\n**Naming:** Skills prefixed with `repo-` are local repository skills\n\n<!-- File: CLAUDE.md (Tokens: ~3 | Category: claude-rule) -->\nAGENTS.md\n\n<!-- File: .agents/skills/repo-source-code-document/SKILL.md (Tokens: ~2111 | Category: anthropic-skill) -->\n---\nname: repo-source-code-document\ndescription: Write JSDoc comments and inline documentation for Valibot library source code in /library/src/. Use when documenting schemas, actions, methods, or utilities. Covers interface documentation, function overloads, purity annotations, inline comment patterns, and terminology consistency.\n---\n\n# Valibot Source Code Documentation\n\nDocumentation patterns for library source code in `/library/src/`.\n\n## JSDoc Patterns\n\n### Interface Documentation\n\n```typescript\n/**\n * String issue interface.\n */\nexport interface StringIssue extends BaseIssue<unknown> {\n  /**\n   * The issue kind.\n   */\n  readonly kind: 'schema';\n  /**\n   * The issue type.\n   */\n  readonly type: 'string';\n}\n```\n\n**Rules:**\n\n- First line: `[Name] [category] interface.` (e.g., \"String issue interface.\")\n- Property comments: `The [description].` (always start with \"The\", end with period)\n- All properties use `readonly`\n- No blank lines between property and its comment\n\n### Variance Annotations\n\nInterfaces in `/library/src/types/` annotate every generic and explain it with a hint:\n\n```typescript\n/**\n * Success dataset interface.\n *\n * Hint: The explicit variance annotations of the generics spare TypeScript\n * from measuring the variance of this interface (see issue #1663).\n */\nexport interface SuccessDataset<out TValue> {}\n```\n\n**Rules:**\n\n- `out` or `in`, whichever `tsc` accepts, and `in out` only if it rejects both (give the reason in the hint)\n- Not for interfaces in `schemas/`, `actions/` or `methods/`\n\n### Function Overloads\n\nEach overload gets its own complete JSDoc:\n\n```typescript\n/**\n * Creates a string schema.\n *\n * @returns A string schema.\n */\nexport function string(): StringSchema<undefined>;\n\n/**\n * Creates a string schema.\n *\n * @param message The error message.\n *\n * @returns A string schema.\n */\nexport function string<\n  const TMessage extends ErrorMessage<StringIssue> | undefined,\n>(message: TMessage): StringSchema<TMessage>;\n```\n\n**Rules:**\n\n- First line: `Creates a [name] [category].` (use \"a\" vs \"an\" correctly)\n- Blank line after description\n- `@param name The [description].` (start with \"The\", end with period)\n- Blank line after params\n- `@returns A [name] [category].` or `@returns The [description].`\n\n### Hints\n\nAdd hints after the main description, before `@param`:\n\n```typescript\n/**\n * Creates an object schema.\n *\n * Hint: This schema removes unknown entries. To include unknown entries, use\n * `looseObject`. To reject unknown entries, use `strictObject`.\n *\n * @param entries The entries schema.\n *\n * @returns An object schema.\n */\n```\n\n### Links\n\nLink to external resources when relevant using markdown format:\n\n```typescript\n/**\n * Creates an [email](https://en.wikipedia.org/wiki/Email_address) validation action.\n */\n```\n\n### Implementation Function\n\nThe implementation has **NO JSDoc** but uses `// @__NO_SIDE_EFFECTS__`:\n\n```typescript\n// @__NO_SIDE_EFFECTS__\nexport function string(\n  message?: ErrorMessage<StringIssue>\n): StringSchema<ErrorMessage<StringIssue> | undefined> {\n  return {\n    /* ... */\n  };\n}\n```\n\n**`// @__NO_SIDE_EFFECTS__` rules:**\n\n- Add for pure functions (no external state mutation, no I/O)\n- Most schema/action/method factories are pure\n- **Do NOT add** for functions that mutate arguments (like `_addIssue`)\n- Used by bundlers for tree-shaking\n\n### Utility Functions\n\n```typescript\n/**\n * Stringifies an unknown input to a literal or type string.\n *\n * @param input The unknown input.\n *\n * @returns A literal or type string.\n *\n * @internal\n */\n// @__NO_SIDE_EFFECTS__\nexport function _stringify(input: unknown): string {\n  // ...\n}\n```\n\n**Rules:**\n\n- Use `@internal` tag for internal utilities\n- Prefix internal functions with `_`\n- Only add `// @__NO_SIDE_EFFECTS__` if function is pure\n\n## Inline Comment Patterns\n\n### Section Headers\n\n```typescript\n'~run'(dataset, config) {\n  // Get input value from dataset\n  const input = dataset.value;\n\n  // If root type is valid, check nested types\n  if (Array.isArray(input)) {\n    // Set typed to true and value to empty array\n    dataset.typed = true;\n    dataset.value = [];\n\n    // Parse schema of each array item\n    for (let key = 0; key < input.length; key++) {\n      // ...\n    }\n  }\n}\n```\n\n**Rules:**\n\n- Describe WHAT the next code block does\n- Present tense verbs: \"Get\", \"Parse\", \"Check\", \"Set\", \"Add\", \"Create\"\n- **Omit articles** (\"the\", \"a\", \"an\"): \"Get input value\" not \"Get the input value\"\n- No period at end\n- Blank line before comment, no blank line after\n\n### Conditional Logic\n\n```typescript\n// If root type is valid, check nested types\nif (input && typeof input === 'object') {\n  // ...\n}\n\n// Otherwise, add issue\nelse {\n  _addIssue(this, 'type', dataset, config);\n}\n```\n\n**Rules:**\n\n- Use \"If [condition], [action]\"\n- Use \"Otherwise, [action]\" for else branches\n- Omit articles\n\n### Hint Comments (Exception)\n\n```typescript\n// Hint: The issue is deliberately not constructed with the spread operator\n// for performance reasons\nconst issue: BaseIssue<unknown> = {\n  /* ... */\n};\n```\n\n**Rules:**\n\n- Start with \"Hint:\"\n- Explain WHY, not just what\n- **CAN use articles** (unlike other inline comments)\n- Document performance decisions, non-obvious logic\n\n### TODO Comments\n\n```typescript\n// TODO: Should we add \"n\" suffix to bigints?\nif (type === 'bigint') {\n  /* ... */\n}\n```\n\n### @ts-expect-error\n\nUsed for internal dataset mutations TypeScript can't track:\n\n```typescript\n// @ts-expect-error\ndataset.typed = true;\n```\n\n## File Type Patterns\n\n### Schema Files (`string.ts`, `object.ts`, etc.)\n\n1. Issue interface with JSDoc\n2. Schema interface with JSDoc\n3. Function overloads with full JSDoc each\n4. Implementation with `// @__NO_SIDE_EFFECTS__`\n5. Return object with `'~run'` method containing inline comments\n\n### Action Files (`email.ts`, `minLength.ts`, etc.)\n\n1. Issue interface (for validation actions)\n2. Action interface with JSDoc\n3. Function overloads with JSDoc\n4. Implementation with `// @__NO_SIDE_EFFECTS__`\n\n### Method Files (`parse.ts`, `pipe.ts`, etc.)\n\nMore complex logic, require more inline comments.\n\n### Utility Files (`_addIssue.ts`, `_stringify.ts`)\n\n1. Single function with JSDoc including `@internal`\n2. `// @__NO_SIDE_EFFECTS__` only if pure\n\n## Terminology Consistency\n\nJSDoc descriptions must match the `kind` property if present:\n\n| `kind` Property    | JSDoc Wording                          |\n| ------------------ | -------------------------------------- |\n| `'schema'`         | \"Creates a ... schema.\"                |\n| `'validation'`     | \"Creates a ... validation action.\"     |\n| `'transformation'` | \"Creates a ... transformation action.\" |\n\n## Quick Reference\n\n### JSDoc First Lines\n\n| Type      | Pattern                        |\n| --------- | ------------------------------ |\n| Interface | `[Name] [category] interface.` |\n| Type      | `[Name] [category] type.`      |\n| Function  | `Creates a [name] [category].` |\n| Utility   | `[Verb]s [description].`       |\n\n### Inline Comment Starters\n\n| Pattern                        | Example                                        |\n| ------------------------------ | ---------------------------------------------- |\n| `// Get [what]`                | `// Get input value from dataset`              |\n| `// If [condition], [action]`  | `// If root type is valid, check nested types` |\n| `// Otherwise, [action]`       | `// Otherwise, add issue`                      |\n| `// Create [what]`             | `// Create object path item`                   |\n| `// Add [what] to [where]`     | `// Add issues to dataset`                     |\n| `// Parse [what]`              | `// Parse schema of each array item`           |\n| `// Set [property] to [value]` | `// Set typed to true`                         |\n| `// Hint: [explanation]`       | `// Hint: This is for performance`             |\n| `// TODO: [task]`              | `// TODO: Add bigint suffix`                   |\n\n## Terminology\n\nUse consistently:\n\n- **Schema** (not \"validator\")\n- **Action** (not \"validation\" for the object)\n- **Issue** (not \"error\" in type names)\n- **Dataset** (internal data structure)\n- **Config/Configuration** (not \"options\")\n\n## Checklist\n\n- [ ] Interfaces: `[Name] [category] interface.`\n- [ ] Properties: `The [description].`\n- [ ] `types/` interfaces: Variance annotations with hint\n- [ ] Overloads: Complete JSDoc each\n- [ ] Implementation: NO JSDoc\n- [ ] Pure functions: `// @__NO_SIDE_EFFECTS__`\n- [ ] Impure functions (mutate args): NO `@__NO_SIDE_EFFECTS__`\n- [ ] Internal utilities: `@internal` tag\n- [ ] Inline comments: No articles (except Hint), no periods\n- [ ] JSDoc comments: End with periods\n\n<!-- File: .agents/skills/repo-source-code-review/SKILL.md (Tokens: ~1105 | Category: anthropic-skill) -->\n---\nname: repo-source-code-review\ndescription: Review pull requests and source code changes in /library/src/. Use when reviewing PRs, validating implementation patterns, or checking code quality before merging. Covers code quality checks, type safety, documentation review, test coverage, and common issues to watch for.\n---\n\n# Reviewing Source Code Changes\n\nGuide for reviewing PRs and source code changes in `/library/src/`.\n\n## When to Use This Guide\n\n- Reviewing pull requests modifying library source\n- Validating implementation patterns before merging\n- Checking code quality, types, documentation, and tests\n\n## Review Process\n\n1. **Understand the change** — Read PR description, identify affected files\n2. **Check patterns** — Verify code follows existing conventions\n3. **Verify types** — Ensure type safety and proper inference\n4. **Review docs** — Confirm JSDoc is complete and accurate\n5. **Check tests** — Validate runtime and type test coverage\n\n## What to Review\n\n### Code Quality\n\n| Check             | Requirement                                                           |\n| ----------------- | --------------------------------------------------------------------- |\n| Naming            | Matches existing patterns (`StringSchema`, `minLength`, `_parse`)     |\n| Purity annotation | `// @__NO_SIDE_EFFECTS__` before pure factory functions               |\n| Import extensions | All imports use `.ts` extension                                       |\n| Interface vs type | Use `interface` for object shapes, `type` for unions/aliases          |\n| Folder structure  | Each API has: `name.ts`, `name.test.ts`, `name.test-d.ts`, `index.ts` |\n\n**Good — purity annotation:**\n\n```typescript\n// @__NO_SIDE_EFFECTS__\nexport function string(message?: ErrorMessage<StringIssue>): StringSchema {\n  return {\n    /* ... */\n  };\n}\n```\n\n**Bad — missing annotation:**\n\n```typescript\nexport function string(message?: ErrorMessage<StringIssue>): StringSchema {\n  return {\n    /* ... */\n  };\n}\n```\n\n### Type Safety\n\n| Check             | Requirement                                           |\n| ----------------- | ----------------------------------------------------- |\n| Generic inference | Types infer correctly without explicit annotations    |\n| Constraints       | Generic parameters have appropriate `extends` clauses |\n| Return types      | Explicit return types on exported functions           |\n| Type tests        | `.test-d.ts` file covers type inference scenarios     |\n| Variance          | Interfaces in `types/` annotate every generic         |\n\n**Good — constrained generic:**\n\n```typescript\nexport function minLength<\n  TInput extends LengthInput,\n  TRequirement extends number,\n>(\n  requirement: TRequirement,\n  message?: ErrorMessage<MinLengthIssue<TInput, TRequirement>>\n): MinLengthAction<TInput, TRequirement>;\n```\n\n### Documentation\n\n| Check          | Requirement                                       |\n| -------------- | ------------------------------------------------- |\n| JSDoc present  | All exported functions have JSDoc                 |\n| First line     | Action verb matching function purpose (see below) |\n| `@param` tags  | Every parameter documented                        |\n| `@returns` tag | Return value documented                           |\n| Overloads      | Every overload has its own complete JSDoc block   |\n\n**First line patterns by category:**\n\n| Category       | Pattern                                        |\n| -------------- | ---------------------------------------------- |\n| Schemas        | `Creates a ... schema.`                        |\n| Actions        | `Creates a ... action.`                        |\n| Parse methods  | `Parses ...`                                   |\n| Type guards    | `Checks if ...`                                |\n| Unwrap methods | `Unwraps ...`                                  |\n| Other methods  | `Creates a ...`, `Returns ...`, `Forwards ...` |\n\nSee `repo-source-code-document` skill for full documentation rules.\n\n### Tests\n\n| Check          | Requirement                                                |\n| -------------- | ---------------------------------------------------------- |\n| Runtime tests  | `.test.ts` covers success cases, failure cases, edge cases |\n| Type tests     | `.test-d.ts` validates type inference with `expectTypeOf`  |\n| Issue messages | Tests verify correct error messages and issue structure    |\n\n## Common Issues\n\n| Issue                     | What to Look For                                             |\n| ------------------------- | ------------------------------------------------------------ |\n| Missing purity annotation | Factory function without `// @__NO_SIDE_EFFECTS__`           |\n| Incomplete JSDoc          | Missing `@param` or `@returns`, wrong description format     |\n| No type tests             | New API without `.test-d.ts` file                            |\n| Wrong import extension    | Imports without `.ts` suffix                                 |\n| Inconsistent naming       | Schema not ending in `Schema`, action not ending in `Action` |\n| Side effects in pure code | Mutations, I/O, or global state in schema/action creation    |\n\n## Checklist\n\n- [ ] Implementation follows existing patterns in similar files\n- [ ] `// @__NO_SIDE_EFFECTS__` on pure factory functions\n- [ ] All imports use `.ts` extension\n- [ ] `interface` used for object shapes\n- [ ] JSDoc complete on all exports\n- [ ] Runtime tests in `.test.ts`\n- [ ] Type tests in `.test-d.ts`\n- [ ] Naming conventions followed\n- [ ] Variance annotations on generics of `types/` interfaces\n\n## Related Skills\n\n- `repo-structure-navigate` — Navigate the codebase\n- `repo-source-code-document` — JSDoc requirements\n\n<!-- File: .agents/skills/repo-structure-navigate/SKILL.md (Tokens: ~1732 | Category: anthropic-skill) -->\n---\nname: repo-structure-navigate\ndescription: Navigate the Valibot repository structure. Use when looking for files, understanding the codebase layout, finding schema/action/method implementations, locating tests, API docs, or guide pages. Covers monorepo layout, library architecture, file naming conventions, and quick lookups.\n---\n\n# Valibot Repository Structure\n\n## Monorepo Layout\n\n```\nvalibot/\n├── library/          # Core valibot package (zero dependencies)\n├── packages/\n│   ├── i18n/         # Translated error messages (25+ languages)\n│   └── to-json-schema/  # JSON Schema converter\n├── codemod/\n│   ├── migrate-to-v0.31.0/  # Version migration\n│   └── zod-to-valibot/      # Zod converter\n├── website/          # valibot.dev (Qwik + Vite)\n├── brand/            # Brand assets\n├── skills/           # Agent skills (this folder)\n└── prompts/          # Legacy AI agent guides\n```\n\n## Core Library (`/library/src/`)\n\n### Directory Structure\n\n| Directory   | Purpose                         | Examples                                      |\n| ----------- | ------------------------------- | --------------------------------------------- |\n| `schemas/`  | Data type validators            | `string/`, `object/`, `array/`, `union/`      |\n| `actions/`  | Validation & transformation     | `email/`, `minLength/`, `trim/`, `transform/` |\n| `methods/`  | High-level API                  | `parse/`, `safeParse/`, `pipe/`, `partial/`   |\n| `types/`    | TypeScript definitions          | `schema.ts`, `issue.ts`, `dataset.ts`         |\n| `utils/`    | Internal helpers (prefixed `_`) | `_addIssue/`, `_stringify/`, `ValiError/`     |\n| `storages/` | Global state                    | Config, message storage                       |\n\n### Schema Categories\n\n- **Primitives**: `string`, `number`, `boolean`, `bigint`, `date`, `symbol`, `blob`, `file`\n- **Objects**: `object`, `strictObject`, `looseObject`, `objectWithRest`\n- **Arrays**: `array`, `tuple`, `strictTuple`, `looseTuple`, `tupleWithRest`\n- **Advanced**: `union`, `variant`, `intersect`, `record`, `map`, `set`, `lazy`, `custom`\n- **Modifiers**: `optional`, `nullable`, `nullish`, `nonNullable`, `nonNullish`, `nonOptional`\n\n### Action Types\n\n**Validation** (return issues): `email`, `url`, `uuid`, `regex`, `minLength`, `maxValue`, `check`\n\n**Transformation** (modify data): `trim`, `toLowerCase`, `toUpperCase`, `mapItems`, `transform`\n\n**Metadata**: `brand`, `flavor`, `metadata`, `description`, `title`\n\n### File Naming Convention\n\nEach schema/action/method has its own directory:\n\n```\nschemas/string/\n├── string.ts        # Implementation\n├── string.test.ts   # Runtime tests\n├── string.test-d.ts # Type tests\n└── index.ts         # Re-export\n```\n\n### Core Patterns\n\n**Schemas** define data types:\n\n```typescript\nexport interface StringSchema<TMessage> extends BaseSchema<...> {\n  readonly kind: 'schema';\n  readonly type: 'string';\n  // ...\n}\n```\n\n**Actions** validate/transform in pipelines:\n\n```typescript\nexport interface EmailAction<TInput, TMessage> extends BaseValidation<...> {\n  readonly kind: 'validation';\n  readonly type: 'email';\n  // ...\n}\n```\n\n**Methods** provide API functions:\n\n```typescript\nexport function parse<TSchema>(\n  schema: TSchema,\n  input: unknown\n): InferOutput<TSchema>;\n```\n\n### Key Types\n\n- `BaseSchema`, `BaseValidation`, `BaseTransformation` - Base interfaces\n- `InferOutput<T>`, `InferInput<T>`, `InferIssue<T>` - Type inference\n- `Config`, `ErrorMessage<T>`, `BaseIssue<T>` - Configuration and errors\n- `'~standard'` property - [Standard Schema](https://github.com/standard-schema/standard-schema) compatibility\n\n## Website (`/website/src/routes/`)\n\n### API Documentation\n\n```\nroutes/api/\n├── (schemas)/string/     # Schema docs\n│   ├── index.mdx         # MDX content\n│   └── properties.ts     # Type definitions\n├── (actions)/email/      # Action docs\n├── (methods)/parse/      # Method docs\n├── (types)/StringSchema/ # Type docs\n└── menu.md               # Navigation\n```\n\n### Guides\n\n```\nroutes/guides/\n├── (get-started)/       # Intro, installation\n├── (main-concepts)/     # Schemas, pipelines, parsing\n├── (schemas)/           # Objects, arrays, unions\n├── (advanced)/          # Async, i18n, JSON Schema\n├── (migration)/         # Version upgrades\n└── menu.md              # Navigation\n```\n\n## Development\n\n### Playground\n\nUse `library/playground.ts` for quick experimentation.\n\n### Adding a Schema/Action\n\n1. Create directory: `library/src/schemas/yourSchema/`\n2. Create files: `yourSchema.ts`, `yourSchema.test.ts`, `yourSchema.test-d.ts`, `index.ts`\n3. Follow existing patterns (copy similar implementation)\n4. Export from category `index.ts`\n5. Run `pnpm -C library test`\n\n### Modifying Core Types\n\n⚠️ Changes to `library/src/types/` affect the entire library. Always run full test suite.\n\n## Quick Lookups\n\n| Looking for...        | Location                                       |\n| --------------------- | ---------------------------------------------- |\n| Schema implementation | `library/src/schemas/[name]/[name].ts`         |\n| Action implementation | `library/src/actions/[name]/[name].ts`         |\n| Method implementation | `library/src/methods/[name]/[name].ts`         |\n| Type definitions      | `library/src/types/`                           |\n| Internal utilities    | `library/src/utils/`                           |\n| Error messages (i18n) | `packages/i18n/[lang]/`                        |\n| API docs page         | `website/src/routes/api/(category)/[name]/`    |\n| Guide page            | `website/src/routes/guides/(category)/[name]/` |\n| Tests                 | Same directory as source, `.test.ts` suffix    |\n| Type tests            | Same directory as source, `.test-d.ts` suffix  |\n\n## Commands\n\n```bash\n# Library\npnpm -C library build      # Build\npnpm -C library test       # Run tests\npnpm -C library lint       # Lint\npnpm -C library format     # Format\n\n# Website\npnpm -C website dev        # Dev server\npnpm -C website build      # Production build\n\n# Root\npnpm install               # Install all\npnpm format                # Format all\n```\n\n## Key Principles\n\n1. **Modularity** - Small, focused functions; one per file\n2. **Zero dependencies** - Core library has no runtime deps\n3. **100% test coverage** - Required for library\n4. **Tree-shakable** - Use `// @__NO_SIDE_EFFECTS__` annotation\n5. **Type-safe** - Full TypeScript with strict mode\n6. **ESM only** - Imports include `.ts` extensions\n\n## Do's and Don'ts\n\n**Do:**\n\n- Follow existing code patterns\n- Write runtime and type tests\n- Add JSDoc documentation\n- Keep functions small and focused\n- Check bundle size impact\n\n**Don't:**\n\n- Add external dependencies\n- Modify core types without full test run\n- Skip tests\n- Create large multi-purpose functions\n- Modify generated files (`dist/`, `coverage/`)\n\n<!-- File: .agents/skills/repo-website-api-create/SKILL.md (Tokens: ~2549 | Category: anthropic-skill) -->\n---\nname: repo-website-api-create\ndescription: Create new API reference pages for the Valibot website at website/src/routes/api/. Use when adding documentation for new schemas, actions, methods, or types. Covers reading source code, creating properties.ts and index.mdx files, updating menu.md, and cross-referencing related APIs.\n---\n\n# Adding API Documentation to Website\n\nGuide for creating new API reference pages at `website/src/routes/api/`.\n\n## Process Overview\n\n1. Read source code in `/library/src/`\n2. Create folder in `/website/src/routes/api/(category)/[name]/`\n3. Create `properties.ts` with type definitions\n4. Create `index.mdx` with documentation\n5. Update `menu.md`\n6. Create type documentation if needed (Issue, Schema/Action interfaces)\n\n## File Structure\n\n```\nwebsite/src/routes/api/\n├── (schemas)/string/\n│   ├── index.mdx        # Documentation content\n│   └── properties.ts    # Type definitions for Property component\n├── (actions)/email/\n├── (methods)/parse/\n├── (types)/StringSchema/\n└── menu.md              # Navigation (alphabetical order)\n```\n\nCategories: `(schemas)`, `(actions)`, `(methods)`, `(types)`, `(utils)`, `(async)`, `(storages)`\n\n## Reading Source Code\n\n### What to Extract\n\nFrom `/library/src/schemas/string/string.ts`:\n\n```typescript\n// 1. Issue interface → Document in (types)/StringIssue/\nexport interface StringIssue extends BaseIssue<unknown> { ... }\n\n// 2. Schema interface → Document in (types)/StringSchema/\nexport interface StringSchema<TMessage extends ErrorMessage<StringIssue> | undefined>\n  extends BaseSchema<string, string, StringIssue> { ... }\n\n// 3. Function overloads → Main documentation\nexport function string(): StringSchema<undefined>;\nexport function string<const TMessage>(message: TMessage): StringSchema<TMessage>;\n\n// 4. JSDoc → Description, hints, parameter docs\n/**\n * Creates a string schema.\n *\n * Hint: This is an example hint.\n *\n * @param message The error message.\n *\n * @returns A string schema.\n */\n```\n\n**JSDoc hints** become blockquotes in the Explanation section:\n\n```mdx\n> This is an example hint.\n```\n\n### Extract for properties.ts\n\n- Generic parameters and constraints (e.g., `TMessage extends ErrorMessage<...> | undefined`)\n- Function parameters and types\n- Return type\n\n## properties.ts\n\nImport and define properties matching source code:\n\n```typescript\nimport type { PropertyProps } from '~/components';\n\nexport const properties: Record<string, PropertyProps> = {\n  // Generics (use modifier: 'extends')\n  TMessage: {\n    modifier: 'extends',\n    type: {\n      type: 'union',\n      options: [\n        {\n          type: 'custom',\n          name: 'ErrorMessage',\n          href: '../ErrorMessage/',\n          generics: [\n            { type: 'custom', name: 'StringIssue', href: '../StringIssue/' },\n          ],\n        },\n        'undefined',\n      ],\n    },\n  },\n\n  // Parameters (reference generic or direct type)\n  message: {\n    type: { type: 'custom', name: 'TMessage' },\n  },\n\n  // Return type\n  Schema: {\n    type: {\n      type: 'custom',\n      name: 'StringSchema',\n      href: '../StringSchema/',\n      generics: [{ type: 'custom', name: 'TMessage' }],\n    },\n  },\n};\n```\n\n### Optional Object Keys\n\nFor optional object keys from TypeScript source such as `key?: string`, do not append `?` to the property name in `properties.ts`.\n\nUse the plain key name and represent optionality in the value type with `undefined` as the last union option:\n\n```typescript\npayload: {\n  type: {\n    type: 'object',\n    entries: [\n      {\n        key: 'key',\n        value: {\n          type: 'union',\n          options: ['string', 'undefined'],\n        },\n      },\n    ],\n  },\n},\n```\n\n### DefinitionData Types\n\n| Type            | Syntax                                                                         |\n| --------------- | ------------------------------------------------------------------------------ |\n| Primitive       | `'string'`, `'number'`, `'boolean'`, `'unknown'`, etc.                         |\n| Literal string  | `{ type: 'string', value: 'email' }`                                           |\n| Literal number  | `{ type: 'number', value: 5 }`                                                 |\n| Custom/Named    | `{ type: 'custom', name: 'TypeName', href: '../TypeName/', generics: [...] }`  |\n| Custom+modifier | `{ type: 'custom', modifier: 'typeof', name: 'string', href: '../string/' }`   |\n| Union           | `{ type: 'union', options: [type1, type2] }`                                   |\n| Intersect       | `{ type: 'intersect', options: [type1, type2] }`                               |\n| Array           | `{ type: 'array', item: elementType }`                                         |\n| Tuple           | `{ type: 'tuple', items: [type1, type2] }`                                     |\n| Object          | `{ type: 'object', entries: [{ key: 'name', value: type }] }`                   |\n| Function        | `{ type: 'function', params: [{ name: 'x', type: t }], return: retType }`      |\n| Template        | `{ type: 'template', parts: [{ type: 'string', value: '>=' }, otherType] }`    |\n\n## index.mdx Template\n\n```mdx\n---\ntitle: functionName\ndescription: One-line description from JSDoc.\nsource: /schemas/string/string.ts\ncontributors:\n  - github-username\n---\n\nimport { ApiList, Property } from '~/components';\nimport { properties } from './properties';\n\n# functionName\n\nCreates a string schema.\n\n\\`\\`\\`ts\nconst Schema = v.functionName<TMessage>(message);\n\\`\\`\\`\n\n## Generics\n\n- \\`TMessage\\` <Property {...properties.TMessage} />\n\n## Parameters\n\n- \\`message\\` <Property {...properties.message} />\n\n### Explanation\n\nWith \\`functionName\\` you can validate... If the input does not match, you can use \\`message\\` to customize the error message.\n\n## Returns\n\n- \\`Schema\\` <Property {...properties.Schema} />\n\n## Examples\n\nThe following examples show how \\`functionName\\` can be used.\n\n### Email schema\n\nSchema to validate an email.\n\n\\`\\`\\`ts\nconst EmailSchema = v.pipe(\nv.string(),\nv.nonEmpty('Please enter your email.'),\nv.email('The email is badly formatted.')\n);\n\\`\\`\\`\n\n## Related\n\nThe following APIs can be combined with \\`functionName\\`.\n\n### Schemas\n\n<ApiList items={['array', 'object', 'string']} />\n\n### Methods\n\n<ApiList items={['parse', 'pipe', 'safeParse']} />\n\n### Actions\n\n<ApiList items={['email', 'minLength']} />\n\n### Utils\n\n<ApiList items={['isOfKind', 'isOfType']} />\n```\n\n**Related section order:** Schemas → Methods → Actions → Utils (omit empty sections)\n\n## Key Conventions\n\n### Naming\n\n- Schema variables: `PascalCase` + `Schema` suffix: `EmailSchema`, `UserSchema`\n- Action variables: `PascalCase` + `Action`: `MinLengthAction`\n- Parse output: `output` or descriptive name\n\n### Examples\n\n- Always include error messages for validation actions\n- Progress from simple to complex\n- Use realistic, practical scenarios\n- Start with `import * as v from 'valibot';` pattern\n\n### Error Messages\n\nUse friendly, actionable messages:\n\n- ✅ \"Your password is too short.\"\n- ✅ \"Please enter your email.\"\n- ❌ \"Invalid\" or \"Error\"\n\n### Links\n\n- Use `href: '../TypeName/'` for type references (with trailing slash)\n- Use `<Link href=\"/api/parse/\">\\`parse\\`</Link>`in MDX prose (import from`~/components`)\n- Link to related guides when relevant: `<Link href=\"/guides/objects/\">object guide</Link>`\n\n## Update Related Files\n\n### menu.md\n\nAdd alphabetically to `/website/src/routes/api/menu.md`:\n\n```markdown\n## Schemas\n\n- [any](/api/any/)\n- [newSchema](/api/newSchema/) ← Add here\n- [string](/api/string/)\n```\n\n### Related Sections of Other API Docs\n\nExisting API pages have a `## Related` section with `<ApiList>` components. When adding a new API, update related APIs to include the new one.\n\n**Rule:** An API is \"related\" if:\n\n- It makes sense to use it as an argument of the other API, or vice versa\n- It makes sense to use them together in the same `pipe` (e.g., `v.pipe(v.string(), v.email())` → `string` and `email` are related)\n\nExamples:\n\n- `string` schema lists `email` action because they work together in a pipe\n- `email` action lists `string` schema because it validates string input\n- `pipe` method lists all schemas because any schema can be piped\n- `minLength` action lists `string`, `array`, `tuple` because it validates their length\n\n**Process:**\n\n1. Review a few existing API docs in the same category to understand the pattern\n2. Check `menu.md` to identify potentially related APIs\n3. For each related API, edit its `index.mdx` and add the new API to the appropriate `<ApiList>`\n\n**Shortcut:** If your new API is very similar to an existing one (e.g., `guard` is similar to `check`), add it everywhere the similar API appears. This ensures consistent coverage across all related docs.\n\n### Concept Guides\n\nAdd the new API to the appropriate guide in `/website/src/routes/guides/`:\n\n| API Category | Guide to Update                       |\n| ------------ | ------------------------------------- |\n| Schema       | `(main-concepts)/schemas/index.mdx`   |\n| Action       | `(main-concepts)/pipelines/index.mdx` |\n| Method       | `(main-concepts)/methods/index.mdx`   |\n\nAlso update topic-specific guides if relevant (e.g., `(schemas)/objects/`, `(schemas)/arrays/`, `(advanced)/async/`).\n\n### Type Documentation\n\nCreate pages for new types in `(types)/`:\n\n- Issue interfaces (e.g., `StringIssue`)\n- Schema/Action interfaces (e.g., `StringSchema`)\n\nType pages differ from function docs:\n\n- **No `source` field** in frontmatter\n- **No Examples or Related sections**\n- Use `## Definition` instead of `## Returns`\n\nType page structure:\n\n```mdx\n---\ntitle: StringSchema\ndescription: String schema interface.\ncontributors:\n  - github-username\n---\n\nimport { Property } from '~/components';\nimport { properties } from './properties';\n\n# StringSchema\n\nString schema interface.\n\n## Generics\n\n- \\`TMessage\\` <Property {...properties.TMessage} />\n\n## Definition\n\n- \\`StringSchema\\` <Property {...properties.BaseSchema} />\n  - \\`type\\` <Property {...properties.type} />\n  - \\`reference\\` <Property {...properties.reference} />\n  - \\`expects\\` <Property {...properties.expects} />\n  - \\`message\\` <Property {...properties.message} />\n```\n\n## Checklist\n\n- [ ] Read source file completely\n- [ ] `properties.ts` matches source types exactly\n- [ ] `index.mdx` signature matches source\n- [ ] All generics documented\n- [ ] All parameters documented\n- [ ] Examples are realistic with error messages\n- [ ] `menu.md` updated (alphabetically)\n- [ ] Related type pages created if needed\n- [ ] Related API docs updated (add new API to their `## Related` sections)\n- [ ] Concept guide updated (schemas/pipelines/methods)\n- [ ] All `href` links valid with trailing slashes\n\n<!-- File: .agents/skills/repo-website-api-update/SKILL.md (Tokens: ~1269 | Category: anthropic-skill) -->\n---\nname: repo-website-api-update\ndescription: Update existing API documentation pages after source code changes. Use when syncing docs with library changes like new parameters, type constraint changes, interface updates, or function renames. Covers common change patterns and verification steps.\n---\n\n# Updating API Documentation\n\nGuide for syncing API docs with source code changes.\n\n**Prerequisite:** Read the `repo-website-api-create` skill for `properties.ts` and `index.mdx` patterns.\n\n## When to Update\n\nUpdate documentation when source code changes:\n\n- Function signatures (parameters, generics, return types)\n- Interface properties\n- JSDoc descriptions or hints\n- Behavior changes affecting examples\n\n**Do NOT update for:** Internal implementation changes (`~run` method), test changes, non-JSDoc comments.\n\n## Process\n\n1. **Read full source file** - Don't just look at diff; understand complete current state\n2. **Identify changes** - Categorize as addition, removal, or modification\n3. **Update `properties.ts`** - Match types exactly to source; for optional object keys, keep the plain key name and use a union with `undefined` as the last option instead of appending `?`\n4. **Update `index.mdx`** - Signature, generics, parameters, examples\n5. **Update related files** - Type docs, `menu.md` if renamed\n\n## Common Change Types\n\n### New Parameter Added\n\n```typescript\n// Before: one overload\nexport function action<TInput>(requirement: TRequirement): Action<...>;\n\n// After: two overloads (message is optional)\nexport function action<TInput>(requirement: TRequirement): Action<..., undefined>;\nexport function action<TInput, TMessage>(requirement: TRequirement, message: TMessage): Action<..., TMessage>;\n```\n\nUpdate:\n\n1. Add `TMessage` generic to `properties.ts`\n2. Add `message` parameter to `properties.ts`\n3. Update signature in `index.mdx`\n4. Add generic and parameter documentation\n5. Update examples to show new parameter\n\n### Parameter Removed (Breaking)\n\n1. Remove from `properties.ts`\n2. Update signature in `index.mdx`\n3. Remove from Parameters section\n4. Update all examples\n5. Consider adding migration note in Explanation\n\n### Type Constraint Changed\n\n```typescript\n// Before\nTRequirement extends number\n\n// After\nTRequirement extends number | string\n```\n\nUpdate:\n\n1. Update type in `properties.ts`\n2. Update Explanation to mention both types\n3. Add examples for new type usage\n\n### Interface Property Added\n\n1. Update type documentation in `(types)/TypeName/`\n2. Add new property to `properties.ts`; if the source key is optional, do not append `?` to the key name and model it as a union with `undefined` last\n3. Document in Definition section\n\n### Function Renamed\n\n1. Rename folder\n2. Update all references in files\n3. Update `menu.md` (maintain alphabetical order)\n4. Update cross-references in related API docs\n5. Consider redirect if widely used\n\n### Deprecation\n\nAdd notice at top of `index.mdx` (import `Link` from `~/components`):\n\n```mdx\n> **⚠️ Deprecated**: Use <Link href=\"../newFunction/\">\\`newFunction\\`</Link> instead. Will be removed in v2.0.\n```\n\n### New Helper Type Introduced\n\nWhen source introduces a type alias:\n\n```typescript\n// Before: TInput extends string | unknown[]\n// After: TInput extends LengthInput\n```\n\n1. Update `properties.ts` to reference new type with `href`\n2. Create documentation for the new type in `(types)/`\n3. Update explanation if supported types changed\n\n### Multiple Overloads Added (Sync/Async)\n\nWhen sync and async variants are added:\n\n1. Update signature to show general pattern or both overloads\n2. Add explanation about sync vs async usage\n3. Add examples for both use cases\n4. Update Related section for async schemas if relevant\n\n## Related Files to Update\n\nWhen a function changes, check:\n\n- **Type docs** - If interfaces changed (`(types)/TypeName/`)\n- **Related API docs** - Other APIs that reference this function in their Related section\n- **Guide files** - If usage patterns changed significantly\n- **menu.md** - If function renamed or moved\n\n## Verification\n\nAfter updating, verify:\n\n- [ ] All types match source exactly\n- [ ] Function signature matches source\n- [ ] All examples work with new API\n- [ ] All `href` links are valid\n- [ ] Related type docs updated if interfaces changed\n- [ ] `menu.md` updated if renamed\n- [ ] Related API docs updated (their Related sections)\n\n## Best Practices\n\n- **Read full source file** - Don't just look at diff\n- **Update incrementally** - `properties.ts` → `index.mdx` → related files\n- **Don't over-document internals** - Only user-facing changes need docs\n- **Preserve example quality** - Keep realistic, demonstrate best practices\n- **Check related APIs** - They may reference the changed function\n\n## When to Ask for Help\n\n- Major breaking changes (complete signature overhaul)\n- Complex generic constraint changes\n- Unclear intent from source changes\n- Many related files affected\n- Need to document migration path\n\n## Quick Reference\n\n| Change            | Files to Update                                                      |\n| ----------------- | -------------------------------------------------------------------- |\n| New parameter     | `properties.ts`, `index.mdx` (signature, generics, params, examples) |\n| Removed parameter | `properties.ts`, `index.mdx`                                         |\n| Type change       | `properties.ts`, `index.mdx` (explanation, examples)                 |\n| Interface change  | `(types)/TypeName/properties.ts`, `(types)/TypeName/index.mdx`       |\n| Renamed function  | Folder name, all files, `menu.md`, cross-references                  |\n| Deprecation       | `index.mdx` (add warning)                                            |\n\n<!-- File: .agents/skills/repo-website-guide-create/SKILL.md (Tokens: ~944 | Category: anthropic-skill) -->\n---\nname: repo-website-guide-create\ndescription: Create conceptual documentation and tutorial pages for the Valibot website at website/src/routes/guides/. Use when adding guides about schemas, pipelines, async validation, migration, or other topics. Covers directory structure, MDX templates, frontmatter, and content guidelines.\n---\n\n# Adding Guides to Website\n\nGuide for creating conceptual documentation at `website/src/routes/guides/`.\n\n## Directory Structure\n\n```\nwebsite/src/routes/guides/\n├── menu.md                    # Navigation menu\n├── (get-started)/             # Intro, installation, quick start\n├── (main-concepts)/           # Schemas, pipelines, parsing\n├── (schemas)/                 # Objects, arrays, unions\n├── (advanced)/                # Async, i18n, JSON Schema\n├── (migration)/               # Version upgrades, Zod migration\n└── (category)/guide-slug/\n    └── index.mdx              # Guide content\n```\n\nNote: Category folders use parentheses (Qwik route grouping).\n\n## Process\n\n1. Review 2-3 existing guides in the target category to understand style\n2. Choose category from existing or create new\n3. Create folder: `(category)/guide-slug/`\n4. Create `index.mdx` with content\n5. Update `menu.md`\n\n## index.mdx Template\n\n```mdx\n---\ntitle: Guide Title\ndescription: >-\n  A concise description of what this guide covers.\ncontributors:\n  - github-username\n---\n\nimport { ApiList, Link } from '~/components';\n\n# Guide Title\n\nOpening paragraph explaining what the reader will learn.\n\n## Section Heading\n\nContent with clear, concise language.\n\n\\`\\`\\`ts\nimport \\* as v from 'valibot';\n\nconst Schema = v.object({\nname: v.string(),\nemail: v.pipe(v.string(), v.email()),\n});\n\\`\\`\\`\n\n## Another Section\n\nContinue with additional sections as needed.\n\nUse <Link href=\"/api/pipe/\">\\`pipe\\`</Link> for internal links.\n```\n\n## Frontmatter\n\nRequired fields:\n\n- **title**: Page title and navigation label\n- **description**: SEO description (use `>-` for multi-line)\n- **contributors**: Array of GitHub usernames\n\n## Content Guidelines\n\n### Code Examples\n\n- Use TypeScript (`ts` language)\n- Import as `import * as v from 'valibot';`\n- Include comments for complex code\n\n### Links\n\nInternal links use the `Link` component:\n\n```mdx\n<Link href=\"/guides/schemas/\">schemas guide</Link>\n<Link href=\"/api/pipe/\">\\`pipe\\`</Link>\n```\n\n### Components\n\n```mdx\n<ApiList label=\"Related schemas\" items={['object', 'array', 'string']} />\n```\n\n### Formatting\n\n- `inline code` for API names, variables, file names\n- **bold** for genuine emphasis only — not as inline section labels\n- Proper heading hierarchy (h1 title, h2 sections, h3 subsections)\n\n### Writing tone\n\n- Write conversational prose, not terse reference-doc style\n- Use first-person plural: \"we recommend\" not \"you should\"\n- Do not use bold as inline section labels (e.g. avoid `**Label:** content`). Use a proper subheading instead\n- Do not prefix blockquotes with bold labels (e.g. avoid `> **Note:** ...`). A plain `>` is correct\n- Bullet list items do not need a bold prefix on each item\n\n### Images\n\nPlace images in the same folder as `index.mdx`:\n\n```mdx\n![Alt text](./diagram-light.jpg)\n```\n\nConsider light/dark theme variants if applicable (e.g., `diagram-light.jpg`, `diagram-dark.jpg`).\n\n## Update menu.md\n\nAdd to `/website/src/routes/guides/menu.md`:\n\n```markdown\n## Category Name\n\n- [Existing Guide](/guides/existing/)\n- [New Guide Title](/guides/guide-slug/)\n```\n\nMaintain logical ordering within categories.\n\n## Checklist\n\n- [ ] Reviewed existing guides in the same category\n- [ ] Folder structure: `(category)/guide-slug/index.mdx`\n- [ ] Frontmatter: title, description, contributors\n- [ ] Internal links use `Link` component\n- [ ] Code examples use `import * as v from 'valibot';`\n- [ ] Added to `menu.md`\n- [ ] Style matches existing guides\n\n<!-- File: website/public/.well-known/agent-skills/valibot/SKILL.md (Tokens: ~4669 | Category: anthropic-skill) -->\n---\nname: valibot\ndescription: Schema validation with Valibot, the modular and type-safe schema library. Use when the user needs to validate data, create schemas, parse inputs, or work with Valibot in their project. Also use when migrating from Zod to Valibot.\nlicense: MIT\nmetadata:\n  author: open-circle\n  version: \"1.0\"\n---\n\n# Valibot\n\nThis skill helps you work effectively with [Valibot](https://valibot.dev), the modular and type-safe schema library for validating structural data.\n\n## When to use this skill\n\n- When the user asks about schema validation with Valibot\n- When creating or modifying Valibot schemas\n- When parsing or validating user input\n- When the user mentions Valibot, schema, or validation\n- When migrating from Zod to Valibot\n\n## CRITICAL: Valibot vs Zod — Do Not Confuse!\n\n**Valibot and Zod have different APIs. Never mix them up!**\n\n### Key Differences\n\n| Feature             | Zod ❌                                | Valibot ✅                                                |\n| ------------------- | ------------------------------------- | --------------------------------------------------------- |\n| Import              | `import { z } from 'zod'`             | `import * as v from 'valibot'`                            |\n| Validations         | Chained methods: `.email().min(5)`    | Pipeline: `v.pipe(v.string(), v.email(), v.minLength(5))` |\n| Parsing             | `schema.parse(data)`                  | `v.parse(schema, data)`                                   |\n| Safe parsing        | `schema.safeParse(data)`              | `v.safeParse(schema, data)`                               |\n| Optional            | `z.string().optional()`               | `v.optional(v.string())`                                  |\n| Nullable            | `z.string().nullable()`               | `v.nullable(v.string())`                                  |\n| Default             | `z.string().default('x')`             | `v.optional(v.string(), 'x')`                             |\n| Transform           | `z.string().transform(fn)`            | `v.pipe(v.string(), v.transform(fn))`                     |\n| Refine/Check        | `z.string().refine(fn)`               | `v.pipe(v.string(), v.check(fn))`                         |\n| Enum                | `z.enum(['a', 'b'])`                  | `v.picklist(['a', 'b'])`                                  |\n| Native enum         | `z.nativeEnum(MyEnum)`                | `v.enum(MyEnum)`                                          |\n| Union               | `z.union([a, b])`                     | `v.union([a, b])`                                         |\n| Discriminated union | `z.discriminatedUnion('type', [...])` | `v.variant('type', [...])`                                |\n| Intersection        | `z.intersection(a, b)`                | `v.intersect([a, b])`                                     |\n| Min/max length      | `.min(5).max(10)`                     | `v.minLength(5), v.maxLength(10)`                         |\n| Min/max value       | `.gte(5).lte(10)`                     | `v.minValue(5), v.maxValue(10)`                           |\n| Infer type          | `z.infer<typeof Schema>`              | `v.InferOutput<typeof Schema>`                            |\n| Infer input         | `z.input<typeof Schema>`              | `v.InferInput<typeof Schema>`                             |\n\n### Common Mistakes to Avoid\n\n```typescript\n// ❌ WRONG - This is Zod syntax, NOT Valibot!\nconst Schema = v.string().email().min(5);\nconst result = Schema.parse(data);\n\n// ✅ CORRECT - Valibot uses functions and pipelines\nconst Schema = v.pipe(v.string(), v.email(), v.minLength(5));\nconst result = v.parse(Schema, data);\n```\n\n```typescript\n// ❌ WRONG - Zod-style optional\nconst Schema = v.object({\n  name: v.string().optional(),\n});\n\n// ✅ CORRECT - Valibot wraps with optional()\nconst Schema = v.object({\n  name: v.optional(v.string()),\n});\n```\n\n```typescript\n// ❌ WRONG - Zod-style default\nconst Schema = v.string().default(\"hello\");\n\n// ✅ CORRECT - Valibot uses second argument\nconst Schema = v.optional(v.string(), \"hello\");\n```\n\n## Installation\n\n```bash\nnpm install valibot     # npm\nyarn add valibot        # yarn\npnpm add valibot        # pnpm\nbun add valibot         # bun\n```\n\nImport with a wildcard (recommended):\n\n```typescript\nimport * as v from \"valibot\";\n```\n\nOr with individual imports:\n\n```typescript\nimport { object, string, pipe, email, parse } from \"valibot\";\n```\n\n## Mental Model\n\nValibot's API is divided into three main concepts:\n\n### 1. Schemas\n\nSchemas define the expected data type. They are the starting point.\n\n```typescript\nimport * as v from \"valibot\";\n\n// Primitive schemas\nconst StringSchema = v.string();\nconst NumberSchema = v.number();\nconst BooleanSchema = v.boolean();\nconst DateSchema = v.date();\n\n// Complex schemas\nconst ArraySchema = v.array(v.string());\nconst ObjectSchema = v.object({\n  name: v.string(),\n  age: v.number(),\n});\n```\n\n### 2. Methods\n\nMethods help you use or modify schemas. The schema is always the first argument.\n\n```typescript\n// Parsing\nconst result = v.parse(StringSchema, \"hello\");\nconst safeResult = v.safeParse(StringSchema, \"hello\");\n\n// Type guard\nif (v.is(StringSchema, data)) {\n  // data is typed as string\n}\n```\n\n### 3. Actions\n\nActions validate or transform data within a `pipe()`. They MUST be used inside pipelines.\n\n```typescript\n// Actions are used in pipe()\nconst EmailSchema = v.pipe(\n  v.string(),\n  v.trim(),\n  v.email(),\n  v.endsWith(\"@example.com\"),\n);\n```\n\n## Pipelines\n\nPipelines extend schemas with validation and transformation actions. A pipeline always starts with a schema, followed by actions.\n\n```typescript\nimport * as v from \"valibot\";\n\nconst UsernameSchema = v.pipe(\n  v.string(),\n  v.trim(),\n  v.minLength(3, \"Username must be at least 3 characters\"),\n  v.maxLength(20, \"Username must be at most 20 characters\"),\n  v.regex(\n    /^[a-z0-9_]+$/i,\n    \"Username can only contain letters, numbers, and underscores\",\n  ),\n);\n\nconst AgeSchema = v.pipe(\n  v.number(),\n  v.integer(\"Age must be a whole number\"),\n  v.minValue(0, \"Age cannot be negative\"),\n  v.maxValue(150, \"Age cannot exceed 150\"),\n);\n```\n\n### Common Validation Actions\n\n**String validations:**\n\n- `v.email()` — Valid email format\n- `v.url()` — Valid URL format\n- `v.uuid()` — Valid UUID format\n- `v.regex(pattern)` — Match regex pattern\n- `v.minLength(n)` — Minimum length\n- `v.maxLength(n)` — Maximum length\n- `v.length(n)` — Exact length\n- `v.nonEmpty()` — Not empty string\n- `v.startsWith(str)` — Starts with string\n- `v.endsWith(str)` — Ends with string\n- `v.includes(str)` — Contains string\n\n**Number validations:**\n\n- `v.minValue(n)` — Minimum value (>=)\n- `v.maxValue(n)` — Maximum value (<=)\n- `v.gtValue(n)` — Greater than (>)\n- `v.ltValue(n)` — Less than (<)\n- `v.integer()` — Must be integer\n- `v.finite()` — Must be finite\n- `v.safeInteger()` — Safe integer range\n- `v.multipleOf(n)` — Must be multiple of n\n\n**Array validations:**\n\n- `v.minLength(n)` — Minimum items\n- `v.maxLength(n)` — Maximum items\n- `v.length(n)` — Exact item count\n- `v.nonEmpty()` — At least one item\n- `v.includes(item)` — Contains item\n- `v.excludes(item)` — Does not contain item\n\n### Custom Validation with check()\n\n```typescript\nconst PasswordSchema = v.pipe(\n  v.string(),\n  v.minLength(8),\n  v.check(\n    (input) => /[A-Z]/.test(input),\n    \"Password must contain an uppercase letter\",\n  ),\n  v.check((input) => /[0-9]/.test(input), \"Password must contain a number\"),\n);\n```\n\n### Value Transformations\n\nThese actions modify the value without changing its type:\n\n**String transformations:**\n\n- `v.trim()` — Remove leading/trailing whitespace\n- `v.trimStart()` — Remove leading whitespace\n- `v.trimEnd()` — Remove trailing whitespace\n- `v.toLowerCase()` — Convert to lowercase\n- `v.toUpperCase()` — Convert to uppercase\n\n**Number transformations:**\n\n- `v.toMinValue(n)` — Clamp to minimum value (if less than n, set to n)\n- `v.toMaxValue(n)` — Clamp to maximum value (if greater than n, set to n)\n\n```typescript\nconst NormalizedEmailSchema = v.pipe(\n  v.string(),\n  v.trim(),\n  v.toLowerCase(),\n  v.email(),\n);\n\n// Clamp number to range 0-100\nconst PercentageSchema = v.pipe(v.number(), v.toMinValue(0), v.toMaxValue(100));\n```\n\n### Type Transformations\n\nFor converting between data types, use these built-in transformation actions:\n\n- `v.toNumber()` — Convert to number\n- `v.toString()` — Convert to string\n- `v.toBoolean()` — Convert to boolean\n- `v.toBigint()` — Convert to bigint\n- `v.toDate()` — Convert to Date\n\n```typescript\n// Convert string to number\nconst PortSchema = v.pipe(v.string(), v.toNumber(), v.integer(), v.minValue(1));\n\n// Convert ISO string to Date\nconst TimestampSchema = v.pipe(v.string(), v.isoDateTime(), v.toDate());\n\n// Convert to boolean\nconst FlagSchema = v.pipe(v.string(), v.toBoolean());\n```\n\n### Custom Transformations\n\nFor custom transformations, use `v.transform()`:\n\n```typescript\nconst DateStringSchema = v.pipe(\n  v.string(),\n  v.isoDate(),\n  v.transform((input) => new Date(input)),\n);\n\n// Custom object transformation\nconst UserSchema = v.pipe(\n  v.object({\n    firstName: v.string(),\n    lastName: v.string(),\n  }),\n  v.transform((input) => ({\n    ...input,\n    fullName: `${input.firstName} ${input.lastName}`,\n  })),\n);\n```\n\n## Object Schemas\n\n### Basic Object\n\n```typescript\nconst UserSchema = v.object({\n  id: v.number(),\n  name: v.string(),\n  email: v.pipe(v.string(), v.email()),\n  age: v.optional(v.number()),\n});\n\ntype User = v.InferOutput<typeof UserSchema>;\n```\n\n### Object Variants\n\n```typescript\n// Regular object - strips unknown keys (default)\nconst ObjectSchema = v.object({ key: v.string() });\n\n// Loose object - allows and preserves unknown keys\nconst LooseObjectSchema = v.looseObject({ key: v.string() });\n\n// Strict object - throws on unknown keys\nconst StrictObjectSchema = v.strictObject({ key: v.string() });\n\n// Object with rest - validates unknown keys against a schema\nconst ObjectWithRestSchema = v.objectWithRest(\n  { key: v.string() },\n  v.number(), // unknown keys must be numbers\n);\n```\n\n### Optional and Nullable Fields\n\n```typescript\nconst ProfileSchema = v.object({\n  // Required\n  name: v.string(),\n\n  // Optional (can be undefined or missing)\n  nickname: v.optional(v.string()),\n\n  // Optional with default\n  role: v.optional(v.string(), \"user\"),\n\n  // Nullable (can be null)\n  avatar: v.nullable(v.string()),\n\n  // Nullish (can be null or undefined)\n  bio: v.nullish(v.string()),\n\n  // Nullish with default\n  theme: v.nullish(v.string(), \"light\"),\n});\n```\n\n### Object Methods\n\n```typescript\nconst BaseSchema = v.object({\n  id: v.number(),\n  name: v.string(),\n  email: v.string(),\n  password: v.string(),\n});\n\n// Pick specific keys\nconst PublicUserSchema = v.pick(BaseSchema, [\"id\", \"name\"]);\n\n// Omit specific keys\nconst UserWithoutPasswordSchema = v.omit(BaseSchema, [\"password\"]);\n\n// Make all optional\nconst PartialUserSchema = v.partial(BaseSchema);\n\n// Make all required\nconst RequiredUserSchema = v.required(PartialUserSchema);\n\n// Merge objects\nconst ExtendedUserSchema = v.object({\n  ...BaseSchema.entries,\n  createdAt: v.date(),\n});\n```\n\n### Cross-Field Validation\n\n```typescript\nconst RegistrationSchema = v.pipe(\n  v.object({\n    password: v.pipe(v.string(), v.minLength(8)),\n    confirmPassword: v.string(),\n  }),\n  v.forward(\n    v.partialCheck(\n      [[\"password\"], [\"confirmPassword\"]],\n      (input) => input.password === input.confirmPassword,\n      \"Passwords do not match\",\n    ),\n    [\"confirmPassword\"],\n  ),\n);\n```\n\n## Arrays and Tuples\n\n### Arrays\n\n```typescript\nconst TagsSchema = v.pipe(\n  v.array(v.string()),\n  v.minLength(1, \"At least one tag required\"),\n  v.maxLength(10, \"Maximum 10 tags allowed\"),\n);\n\n// Array of objects\nconst UsersSchema = v.array(\n  v.object({\n    id: v.number(),\n    name: v.string(),\n  }),\n);\n```\n\n### Tuples\n\n```typescript\n// Fixed-length array with specific types\nconst CoordinatesSchema = v.tuple([v.number(), v.number()]);\n// Type: [number, number]\n\n// Tuple with rest\nconst ArgsSchema = v.tupleWithRest(\n  [v.string()], // first arg is string\n  v.number(), // rest are numbers\n);\n// Type: [string, ...number[]]\n```\n\n## Unions and Variants\n\n### Union\n\n```typescript\nconst StringOrNumberSchema = v.union([v.string(), v.number()]);\n\nconst StatusSchema = v.union([\n  v.literal(\"pending\"),\n  v.literal(\"active\"),\n  v.literal(\"inactive\"),\n]);\n```\n\n### Picklist (for string/number literals)\n\n```typescript\n// Simpler than union of literals\nconst StatusSchema = v.picklist([\"pending\", \"active\", \"inactive\"]);\n\nconst PrioritySchema = v.picklist([1, 2, 3]);\n```\n\n### Variant (discriminated union)\n\nUse `variant` for better performance with discriminated unions:\n\n```typescript\nconst EventSchema = v.variant(\"type\", [\n  v.object({\n    type: v.literal(\"click\"),\n    x: v.number(),\n    y: v.number(),\n  }),\n  v.object({\n    type: v.literal(\"keypress\"),\n    key: v.string(),\n  }),\n  v.object({\n    type: v.literal(\"scroll\"),\n    direction: v.picklist([\"up\", \"down\"]),\n  }),\n]);\n```\n\n## Parsing Data\n\n### parse() — Throws on Error\n\n```typescript\nimport * as v from \"valibot\";\n\nconst EmailSchema = v.pipe(v.string(), v.email());\n\ntry {\n  const email = v.parse(EmailSchema, \"jane@example.com\");\n  console.log(email); // 'jane@example.com'\n} catch (error) {\n  console.error(error); // ValiError\n}\n```\n\n### safeParse() — Returns Result Object\n\n```typescript\nconst result = v.safeParse(EmailSchema, input);\n\nif (result.success) {\n  console.log(result.output); // Valid data\n} else {\n  console.log(result.issues); // Array of issues\n}\n```\n\n### is() — Type Guard\n\n```typescript\nif (v.is(EmailSchema, input)) {\n  // input is typed as string\n}\n```\n\n### Configuration Options\n\n```typescript\n// Abort early - stop at first error\nv.parse(Schema, data, { abortEarly: true });\n\n// Abort pipe early - stop pipeline at first error\nv.parse(Schema, data, { abortPipeEarly: true });\n```\n\n## Type Inference\n\n```typescript\nimport * as v from \"valibot\";\n\nconst UserSchema = v.object({\n  name: v.string(),\n  age: v.pipe(v.string(), v.transform(Number)),\n  role: v.optional(v.string(), \"user\"),\n});\n\n// Output type (after transformations and defaults)\ntype User = v.InferOutput<typeof UserSchema>;\n// { name: string; age: number; role: string }\n\n// Input type (before transformations)\ntype UserInput = v.InferInput<typeof UserSchema>;\n// { name: string; age: string; role?: string | undefined }\n\n// Issue type\ntype UserIssue = v.InferIssue<typeof UserSchema>;\n```\n\n## Error Handling\n\n### Custom Error Messages\n\n```typescript\nconst LoginSchema = v.object({\n  email: v.pipe(\n    v.string(\"Email must be a string\"),\n    v.nonEmpty(\"Please enter your email\"),\n    v.email(\"Invalid email format\"),\n  ),\n  password: v.pipe(\n    v.string(\"Password must be a string\"),\n    v.nonEmpty(\"Please enter your password\"),\n    v.minLength(8, \"Password must be at least 8 characters\"),\n  ),\n});\n```\n\n### Flattening Errors\n\n```typescript\nconst result = v.safeParse(LoginSchema, data);\n\nif (!result.success) {\n  const flat = v.flatten(result.issues);\n  // { nested: { email: ['Invalid email format'], password: ['...'] } }\n}\n```\n\n### Issue Structure\n\nEach issue contains:\n\n- `kind`: 'schema' | 'validation' | 'transformation'\n- `type`: Function name (e.g., 'string', 'email', 'min_length')\n- `input`: The problematic input\n- `expected`: What was expected\n- `received`: What was received\n- `message`: Human-readable message\n- `path`: Array of path items for nested issues\n\n## Fallback Values\n\n```typescript\n// Static fallback\nconst NumberSchema = v.fallback(v.number(), 0);\nv.parse(NumberSchema, \"invalid\"); // Returns 0\n\n// Dynamic fallback\nconst DateSchema = v.fallback(v.date(), () => new Date());\n```\n\n## Recursive Schemas\n\n```typescript\nimport * as v from \"valibot\";\n\ntype TreeNode = {\n  value: string;\n  children: TreeNode[];\n};\n\nconst TreeNodeSchema: v.GenericSchema<TreeNode> = v.object({\n  value: v.string(),\n  children: v.lazy(() => v.array(TreeNodeSchema)),\n});\n```\n\n## Async Validation\n\nFor async operations (e.g., database checks), use async variants:\n\n```typescript\nimport * as v from \"valibot\";\n\nconst isUsernameAvailable = async (username: string) => {\n  // Check database\n  return true;\n};\n\nconst UsernameSchema = v.pipeAsync(\n  v.string(),\n  v.minLength(3),\n  v.checkAsync(isUsernameAvailable, \"Username is already taken\"),\n);\n\n// Must use parseAsync\nconst username = await v.parseAsync(UsernameSchema, \"john\");\n```\n\n## JSON Schema Conversion\n\n```typescript\nimport { toJsonSchema } from \"@valibot/to-json-schema\";\nimport * as v from \"valibot\";\n\nconst EmailSchema = v.pipe(v.string(), v.email());\nconst jsonSchema = toJsonSchema(EmailSchema);\n// { type: 'string', format: 'email' }\n```\n\n## Naming Conventions\n\n### Convention 1: Same Name (Recommended for simplicity)\n\n```typescript\nexport const User = v.object({\n  name: v.string(),\n  email: v.pipe(v.string(), v.email()),\n});\n\nexport type User = v.InferOutput<typeof User>;\n\n// Usage\nconst users: User[] = [];\nusers.push(v.parse(User, data));\n```\n\n### Convention 2: With Suffixes (Recommended when input/output differ)\n\n```typescript\nexport const UserSchema = v.object({\n  name: v.string(),\n  age: v.pipe(v.string(), v.transform(Number)),\n});\n\nexport type UserInput = v.InferInput<typeof UserSchema>;\nexport type UserOutput = v.InferOutput<typeof UserSchema>;\n```\n\n## Common Patterns\n\n### Login Form\n\n```typescript\nconst LoginSchema = v.object({\n  email: v.pipe(\n    v.string(),\n    v.nonEmpty(\"Please enter your email\"),\n    v.email(\"Invalid email address\"),\n  ),\n  password: v.pipe(\n    v.string(),\n    v.nonEmpty(\"Please enter your password\"),\n    v.minLength(8, \"Password must be at least 8 characters\"),\n  ),\n});\n```\n\n### API Response\n\n```typescript\nconst ApiResponseSchema = v.variant(\"status\", [\n  v.object({\n    status: v.literal(\"success\"),\n    data: v.unknown(),\n  }),\n  v.object({\n    status: v.literal(\"error\"),\n    error: v.object({\n      code: v.string(),\n      message: v.string(),\n    }),\n  }),\n]);\n```\n\n### Environment Variables\n\n```typescript\nconst EnvSchema = v.object({\n  NODE_ENV: v.picklist([\"development\", \"production\", \"test\"]),\n  PORT: v.pipe(v.string(), v.transform(Number), v.integer(), v.minValue(1)),\n  DATABASE_URL: v.pipe(v.string(), v.url()),\n  API_KEY: v.pipe(v.string(), v.minLength(32)),\n});\n\nconst env = v.parse(EnvSchema, process.env);\n```\n\n### Date Handling\n\n```typescript\n// String to Date\nconst DateFromStringSchema = v.pipe(\n  v.string(),\n  v.isoDate(),\n  v.transform((input) => new Date(input)),\n);\n\n// Date validation\nconst FutureDateSchema = v.pipe(\n  v.date(),\n  v.minValue(new Date(), \"Date must be in the future\"),\n);\n```\n\n## Additional Resources\n\n- [Valibot Documentation](https://valibot.dev)\n- [Valibot GitHub](https://github.com/open-circle/valibot)\n- [API Reference](https://valibot.dev/api/)\n- [Migration from Zod](https://valibot.dev/guides/migrate-from-zod/)\n\n<!-- File: packages/to-json-schema/README.md (Tokens: ~4461 | Category: plugin-manifest) -->\n# Valibot to JSON Schema\n\nUtility to convert [Valibot](https://valibot.dev) schemas to JSON Schema. Supports JSON Schema draft-07, draft-2020-12, and OpenAPI 3.0 Schema Object formats.\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\ntoJsonSchema(v.string()); // { $schema: \"http://json-schema.org/draft-07/schema#\", type: \"string\" }\n```\n\nThis package is particularly popular for:\n\n- **API Documentation**: Generate OpenAPI specifications from your Valibot schemas\n- **Code Generation**: Create client SDKs and types from your validation schemas\n- **LLM Integration**: Generate structured outputs for Large Language Models\n- **Schema Sharing**: Share validation logic between different programming languages\n\n> Some Valibot features can't be mapped to JSON schema. For example, transformation actions have no equivalent in JSON schema. Also, some Valibot schemas or validations are too JS-specific and do not have an equivalent JSON schema attribute.\n\n## Supported features\n\n**Note**: Converted schemas may behave slightly differently in JSON schema validators (especially for string format) because their implementation is different from Valibot's.\n\n| Schema           | Status | Note                                                                                                                                  |\n| ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------- |\n| `any`            | ✅     |                                                                                                                                       |\n| `array`          | ✅     |                                                                                                                                       |\n| `boolean`        | ✅     |                                                                                                                                       |\n| `enum`           | ⚠️     | Only JSON compatible values are supported                                                                                             |\n| `exactOptional`  | ✅     |                                                                                                                                       |\n| `intersect`      | ✅     |                                                                                                                                       |\n| `lazy`           | ⚠️     | The `.getter` function is always executed with `undefined` as input                                                                   |\n| `literal`        | ⚠️     | Only JSON compatible values are supported                                                                                             |\n| `looseObject`    | ✅     |                                                                                                                                       |\n| `looseTuple`     | ✅     |                                                                                                                                       |\n| `never`          | ✅     |                                                                                                                                       |\n| `null`           | ✅     |                                                                                                                                       |\n| `nullable`       | ✅     |                                                                                                                                       |\n| `nullish`        | ✅     |                                                                                                                                       |\n| `number`         | ✅     |                                                                                                                                       |\n| `objectWithRest` | ✅     |                                                                                                                                       |\n| `object`         | ✅     |                                                                                                                                       |\n| `optional`       | ✅     |                                                                                                                                       |\n| `picklist`       | ⚠️     | Only JSON compatible values are supported                                                                                             |\n| `record`         | ⚠️     | Only `string` schemas for the key of the record are supported. Adds `propertyNames` for key validation (not available in OpenAPI 3.0) |\n| `strictObject`   | ✅     |                                                                                                                                       |\n| `strictTuple`    | ✅     |                                                                                                                                       |\n| `string`         | ✅     |                                                                                                                                       |\n| `tupleWithRest`  | ✅     |                                                                                                                                       |\n| `tuple`          | ✅     |                                                                                                                                       |\n| `union`          | ✅     |                                                                                                                                       |\n| `undefinedable`  | ✅     |                                                                                                                                       |\n| `unknown`        | ✅     |                                                                                                                                       |\n| `variant`        | ⚠️     | The discriminator key will be ignored                                                                                                 |\n\n| Actions         | Status | Note                                                   |\n| --------------- | ------ | ------------------------------------------------------ |\n| `base64`        | ✅     |                                                        |\n| `bic`           | ✅     |                                                        |\n| `cuid2`         | ✅     |                                                        |\n| `decimal`       | ✅     |                                                        |\n| `description`   | ✅     |                                                        |\n| `digits`        | ✅     |                                                        |\n| `domain`        | ✅     |                                                        |\n| `email`         | ✅     |                                                        |\n| `emoji`         | ✅     |                                                        |\n| `empty`         | ✅     |                                                        |\n| `endsWith`      | ✅     |                                                        |\n| `entries`       | ✅     |                                                        |\n| `examples`      | ✅     |                                                        |\n| `gtValue`       | ⚠️     | Only in combination with `number` and `integer` schema |\n| `hash`          | ✅     |                                                        |\n| `hexadecimal`   | ✅     |                                                        |\n| `hexColor`      | ✅     |                                                        |\n| `includes`      | ✅     |                                                        |\n| `integer`       | ✅     |                                                        |\n| `ipv4`          | ✅     |                                                        |\n| `ipv6`          | ✅     |                                                        |\n| `isoDate`       | ✅     |                                                        |\n| `isoDateTime`   | ✅     |                                                        |\n| `isoTime`       | ✅     |                                                        |\n| `isoTimeSecond` | ✅     |                                                        |\n| `isoTimestamp`  | ✅     |                                                        |\n| `isoWeek`       | ✅     |                                                        |\n| `isrc`          | ✅     |                                                        |\n| `jwsCompact`    | ✅     |                                                        |\n| `ksuid`         | ✅     |                                                        |\n| `length`        | ⚠️     | Only in combination with `string` and `array` schema   |\n| `ltValue`       | ⚠️     | Only in combination with `number` and `integer` schema |\n| `mac`           | ✅     |                                                        |\n| `mac48`         | ✅     |                                                        |\n| `mac64`         | ✅     |                                                        |\n| `maxEntries`    | ✅     |                                                        |\n| `maxLength`     | ⚠️     | Only in combination with `string` and `array` schema   |\n| `maxValue`      | ⚠️     | Only in combination with `number` schema               |\n| `metadata`      | ✅     | Additional properties are added without validation     |\n| `minEntries`    | ✅     |                                                        |\n| `minLength`     | ⚠️     | Only in combination with `string` and `array` schema   |\n| `minValue`      | ⚠️     | Only in combination with `number` schema               |\n| `multipleOf`    | ✅     |                                                        |\n| `nanoid`        | ✅     |                                                        |\n| `nonEmpty`      | ✅     |                                                        |\n| `notValue`      | ⚠️     | Only JSON compatible values are supported              |\n| `notValues`     | ⚠️     | Only JSON compatible values are supported              |\n| `octal`         | ✅     |                                                        |\n| `regex`         | ⚠️     | RegExp flags are not supported in JSON Schema          |\n| `rfcEmail`      | ✅     |                                                        |\n| `safeInteger`   | ✅     |                                                        |\n| `slug`          | ✅     |                                                        |\n| `startsWith`    | ✅     |                                                        |\n| `title`         | ✅     |                                                        |\n| `ulid`          | ✅     |                                                        |\n| `url`           | ✅     |                                                        |\n| `uuid`          | ✅     |                                                        |\n| `value`         | ⚠️     | Only JSON compatible values are supported              |\n| `values`        | ⚠️     | Only JSON compatible values are supported              |\n\n> For `length`, `minLength`, and `maxLength`, string constraints have different length semantics in Valibot and JSON Schema. Valibot checks JavaScript string length (`value.length`, UTF-16 code units), while JSON Schema `minLength` and `maxLength` count Unicode code points. This can differ for non-BMP code points such as emoji and for multi-code-point grapheme clusters such as combining marks or ZWJ sequences.\n\n## Configurations\n\n| Option         | Type                                                                  | Note                                                                                                                      |\n| -------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |\n| target         | `'draft-07' \\| 'draft-2020-12' \\| 'openapi-3.0'`                      | The target JSON Schema format. Defaults to `'draft-07'`.                                                                  |\n| typeMode       | `'ignore' \\| 'input' \\| 'output'`                                     | Whether to convert the input or output type of the Valibot schema to JSON Schema.                                         |\n| errorMode      | `'throw' \\| 'warn' \\| 'ignore'`                                       | The policy for handling incompatible schemas and actions.                                                                 |\n| definitions    | `Record<string, GenericSchema>`                                       | The schema definitions for constructing recursive schemas. If not specified, the definitions are generated automatically. |\n| overrideSchema | `(context: OverrideSchemaContext) => JsonSchema \\| null \\| undefined` | Overrides the JSON Schema conversion for a specific Valibot schema.                                                       |\n| ignoreActions  | `string[]`                                                            | The actions that should be ignored during the conversion.                                                                 |\n| overrideAction | `(context: OverrideActionContext) => JsonSchema \\| null \\| undefined` | Overrides the JSON Schema reference for a specific Valibot action.                                                        |\n| overrideRef    | `(context: OverrideRefContext) => string \\| null \\| undefined`        | Overrides the JSON Schema reference for a specific reference ID.                                                          |\n\n### Target format\n\nThe `target` configuration allows you to specify which JSON Schema format to generate. Different targets have different capabilities and syntax:\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst schema = v.nullable(v.string());\n\n// JSON Schema draft-07 (default)\ntoJsonSchema(schema);\n// { $schema: \"http://json-schema.org/draft-07/schema#\", anyOf: [{ type: \"string\" }, { type: \"null\" }] }\n\n// JSON Schema draft-2020-12\ntoJsonSchema(schema, { target: 'draft-2020-12' });\n// { $schema: \"https://json-schema.org/draft/2020-12/schema\", anyOf: [{ type: \"string\" }, { type: \"null\" }] }\n\n// OpenAPI 3.0 Schema Object\ntoJsonSchema(schema, { target: 'openapi-3.0' });\n// { type: \"string\", nullable: true }\n```\n\n**Note**: Some features like `propertyNames` for record schemas are not available in OpenAPI 3.0.\n\n### Type mode\n\nThe `typeMode` configuration controls whether to convert the input or output type of the Valibot schema to JSON Schema.\n\n- When set to `'input'`, conversion stops before the first potential type transformation action or second schema in any pipeline.\n- When set to `'output'`, conversion of any pipelines starts from the last schema in the pipeline. Therefore, the output type must be specified explicitly with a schema after the last type transformation action.\n- When set to `'ignore'` (default), the entire pipeline is converted.\n\nThis is particularly useful when defining API endpoints where external developers need different schema information for requests vs responses:\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst ValibotSchema = v.pipe(\n  v.string(),\n  v.decimal(),\n  v.transform(Number),\n  v.number(),\n  v.maxValue(100)\n);\n\ntoJsonSchema(ValibotSchema, { typeMode: 'input' });\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"string\",\n//   pattern: \"^[+-]?(?:\\\\d*\\\\.)?\\\\d+$\"\n// }\n\ntoJsonSchema(ValibotSchema, { typeMode: 'output' });\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"number\",\n//   maximum: 100\n// }\n```\n\n### Error mode\n\nThe `errorMode` configuration controls how the converter handles unsupported schemas and actions. By default, the error mode is set to `'throw'`. To force the conversion of unsupported Valibot features, you can set it to `'ignore'`.\n\n> Unsupported schemas usually return an empty JSON schema (`{}`) and unsupported actions are usually ignored.\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\ntoJsonSchema(v.file(), { errorMode: 'ignore' }); // {}\n\ntoJsonSchema(v.pipe(v.string(), v.creditCard()), { errorMode: 'ignore' }); // { type: \"string\" }\n```\n\n### Override functions\n\nThe package provides powerful override capabilities to customize the JSON Schema conversion process. You can override the conversion of specific schemas, actions, or references.\n\n#### Override schema conversion\n\nHandle unsupported schemas or customize conversion behavior:\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst ValibotSchema = v.object({ createdAt: v.date() });\n\ntoJsonSchema(ValibotSchema, {\n  overrideSchema(context) {\n    if (context.valibotSchema.type === 'date') {\n      return { type: 'string', format: 'date-time' };\n    }\n  },\n});\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"object\",\n//   properties: {\n//     createdAt: { type: \"string\" format: \"date-time\" }\n//   },\n//   required: [\"createdAt\"]\n// }\n```\n\n#### Override reference IDs\n\nCustomize reference IDs for OpenAPI or other specifications:\n\n```js\nimport { toJsonSchemaDefs } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst UserSchema = v.object({ name: v.string() });\n\ntoJsonSchemaDefs(\n  { UserSchema },\n  { overrideRef: (context) => `#/schemas/${context.referenceId}` }\n);\n```\n\n### Enhanced metadata support\n\nUse the generic `metadata` action to add title, description, and examples to your schemas or the individual `title` and `description` actions. Any other properties of the `metadata` action are added to the JSON Schema without further validation. This allows you to specify custom annotations and standard keywords such as `format`:\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst ValibotSchema = v.pipe(\n  v.string(),\n  v.email(),\n  v.metadata({\n    title: 'Email Schema',\n    description: 'A schema that validates email addresses.',\n    examples: ['jane@example.com'],\n    'x-category': 'auth',\n  })\n);\n\ntoJsonSchema(ValibotSchema);\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"string\",\n//   format: \"email\",\n//   title: \"Email Schema\",\n//   description: \"A schema that validates email addresses.\",\n//   examples: [\"jane@example.com\"],\n//   \"x-category\": \"auth\"\n// }\n```\n\n### Definitions\n\nNested and recursive schemas can be broken in multiple reusable definitions.\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst EmailSchema = v.pipe(v.string(), v.email());\ntoJsonSchema(v.object({ email: EmailSchema }), {\n  definitions: { EmailSchema },\n});\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"object\",\n//   properties: {\n//     email: {\n//       $ref: \"#/$defs/EmailSchema\"\n//     }\n//   },\n//   required: [\"email\"],\n//   $defs: {\n//     EmailSchema: {\n//       type: \"string\",\n//       format: \"email\"\n//     }\n//   }\n// }\n```\n\nDefinitions are not required for converting `lazy` schemas. Missing definitions will be generated automatically.\n\n```js\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst StringSchema = v.string();\ntoJsonSchema(v.object({ key: v.lazy(() => StringSchema) }));\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"object\",\n//   properties: {\n//     key: {\n//       $ref: \"#/$defs/0\"\n//     }\n//   },\n//   required: [\"key\"],\n//   $defs: {\n//     0: {\n//       type: \"string\"\n//     }\n//   }\n// }\n```\n\n## Additional functions\n\n### `toStandardJsonSchema`\n\nConverts a Valibot schema to the [Standard JSON Schema](https://standardschema.dev/) format. This format is useful when working with tools and libraries that support the Standard JSON Schema specification.\n\n```js\nimport { toStandardJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst schema = toStandardJsonSchema(\n  v.object({\n    id: v.pipe(v.string(), v.uuid()),\n    name: v.pipe(v.string(), v.nonEmpty()),\n    age: v.optional(v.number()),\n  })\n);\n```\n\n### `toJsonSchemaDefs`\n\nConverts only the provided Valibot schema definitions to JSON Schema definitions, without wrapping them in a root schema. This is particularly useful for OpenAPI specifications where you need only the schema definitions.\n\n```js\nimport { toJsonSchemaDefs } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst EmailSchema = v.pipe(v.string(), v.email());\nconst UserSchema = v.object({\n  name: v.string(),\n  email: EmailSchema,\n});\n\ntoJsonSchemaDefs({ EmailSchema, UserSchema });\n\n// {\n//   EmailSchema: {\n//     type: \"string\",\n//     format: \"email\"\n//   },\n//   UserSchema: {\n//     type: \"object\",\n//     properties: {\n//       name: {\n//         type: \"string\"\n//       },\n//       email: {\n//         $ref: \"#/$defs/EmailSchema\"\n//       }\n//     },\n//     required: [\"name\", \"email\"]\n//   }\n// }\n```\n\n#### OpenAPI integration\n\nFor OpenAPI specifications, you can customize reference IDs:\n\n```js\nimport { toJsonSchemaDefs } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst ValibotSchema1 = v.string();\nconst ValibotSchema2 = v.number();\nconst ValibotSchema3 = v.tuple([ValibotSchema1, ValibotSchema2]);\n\ntoJsonSchemaDefs(\n  { ValibotSchema1, ValibotSchema2, ValibotSchema3 },\n  { overrideRef: (context) => `#/schemas/${context.referenceId}` }\n);\n\n// {\n//   ValibotSchema1: { type: \"string\" },\n//   ValibotSchema2: { type: \"number\" },\n//   ValibotSchema3: {\n//     type: \"array\",\n//     items: [\n//       { $ref: \"#/schemas/ValibotSchema1\" },\n//       { $ref: \"#/schemas/ValibotSchema2\" }\n//     ],\n//     minItems: 2\n//   }\n// }\n```\n\n### Global definitions\n\nFor advanced use cases, you can manage global schema definitions that will be automatically used when converting schemas. This is particularly useful for larger projects with many reusable schemas.\n\n```js\nimport { addGlobalDefs, toJsonSchema } from '@valibot/to-json-schema';\nimport * as v from 'valibot';\n\nconst ValibotSchema1 = v.string();\nconst ValibotSchema2 = v.number();\n\naddGlobalDefs({ ValibotSchema1, ValibotSchema2 });\n\nconst ValibotSchema3 = v.tuple([ValibotSchema1, ValibotSchema2]);\n\ntoJsonSchema(ValibotSchema3);\n\n// {\n//   $schema: \"http://json-schema.org/draft-07/schema#\",\n//   type: \"array\",\n//   items: [\n//     { $ref: \"#/$defs/ValibotSchema1\" },\n//     { $ref: \"#/$defs/ValibotSchema2\" }\n//   ],\n//   minItems: 2,\n//   $defs: {\n//     ValibotSchema1: { type: \"string\" },\n//     ValibotSchema2: { type: \"number\" }\n//   }\n// }\n```\n\nYou can also convert global definitions directly using `toJsonSchemaDefs`:\n\n```js\nconst globalDefs = getGlobalDefs();\nif (globalDefs) {\n  const schemaDefs = toJsonSchemaDefs(globalDefs);\n}\n```\n</yakaai_skills>"}