create-atomic-schema
できること
このガイドは、Atomic Agentsのフレームワークで、エージェントとツールが使う入力と出力の形を書く方法を説明します。AIアプリの各部分が期待し、返すデータを定義する開発者向けです。
使う場面
- ✓開発者が、エージェントのために言語モデルに埋めてもらう出力の形が必要なとき。
- ✓開発者が、既存のエージェントやツールの入力にフィールドを追加したいとき。
- ✓開発者が、ツールの成功と失敗のための別々の出力の形が欲しいとき。
スキルのリンク
https://github.com/Eigenwise/atomic-agents/blob/main/claude-plugin/atomic-agents/skills/create-atomic-schema/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“担当者と期限を持つ手順のリストを返す、プランナーのエージェントの出力スキーマを設計してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
このスキルは、スキーマを誰が使うか、どのフィールドと失敗のケースが必要かを尋ねてから、docstringとフィールドの説明を持つスキーマのクラスを書きます。これらの説明はモデルの指針にもなるためです。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Create an Atomic Agents Schema
Author a BaseIOSchema pair (input and/or output) that becomes the contract between an agent or tool and its caller. The framework enforces docstrings on every subclass, and Instructor flows field descriptions into the LLM prompt — so the schema is part of the prompt, not just typing.
For deep material (validators, discriminated unions, error envelopes), the authority is ../framework/references/schemas.md. This skill is the action-oriented path: clarify → write → validate.
When this fires vs the umbrella framework skill
- This skill: the user is creating or modifying a specific schema — e.g. "design the output schema for the planner agent", "add a field to
WeatherInput", "split the result into success and failure variants". frameworkskill: the user is asking about Atomic Agents in general or doing something other than authoring schemas.
Phase 1 — Clarify
Ask only what is not already obvious from context. Bundle into one message; do not interrogate one-at-a-time.
- Caller — is this for an
AtomicAgent, aBaseTool, both (an agent that emits a tool-input schema), or a nested sub-schema? - Direction — input only, output only, or a paired Input/Output?
- Fields — what fields does the caller need, with which types? (Required vs optional, defaults, constraints.)
- Failure modes — can this legitimately fail? If yes, plan a typed error variant rather than raising. See
../framework/references/schemas.md→ "Error-schema pattern".
If the user is mid-conversation about an existing schema, skip questions answered in context.
Phase 2 — Write
Place schema(s) where they will be imported from. Conventional locations:
<project>/agents/<agent_name>/schemas.py— agent-owned schemas<project>/tools/<tool_name>_tool.py— tool I/O lives next to the tool<project>/schemas/<topic>.py— schemas shared across multiple components
Required ingredients on every schema
- Subclass
BaseIOSchema(notBaseModel). - A non-empty class docstring — the framework raises at import otherwise. Write it for the LLM, because Instructor uses it as the schema's
description. - Every
Field(...)carries adescription=written for the LLM. - Use
Literal[...]for closed sets before reaching forEnum— flatter JSON Schema, easier for Instructor.
Minimal template
from typing import Optional, Literal
from pydantic import Field
from atomic_agents import BaseIOSchema
class WeatherInput(BaseIOSchema):
"""A request for current weather conditions."""
city: str = Field(..., description="City name, e.g. 'Brussels' or 'New York'.")
units: Literal["metric", "imperial"] = Field(
default="metric",
description="Unit system for the temperature.",
)
class WeatherOutput(BaseIOSchema):
"""Current weather conditions for a city."""
status: Literal["ok", "error"] = Field(..., description="Outcome code.")
temperature_c: Optional[float] = Field(
default=None, description="Temperature in Celsius when status='ok'."
)
summary: Optional[str] = Field(
default=None, description="Human-readable summary when status='ok'."
)
error: Optional[str] = Field(
default=None, description="Failure message when status='error'."
)
When to add validators
- Field-level for normalization (lowercase, strip, enum coercion) and single-field validation.
- Model-level (
@model_validator(mode="after")) for cross-field rules (start ≤ end, mutually exclusive flags).
Validation errors trigger Instructor retries and fire the parse:error hook — they're a feature, not a failure path. Do not swallow them.
When to use discriminated unions
If the caller must exhaustively handle multiple result shapes, prefer a union over an inflated single schema:
class SearchSuccess(BaseIOSchema):
"""Successful search result."""
kind: Literal["ok"] = "ok"
results: list[str] = Field(..., description="Matching items.")
class SearchFailure(BaseIOSchema):
"""Search could not complete."""
kind: Literal["error"] = "error"
code: Literal["rate_limited", "no_results", "upstream_error"] = Field(
..., description="Machine-readable failure code."
)
message: str = Field(..., description="Human-readable failure reason.")
class SearchOutput(BaseIOSchema):
"""Search outcome — success or typed failure."""
result: SearchSuccess | Se
よくある質問
スキーマにdocstringが必要なのはなぜですか?
フレームワークが必要としており、説明は言語モデルが各フィールドを正しく埋める助けになるからです。
スキーマに失敗の版を持たせられますか?
はい。失敗しうる出力については、成功とエラーのバリアントを扱うとスキルは述べています。
誰が対象ですか?
型付きのデータの契約を必要とするAtomic Agentsのアプリを作る開発者です。
詳細
作者による元の説明
Design and write a `BaseIOSchema` input/output pair for an Atomic Agents agent or tool — docstrings, field descriptions, validators, error variants. Use when the user asks to "create a schema", "design the input/output schema", "define an `IOSchema`", "write a `BaseIOSchema`", "model the agent's output", or runs `/atomic-agents:create-atomic-schema`.
repo: Eigenwise/atomic-agents
人気
- GitHubのスター
- 6.3k
- ランキング
- #14239
- ライセンス
- MIT
- 更新日
- 2026/10/29
コメント
- …
このリポジトリの他のスキル
create-atomic-agent
6.3kエージェントが、型付きの入力と出力、システムプロンプト、選んだAIプロバイダーを持つ新しいAtomic Agentsのエージェントを作れるよう支援します。
create-atomic-context-provider
6.3kエージェントが、Atomic Agentsのエージェントにコンテキストのプロバイダーを追加し、時刻や取得した文書などの新しい詳細がプロンプトに現れるよう支援します。
create-atomic-tool
6.3kAtomicAgentsアプリ向けに、エージェントが呼び出せる型付きツールを作成するのを支援します。
framework
6.3kAtomic AgentsのPythonフレームワークを正しく使えるよう、エージェントを支援します。スキーマ、エージェント、ツール、プロバイダー設定が対象です。
似ているスキル
diffs
394k編集内容の実際の共有可能な差分を、手書きの要約ではなく、ビューアーのリンクや画像ファイルとして作成するようエージェントを支援します。
coding-agent
394kCodex、Claude Code、OpenCodeに大きめのコーディング作業をバックグラウンドのワーカーとして渡し、その進捗を確認するようエージェントを支援します。
gh-issues
394kGitHubのイシューを探し、取り組むものを選び、修正を含むプルリクエストを開くようエージェントを支援します。レビューコメントへの対応も含みます。