Valibotのロゴ

Valibot

コミュニティ
tuanductran
valibot

hr-skillsモノレポでスキーマ検証ライブラリとしてValibotを使うためのリポジトリガイドです。packages/hr-skills-ref/src/client/schema.tsまたはpackages/hr-skills-build/src/client/shared/schema.tsのスキーマを作成・変更するとき、解析したYAMLフロントマターを検証するとき、safeParseの結果を処理するとき、またはスキーマから型を推論するときに使用します。

Add to TypingMind

概要

公開者tuanductran
リポジトリhr-skills
スキル名valibot
スター
78
フォーク
20
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    tuanductranがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Valibot」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/tuanductran/hr-skills/tree/main/.agents/skills/valibot
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/tuanductran/hr-skills.git /tmp/hr-skills
mkdir -p .claude/skills
cp -r /tmp/hr-skills/.agents/skills/valibot .claude/skills/valibot
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでValibotを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にValibotを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Valibotは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Valibot in hr-skills

This skill covers how Valibot is used within the hr-skills monorepo specifically. It is not a general Valibot reference — see valibot.dev for the full API. The focus here is on the patterns, conventions, and pitfalls that appear in this codebase.

Where Valibot is used

Two files define schemas; all other packages consume them:

  • packages/hr-skills-ref/src/client/schema.ts — SkillPropertiesSchema, the generic Agent Skills shape used by readProperties() in loader.ts
  • packages/hr-skills-build/src/client/shared/schema.ts — MarketplaceJsonSchema (validates .claude-plugin/marketplace.json), SkillFrontmatterSchema (used by parseSkillFrontmatter() in parser.ts), and RegistrySchema (used by validateRegistryConsistency() in validate-registry.ts to check registry/skills.json against its schema)

Import pattern used throughout the repo:

typescript
import * as v from 'valibot';

Never use named imports (import { object, string } from 'valibot') — the wildcard * as v is the established convention here.

Supported tasks

  • Write or extend a schema in schema.ts for a new frontmatter field
  • Add a v.pipe(v.string(), v.trim()) field to an existing object schema
  • Handle a v.safeParse() result correctly in parser.ts or loader.ts
  • Infer the output type from a schema with v.InferOutput<typeof Schema>
  • Add an optional field to SkillPropertiesSchema or SkillFrontmatterSchema
  • Validate marketplace.json shape against MarketplaceJsonSchema in sync.ts
  • Add a v.record() field for arbitrary string metadata
  • Debug a failed v.safeParse() result using v.summarize(result.issues)
  • Make a field optional without breaking the existing type contract
  • Understand why v.safeParse is used instead of v.parse in this repo

Key prompts

Schema authoring

  1. "Add an optional [field] field to SkillPropertiesSchema that accepts a trimmed string."
  2. "Write the Valibot schema for a new marketplace plugin entry with fields [list]."
  3. "I need to validate a [shape] object in hr-skills-build. Write the schema."
  4. "Add a required string field [name] to SkillFrontmatterSchema with trim applied."

Parsing and results

  1. "Show me how parseSkillFrontmatter handles a v.safeParse failure in this repo."
  2. "When should I use v.safeParse vs v.parse in hr-skills-build?"
  3. "How does loader.ts throw a ValidationError from a failed v.safeParse result?"
  4. "Show me the correct way to check result.success and access result.output."

Type inference

  1. "How do I infer the output type from SkillPropertiesSchema?"
  2. "What is the difference between v.InferOutput and v.InferInput in this repo?"
  3. "How do I export both the schema and its type from schema.ts following repo conventions?"
  4. "Show me how SkillFrontmatter is inferred and used in parser.ts."

Optional and record fields

  1. "How is v.optional used in this repo for nullable frontmatter fields?"
  2. "Show me how v.record is used for the metadata field in SkillPropertiesSchema."
  3. "Add an optional field to SkillFrontmatterSchema that defaults to undefined."
  4. "How does toStringRecord convert unknown metadata values before passing to v.safeParse?"

Valibot vs Zod — critical differences

  1. "I accidentally wrote Zod-style chaining. Show me the correct Valibot equivalent."
  2. "How do I use v.pipe with v.trim and v.minLength like the existing schemas do?"
  3. "What is the Valibot equivalent of Zod's z.string().optional()?"
  4. "Show me how v.summarize works on result.issues for error reporting."

Tips

  • Prefer v.safeParse for anything derived from user-authored content (parser.ts's parseSkillFrontmatter, loader.ts) — parser.ts returns an empty object on failure, and loader.ts throws a typed ValidationError using v.summarize(result.issues). Throwing directly from v.parse bypasses that error handling pattern. One deliberate exception: build/sync.ts#syncMarketplace() uses v.parse directly against MarketplaceJsonSchema, since .claude-plugin/marketplace.json is a repo-committed file expected to always be valid — an unhandled throw there is the intended fail-fast behavior, not a bug to fix.
  • Apply v.pipe(v.string(), v.trim()) to every string field that comes from user-authored YAML — frontmatter values frequently have trailing whitespace or newlines that would silently fail downstream string comparisons.
  • Use v.optional() wrapping, not chained methods — v.optional(v.string()) not v.string().optional(). Valibot does not chain; it composes.
  • Infer types with v.InferOutput<typeof Schema> and export the type alongside the schema in the same file. See how SkillProperties and SkillFrontmatter are exported in their respective schema.ts files as the pattern to follow.
  • Never add a new schema file — both packages already have one schema.ts each. Add fields to the existing schemas unless there is a genuinely separate data shape that doesn't belong in either existing file.
  • When a v.safeParse result fails, log v.summarize(result.issues) for a human-readable summary — that is what ValidationError in loader.ts uses and what @clack/prompts surfaces to the terminal.

Common mistakes

  • Using Zod-style chaining such as v.string().trim().email() — Valibot has no method chaining. Use v.pipe(v.string(), v.trim(), v.email()) instead.
  • Calling v.parse(Schema, data) on user-authored content (SKILL.md frontmatter, etc.) instead of v.safeParse — this throws a raw ValiError that bypasses the typed error hierarchy in errors.ts. Use v.safeParse and handle result.success explicitly. (sync.ts's v.parse against a repo-committed marketplace.json is the one intentional exception — see Tips.)
  • Forgetting v.trim() in the pipeline for string fields parsed from YAML — without it, fields with trailing newlines or spaces will pass validation but cause subtle mismatch bugs in downstream string comparisons like author name normalization.
  • Adding v.InferInput instead of v.InferOutput when the schema has no transforms — in this repo all schemas use v.trim() which counts as a transform, so input and output types differ slightly. Prefer InferOutput.

よくある質問

AIスキル「Valibot」では何ができますか?

hr-skillsモノレポでスキーマ検証ライブラリとしてValibotを使うためのリポジトリガイドです。packages/hr-skills-ref/src/client/schema.tsまたはpackages/hr-skills-build/src/client/shared/schema.tsのスキーマを作成・変更するとき、解析したYAMLフロントマターを検証するとき、safeParseの結果を処理するとき、またはスキーマから型を推論するときに使用します。

TypingMindでValibotを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Valibotはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにValibotをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/tuanductran/hr-skills/tree/main/.agents/skills/valibotを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Valibotを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Valibotで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもValibotを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Valibot」は無料ですか?

はい。tuanductranがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇