pydantic-validation
БесплатноЗапускает вложенные скриптыНе проверенRecord-level data validation using Pydantic models. Field validators, model validators, and batch validation patterns.
Об этом скилле
Pydantic Validation
Audience: Data engineers validating records in ETL pipelines.
Goal: Provide reusable Pydantic patterns for record-level validation.
Scripts
Execute validation functions from scripts/validators.py:
from scripts.validators import (
UserRecord,
Customer,
Order,
Address,
validate_records,
print_validation_errors,
PositiveInt,
Email
)
Usage Examples
Basic Model Validation
from scripts.validators import UserRecord
# Validate single record
user = UserRecord(
id=1,
email="[email protected]",
status="active",
created_at="2024-01-15",
age=25
)
print(user.email) # [email protected] (lowercased)
Batch Validation
from scripts.validators import validate_records, print_validation_errors
raw_data = [
{"id": 1, "email": "[email protected]", "status": "active", "created_at": "2024-01-01", "age": 25},
{"id": -1, "email": "invalid", "status": "bad", "created_at": "2024-01-01", "age": 200},
]
valid, invalid = validate_records(raw_data)
if invalid:
print_validation_errors(invalid)
Nested Models
from scripts.validators import Customer, Address
customer = Customer(
id=1,
name="John Doe",
billing_address=Address(
street="123 Main St",
city="NYC",
postal_code="10001"
)
)
# shipping_address defaults to billing_address
Field Constraints Reference
| Constraint | Example | Description |
|---|---|---|
gt, ge |
Field(gt=0) |
Greater than / greater-equal |
lt, le |
Field(le=100) |
Less than / less-equal |
pattern |
Field(pattern=r'^\d+$') |
Regex match |
min_length, max_length |
Field(min_length=1) |
String length |
JSON/Dict Conversion
# Parse from dict
customer = Customer(**data_dict)
# Parse from JSON
customer = Customer.model_validate_json(json_string)
# Export to dict/JSON
data = customer.model_dump()
json_str = customer.model_dump_json()
When to Use Pydantic
| Use Case | Pydantic | Alternative |
|---|---|---|
| API request/response | ✓ | FastAPI integration |
| Record-by-record ETL | ✓ | - |
| Full DataFrame validation | - | pandera |
| Pipeline expectations | - | Great Expectations |
Dependencies
pydantic>=2.0
pydantic-settings # For config validation
Установить pydantic-validation в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadWriteEditBashВложенные файлы
FAQ
Что делает скилл pydantic-validation?
Record-level data validation using Pydantic models. Field validators, model validators, and batch validation patterns.
Как установить скилл pydantic-validation?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл pydantic-validation запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
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