create-atomic-schema
Skill này làm gì
Skill giải thích cách viết cấu trúc đầu vào và đầu ra mà các agent và công cụ trong framework Atomic Agents sử dụng. Dành cho lập trình viên định nghĩa dữ liệu mà mỗi phần của ứng dụng AI mong đợi và trả về.
Khi nào nên dùng
- ✓Khi lập trình viên cần một cấu trúc đầu ra mà mô hình ngôn ngữ phải điền cho một agent.
- ✓Khi lập trình viên muốn thêm một trường vào đầu vào của agent hoặc công cụ đang có.
- ✓Khi lập trình viên muốn các cấu trúc đầu ra riêng cho thành công và thất bại của một công cụ.
Liên kết skill
https://github.com/Eigenwise/atomic-agents/blob/main/claude-plugin/atomic-agents/skills/create-atomic-schema/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Thiết kế schema đầu ra cho một agent lập kế hoạch trả về danh sách các bước, kèm người phụ trách và ngày hết hạn.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill hỏi ai sử dụng schema và cần những trường cùng trường hợp lỗi nào, rồi viết một lớp schema với docstring và mô tả trường, vì các mô tả này cũng hướng dẫn mô hình.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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
Câu hỏi thường gặp
Vì sao schema cần docstring?
Framework yêu cầu chúng, và các mô tả giúp mô hình ngôn ngữ điền đúng từng trường.
Schema có thể có phiên bản lỗi không?
Có. Skill bao gồm các biến thể thành công và lỗi cho đầu ra có thể thất bại.
Ai là đối tượng sử dụng?
Lập trình viên xây dựng ứng dụng Atomic Agents cần các hợp đồng dữ liệu có kiểu.
Chi tiết
Mô tả gốc của tác giả
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
Độ phổ biến
- Sao GitHub
- 6.3k
- Vị trí xếp hạng
- #14239
- Giấy phép
- MIT
- Cập nhật
- 29/10/2026
Bình luận
- …
Thêm skill từ kho mã này
create-atomic-agent
6.3kGiúp agent của bạn xây dựng một Atomic Agents agent mới với đầu vào và đầu ra có kiểu, system prompt và nhà cung cấp AI đã chọn.
create-atomic-context-provider
6.3kGiúp agent của bạn thêm một context provider vào Atomic Agents agent, để các thông tin mới như thời gian hoặc tài liệu truy xuất xuất hiện trong prompt.
create-atomic-tool
6.3kGiúp agent của bạn xây dựng một công cụ có kiểu cho ứng dụng Atomic Agents, chẳng hạn một lớp bọc API hoặc máy tính mà agent có thể gọi.
framework
6.3kGiúp agent của bạn làm việc đúng với framework Python Atomic Agents, gồm schema, agent, công cụ, prompt và thiết lập nhà cung cấp.
Skill tương tự
diffs
394kGiúp agent của bạn tạo một diff có thể chia sẻ về các chỉnh sửa, dưới dạng liên kết xem hoặc file ảnh, thay vì một bản tóm tắt viết tay.
coding-agent
394kGiúp agent của bạn giao một việc lập trình lớn cho Codex, Claude Code hoặc OpenCode chạy nền, rồi theo dõi tiến độ của nó.
gh-issues
394kGiúp agent của bạn tìm issue trên GitHub, chọn những issue cần xử lý và mở pull request với bản sửa, kể cả theo dõi nhận xét đánh giá.