create-atomic-schema
Fungsinya
Dokumen ini menjelaskan cara menulis bentuk input dan output yang dipakai agent dan alat dalam kerangka kerja Atomic Agents. Skill ini ditujukan untuk pengembang yang mendefinisikan data yang diharapkan dan dikembalikan setiap bagian aplikasi AI.
Kapan dipakai
- βSaat pengembang membutuhkan bentuk keluaran yang harus diisi model bahasa untuk sebuah agent.
- βKetika pengembang ingin menambahkan field pada input agent atau alat yang sudah ada.
- βSaat pengembang ingin bentuk keluaran terpisah untuk keberhasilan dan kegagalan sebuah alat.
Link skill
https://github.com/Eigenwise/atomic-agents/blob/main/claude-plugin/atomic-agents/skills/create-atomic-schema/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βRancang skema keluaran untuk agent perencana yang mengembalikan daftar langkah beserta penanggung jawab dan tanggal tenggatnya.β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Skill ini bertanya siapa yang memakai skema dan field serta kasus kegagalan apa yang dibutuhkan, lalu menulis kelas skema dengan docstring dan deskripsi field, karena deskripsi tersebut juga memandu model.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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
Pertanyaan umum
Mengapa skema memerlukan docstring?
Kerangka kerja mewajibkannya, dan deskripsinya membantu model bahasa mengisi setiap field dengan benar.
Bisakah skema memiliki versi kegagalan?
Bisa. Skill ini mencakup varian keberhasilan dan kesalahan untuk keluaran yang bisa gagal.
Untuk siapa skill ini?
Untuk pengembang aplikasi Atomic Agents yang membutuhkan kontrak data bertipe.
Detail
Deskripsi asli dari pembuat
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
Popularitas
- Bintang GitHub
- 6.3k
- Peringkat
- #14239
- Lisensi
- MIT
- Diperbarui
- 29/10/2026
Komentar
- β¦
Skill lain dari repositori ini
create-atomic-agent
6.3kMembantu agent Anda membangun agent Atomic Agents baru dengan input dan output bertipe, prompt sistem, serta penyedia AI yang dipilih.
create-atomic-context-provider
6.3kMembantu agent Anda menambahkan penyedia konteks ke agent Atomic Agents, sehingga detail terbaru seperti waktu atau dokumen yang diambil muncul di prompt-nya.
create-atomic-tool
6.3kMembantu agent Anda membangun alat bertipe untuk aplikasi Atomic Agents, seperti pembungkus API atau kalkulator yang bisa dipanggil agent.
framework
6.3kMembantu agent Anda bekerja dengan benar di kerangka kerja Python Atomic Agents, mencakup skema, agent, alat, prompt, dan pengaturan penyedia.
Skill serupa
diffs
394kMemungkinkan agent Anda menghasilkan diff perubahan yang nyata dan dapat dibagikan sebagai tautan viewer atau file gambar, bukan ringkasan yang ditulis manual.
coding-agent
394kMembantu agent Anda menyerahkan pekerjaan pemrograman besar ke Codex, Claude Code, atau OpenCode di latar belakang, lalu memeriksa kemajuannya.
gh-issues
394kMembantu agent Anda menemukan issue GitHub, memilih yang dikerjakan, dan membuka pull request perbaikan, termasuk tindak lanjut komentar tinjauan.