Zum Inhalt springen
Skillpedia
Allgemeines Programmieren6.3k · #14239

create-atomic-schema

Was er macht

Es erklärt, wie man die Ein- und Ausgabeformen schreibt, die Agenten und Werkzeuge im Framework Atomic Agents nutzen. Es richtet sich an Entwickler, die die Daten festlegen, die jeder Teil einer KI-App erwartet und zurückgibt.

Wann du ihn nutzt

  • ✓Wenn ein Entwickler eine Ausgabeform braucht, die ein Sprachmodell für einen Agenten ausfüllen soll.
  • ✓Wenn ein Entwickler einem bestehenden Agenten oder Werkzeug ein Feld in der Eingabe hinzufügen will.
  • ✓Wenn ein Entwickler getrennte Ausgabeformen für Erfolg und Fehler eines Werkzeugs will.

Link zum Skill

https://github.com/Eigenwise/atomic-agents/blob/main/claude-plugin/atomic-agents/skills/create-atomic-schema/SKILL.md

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/Eigenwise/atomic-agents/blob/main/claude-plugin/atomic-agents/skills/create-atomic-schema/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Entwirf das Ausgabeschema für einen Planer-Agenten, der eine Liste von Schritten mit Verantwortlichen und Fälligkeitsdaten zurückgibt.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Die Fähigkeit fragt, wer das Schema nutzt und welche Felder und Fehlerfälle nötig sind, und schreibt dann eine Schemaklasse mit Dokumentationstext und Feldbeschreibungen, da diese Beschreibungen auch das Modell anleiten.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von 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".
  • framework skill: 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.

  1. Caller — is this for an AtomicAgent, a BaseTool, both (an agent that emits a tool-input schema), or a nested sub-schema?
  2. Direction — input only, output only, or a paired Input/Output?
  3. Fields — what fields does the caller need, with which types? (Required vs optional, defaults, constraints.)
  4. 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 (not BaseModel).
  • 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 a description= written for the LLM.
  • Use Literal[...] for closed sets before reaching for Enum — 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
Häufige Fragen

Warum braucht das Schema Dokumentationstexte?

Das Framework verlangt sie, und die Beschreibungen helfen dem Sprachmodell, jedes Feld richtig auszufüllen.

Kann ein Schema Fehlerversionen haben?

Ja. Die Fähigkeit deckt Erfolgs- und Fehlervarianten für Ausgaben ab, die fehlschlagen können.

Für wen ist das gedacht?

Für Entwickler, die Atomic-Agents-Apps bauen und typisierte Datenverträge brauchen.

Details

Originalbeschreibung des Autors

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

Beliebtheit

GitHub-Sterne
6.3k
Platz im Ranking
#14239
Lizenz
MIT
Aktualisiert
29.10.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills