Skip to content
Back to skills

Valibot Best Practices

ASecurity

Valibot conventions for owned wire contracts and explicit validation outcomes. Use when defining or reviewing Valibot schemas or parsing untrusted data with Valibot.

  • 12 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 6, 2026
documentationrustgitapidocumentation

Works with

  • api

Security analysis

A100/100

Pro scans all 12 files and shows the line behind each finding

Scanned September 6, 2026

npx -y skills add Casper-Studios/casper-marketplace --skill valibot-best-practices --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Valibot Best Practices?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Valibot Best Practices
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/casper-studios-valibot-best-practices/badge)](https://www.skillsdirectory.com/skills/casper-studios-valibot-best-practices)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: valibot-best-practices
description: Valibot conventions for owned wire contracts and explicit validation outcomes. Use when defining or reviewing Valibot schemas or parsing untrusted data with Valibot.
license: MPL-2.0
metadata:
  author: 'Basti Ortiz <ortiz@bastidood.dev>'
  source: 'https://github.com/BastiDood/skills'
---

# Valibot Best Practices

Treat a Valibot schema as the owned contract at an untrusted data boundary: it defines accepted wire values, produces trusted domain values, and makes invalid input an explicit, intentional outcome.

## Library Sources

- GitHub repository ID: `open-circle/valibot`
- Context7 library ID: `/open-circle/valibot`
- DeepWiki repository ID: `open-circle/valibot`

Use Context7 for current documentation and DeepWiki for implementation details.

## Effective Strategies for Valibot

Read the references that apply to the current task before defining or reviewing Valibot schemas and parsing code.

1. Make schemas the owned, trusted contract for wire data.
   - [Make a schema that proves a domain shape the single source of truth](./references/schema-ownership.md) and infer the exported type instead of maintaining a duplicate declaration.
   - [Validate serialized data at its trust boundary](./references/serialized-trust-boundaries.md), including authenticated external payloads, before it becomes a domain value.
   - [Keep constructors under the `v` namespace](./references/namespace-imports.md) so library ownership stays clear and import forms remain consistent.
2. Encode exact wire semantics inside the schema.
   - [Encode missing and `null` wire semantics](./references/wire-nullability.md) with the matching wrapper rather than whichever wrapper compiles.
   - [Dispatch literal-tagged alternatives with `v.variant`](./references/discriminated-variants.md) so Valibot selects and reports the failing tagged branch.
   - [Define defaults with exact domain meaning in the schema](./references/schema-defaults.md); do not use a default to reinterpret malformed input.
   - [Transform normalized wire input inside the schema](./references/schema-transformations.md) so consumers receive trusted domain values rather than raw serialized forms.
3. Make validation failure match the boundary contract.
   - [Choose the parse API from the failure contract](./references/parse-failure-contracts.md): abort a violated invariant or return an expected validation branch.
   - [Preserve expected validation issues](./references/validation-failure-preservation.md) instead of substituting an invented `null` or empty value.

Files in this skill

  • LICENSE.txt16.3 KB
  • SKILL.md2.5 KB
  • agents/openai.yaml121 B
  • references/discriminated-variants.md858 B
  • references/namespace-imports.md381 B
  • references/parse-failure-contracts.md697 B
  • references/schema-defaults.md292 B
  • references/schema-ownership.md562 B
  • references/schema-transformations.md212 B
  • references/serialized-trust-boundaries.md670 B
  • references/validation-failure-preservation.md565 B
  • references/wire-nullability.md723 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.