a2ui-generate-pydantic-models
БесплатноЗапускает вложенные скриптыНе проверенAutomated generator for strongly typed Pydantic v2 data models and basic catalogs across any A2UI protocol version (v0.8, v0.9, v0.9.1, v1.0, etc.).
от a2ui-project★ 19 155 звёзд на GitHubОб этом скилле
A2UI Pydantic Model Generation Skill
This skill provides an automated code generation tool that produces strongly typed Pydantic v2 data models and basic catalog definitions for python/a2ui_core directly from the schemas and catalogs in specification/<version>/.
Agent Execution Steps
When given a prompt like "Generate Pydantic model classes for A2UI spec v1.0":
Extract the target version parameter from the prompt (e.g.
v1.0->v1.0).Execute the generator script exactly once for that target version:
uv run python .agents/skills/a2ui-generate-pydantic-models/scripts/codegen_pydantic.py --version <TARGET_VERSION>(Replace
<TARGET_VERSION>with the single requested version, e.g.--version v1.0).Format generated Python code:
cd python/a2ui_core uv run pyink .Verify the generated files by running pytest:
cd python/a2ui_core uv run pytest tests/test_codegen_pydantic.pyStop and report completion to the user.
Generated Output Files per Version
When executed for a target version <version> (e.g. v1.0 -> v1_0), the script generates:
python/a2ui_core/src/a2ui/core/schema/<version>/:constants.pycommon_types.py: strongly typed shared models and theCOMMON_TYPES_DEFSmanifest, which maps each spec$defsname to its symbol in spec order. No spec schema is copied verbatim; the published common types schema is rebuilt from these symbols.- Type aliases such as
ComponentId,Child,ChildListand theDynamic*unions are registered asAnnotated[..., Field(description=...)]with the spec descriptions, so the runtime JSON schema generator needs no per-def special cases. Dynamic unions list their members in spec order. - When a
Dynamic*def constrains its function-call branch with areturnTypeconst, the branch isAnnotated[FunctionCall, ReturnType("<type>")], which validates the return type and emits the spec'sallOfin both modes. Any other branch shape fails generation. - Every model extends
SpecBaseModel(hand-written inschema/common_types.py) and has no generated methods. Keywords that fields cannot produce are declared in the model config asjson_schema_extra=SchemaKeywords(...): it dropsadditionalPropertieswhere the spec leaves it out and addsreturnType,unevaluatedProperties,title,allowedParentsandoneOfrequired-alternatives (see_SPEC_KEYWORDS). The keywords apply only to the declaring model, not to subclasses.SpecBaseModelvalidates a declaredoneOfwhose branches only list required fields (for exampleFunctionResponse'svalue/error), requiring exactly one branch. - Only composition that references the catalog's function union is limited to
spec_schema()(SchemaKeywords(..., spec_only=True)), which the published common types schema uses: v0.9'sFunctionCalloneOf, v1.0'sFunctionCallallOfoverFunctionCommonandanyFunction(replace=True, since the spec def is pure composition), and v0.9's preciseargsshape (a schema-onlyJsonSchemaAsannotation requested through thex-python-typeproperty override). Catalogs keep the flat model shape there. References inside declared keywords are the markersdef_ref("<Def>")andcatalog_functions()from the internala2ui.core.schema._json_schemamodule, which the schema builder resolves to$refs.FunctionCallitself is a flat model that validates any call without the catalog. - Nested object properties with their own properties become helper models named
<Parent><Property>(for exampleComponentCommonMetadata,IndexSystemFunctionArgs,FunctionResponseError), which schemas inline. Wrapper unions such asActionareTypeAliasTypes, so fields reference them by def name. Each branch gets a<Def><Property>Wrappermodel, and a branch property that is an object becomes<Def><Property>(ActionEvent,ActionEventWrapper,ActionFunctionCallWrapper). A generated name that collides with a def, a base symbol or another helper fails generation. - A def that the spec leaves open (no
additionalPropertiesand nounevaluatedProperties: false) allows extra keys.ComponentCommonis the exception (_SUBCLASSED_DEFS): generated catalog components subclass it and must stay closed. - Optional fields are typed
X | Noneso they can be absent.SpecBaseModelrejects an explicit null for such a field unlessXaccepts null itself (Any), under both the spec name and the Python field name; it does not change the JSON schema. Catalog components inherit this rule throughComponentCommon. v0.9'sFunctionCall.argsalso rejects null values. - Primitive defs such as
CallIdareTypeAliasTypes, so local references keep their$ref. References from other documents to a primitive def map to its Python type through_CROSS_DOCUMENT_REF_TYPESinengine.py.
- Type aliases such as
Установить a2ui-generate-pydantic-models в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл a2ui-generate-pydantic-models?
Automated generator for strongly typed Pydantic v2 data models and basic catalogs across any A2UI protocol version (v0.8, v0.9, v0.9.1, v1.0, etc.).
Как установить скилл a2ui-generate-pydantic-models?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл a2ui-generate-pydantic-models запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic