Ai Output Validationのロゴ

Ai Output Validation

組織
DevelopersGlobal
ai-output-validation

Validates, parses, and sanitizes AI-generated outputs before they reach end users or downstream systems. Structured output enforcement, schema validation, and fallback handling.

概要

公開者DevelopersGlobal
リポジトリai-agent-skills
スキル名ai-output-validation
スター
212
フォーク
33
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

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

  • どのLLMでも利用可能

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

  • 指示だけで完結

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

  • オープンソース

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

インストール

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

1

TypingMindにインストール

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

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

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

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

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

TypingMindで使用

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

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

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

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

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

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、未使用のスキルにはコストがかかりません。

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

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

スキルの指示

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

Overview

AI models produce unstructured text by default. In production pipelines, unstructured outputs cause brittle parsing, unexpected behavior, and silent failures. This skill enforces structured output generation and validation at every AI system boundary.

When to Use

  • Any AI pipeline where output is used programmatically (not just displayed to a user)
  • When AI output feeds into another system, database, or agent
  • When building agentic systems that make decisions based on AI output
  • When AI generates code, SQL, JSON, or other structured formats

Process

Step 1: Define Output Schema Before Prompting

  1. Define the exact structure you need BEFORE writing the prompt.
  2. Use JSON Schema or Pydantic/Zod models to formalize the expected output.
  3. Example schema:
    json
    {
      "type": "object",
      "required": ["summary", "action", "confidence"],
      "properties": {
        "summary": {"type": "string", "maxLength": 200},
        "action": {"type": "string", "enum": ["approve", "reject", "review"]},
        "confidence": {"type": "number", "minimum": 0, "maximum": 1}
      }
    }
  4. Design the schema to be minimal — only what you actually need.

Verify: Schema is defined and versioned before any prompt is written.

Step 2: Prompt for Structured Output

  1. Explicitly instruct the model to output in your defined format.
  2. Include the schema or an example in the prompt.
  3. Use models/APIs that support structured output natively where available (OpenAI structured outputs, Gemini JSON mode, Anthropic tool use).
  4. Prompt pattern:
    Respond ONLY with valid JSON matching this schema:
    {schema}
    
    Do not include explanation or markdown. Output raw JSON only.

Verify: Prompt explicitly requests structured output with schema reference.

Step 3: Validate and Parse Output

  1. Parse the output against your schema — never use raw AI output directly.
  2. If parsing fails:
    • Log the raw output and the parse error
    • Retry with a clarification prompt (max 2 retries)
    • After 2 failures: return a structured error, not a crash
  3. Validate semantic constraints beyond the schema:
    • Is the confidence score consistent with the action?
    • Are referenced IDs in the database?
    • Are dates in the valid range?

Verify: All AI outputs pass schema validation before use. Failed validations are logged.

Step 4: Sanitize for Downstream Use

  1. If AI output will be rendered as HTML: sanitize against XSS.
  2. If AI output will be executed as code: sandbox it and review before execution.
  3. If AI output will be stored in a database: sanitize against injection.
  4. Never trust AI output the way you'd trust your own code — it's user-generated content.

Verify: AI output is sanitized appropriate to its destination.

Step 5: Monitor Output Quality

  1. Log the schema validation pass/fail rate.
  2. Sample and review AI outputs regularly for semantic correctness.
  3. Alert on high validation failure rates (>5%).

Verify: Validation metrics are tracked. Alert configured.

Common Rationalizations (and Rebuttals)

ExcuseRebuttal
"The model outputs valid JSON 99% of the time"That 1% causes production incidents. Always validate.
"We display it to users, not parse it"Users act on AI output. Wrong output drives wrong actions.
"Structured output adds latency"Validation is microseconds. Debugging unvalidated output is hours.
"The model is deterministic enough"No LLM is deterministic enough to skip validation.

Red Flags

  • AI output used directly without schema validation
  • JSON.parse() without try/catch around AI output
  • AI-generated SQL or code executed without review
  • No logging of validation failures
  • AI output rendered as HTML without sanitization

Verification

  • Output schema defined and versioned
  • Prompt explicitly requests structured output
  • Schema validation on every AI response
  • Retry logic for validation failures (max 2 retries)
  • Semantic validation beyond schema (constraint checks)
  • Sanitization applied appropriate to output destination
  • Validation failure rate monitored

References

よくある質問

AIスキル「Ai Output Validation」では何ができますか?

Validates, parses, and sanitizes AI-generated outputs before they reach end users or downstream systems. Structured output enforcement, schema validation, and fallback handling.

TypingMindでAi Output Validationを使うメリットは何ですか?

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

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

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

Ai Output Validationを使えるAIモデルはどれですか?

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

Ai Output Validationは何個のAIモデルで使えますか?

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

AIスキル「Ai Output Validation」は無料ですか?

はい。DevelopersGlobalがGitHubでMITライセンスの下で公開しています。支払いが必要なのは、利用したトークンに対する、ご自身が契約するAIプロバイダーへの料金だけです。

AIスキルとは何ですか?

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

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

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

すべて見る

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

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